@vuu-ui/vuu-ui-controls 4.1.0 → 5.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +12 -13
- package/src/context-panel-provider/ContextPanelProvider.js +28 -40
- package/src/drag-drop/useDragDrop.js +7 -1
- package/src/icon-button/Icon.js +1 -0
- package/src/icon-button/IconButton.js +1 -1
- package/src/index.js +0 -1
- package/src/instrument-picker/TablePicker.css.js +1 -0
- package/src/instrument-picker/useTablePicker.js +3 -2
- package/src/item-picker/ItemPicker.js +79 -53
- package/src/prompt/Prompt.css.js +1 -0
- package/src/table-search/SearchCell.css.js +4 -2
- package/src/table-search/SearchCell.js +3 -2
- package/src/table-search/TableSearch.css.js +4 -0
- package/src/table-search/TableSearch.js +3 -1
- package/src/table-search/useTableSearch.js +14 -6
- package/src/tabstrip/Tabstrip.js +1 -1
- package/types/context-panel-provider/ContextPanelProvider.d.ts +3 -6
- package/types/icon-button/Icon.d.ts +1 -1
- package/types/icon-button/IconButton.d.ts +1 -1
- package/types/index.d.ts +1 -2
- package/types/instrument-picker/useTablePicker.d.ts +1 -1
- package/types/item-picker/ItemPicker.d.ts +26 -5
- package/types/item-picker/useItemPicker.d.ts +3 -2
- package/types/prompt/Prompt.d.ts +2 -2
- package/types/table-search/TableSearch.d.ts +2 -1
- package/types/table-search/useTableSearch.d.ts +2 -2
- package/types/tabstrip/Tabstrip.d.ts +1 -1
- package/src/modal-provider/ModalProvider.js +0 -147
- package/types/modal-provider/ModalProvider.d.ts +0 -13
- package/types/src/calendar/Calendar.d.ts +0 -13
- package/types/src/calendar/index.d.ts +0 -4
- package/types/src/calendar/internal/CalendarCarousel.d.ts +0 -3
- package/types/src/calendar/internal/CalendarContext.d.ts +0 -8
- package/types/src/calendar/internal/CalendarDay.d.ts +0 -14
- package/types/src/calendar/internal/CalendarMonth.d.ts +0 -10
- package/types/src/calendar/internal/CalendarNavigation.d.ts +0 -16
- package/types/src/calendar/internal/CalendarWeekHeader.d.ts +0 -3
- package/types/src/calendar/internal/useFocusManagement.d.ts +0 -9
- package/types/src/calendar/internal/utils.d.ts +0 -15
- package/types/src/calendar/useCalendar.d.ts +0 -54
- package/types/src/calendar/useCalendarDay.d.ts +0 -22
- package/types/src/calendar/useSelection.d.ts +0 -78
- package/types/src/column-picker/ColumnPicker.d.ts +0 -7
- package/types/src/column-picker/ColumnSearch.d.ts +0 -12
- package/types/src/column-picker/index.d.ts +0 -2
- package/types/src/column-picker/moving-window.d.ts +0 -14
- package/types/src/common-hooks/index.d.ts +0 -3
- package/types/src/common-hooks/selectionTypes.d.ts +0 -70
- package/types/src/common-hooks/use-resize-observer.d.ts +0 -16
- package/types/src/common-hooks/useControlled.d.ts +0 -24
- package/types/src/context-panel-provider/ContextPanelProvider.d.ts +0 -17
- package/types/src/cycle-state-button/CycleStateButton.d.ts +0 -11
- package/types/src/cycle-state-button/index.d.ts +0 -1
- package/types/src/date-input/DateInput.d.ts +0 -60
- package/types/src/date-input/index.d.ts +0 -1
- package/types/src/date-picker/DatePicker.d.ts +0 -66
- package/types/src/date-picker/DatePickerContext.d.ts +0 -19
- package/types/src/date-picker/DatePickerPanel.d.ts +0 -10
- package/types/src/date-picker/index.d.ts +0 -1
- package/types/src/drag-drop/DragDropProvider.d.ts +0 -38
- package/types/src/drag-drop/DragDropState.d.ts +0 -15
- package/types/src/drag-drop/Draggable.d.ts +0 -13
- package/types/src/drag-drop/DropIndicator.d.ts +0 -5
- package/types/src/drag-drop/dragDropTypes.d.ts +0 -100
- package/types/src/drag-drop/drop-target-utils.d.ts +0 -82
- package/types/src/drag-drop/index.d.ts +0 -6
- package/types/src/drag-drop/useAutoScroll.d.ts +0 -11
- package/types/src/drag-drop/useDragDisplacers.d.ts +0 -17
- package/types/src/drag-drop/useDragDrop.d.ts +0 -2
- package/types/src/drag-drop/useDragDropCopy.d.ts +0 -6
- package/types/src/drag-drop/useDragDropIndicator.d.ts +0 -2
- package/types/src/drag-drop/useDragDropNaturalMovement.d.ts +0 -2
- package/types/src/drag-drop/useDropIndicator.d.ts +0 -8
- package/types/src/drag-drop/useGlobalDragDrop.d.ts +0 -11
- package/types/src/drag-drop/useTransition.d.ts +0 -3
- package/types/src/editable/index.d.ts +0 -1
- package/types/src/editable/useEditableText.d.ts +0 -21
- package/types/src/editable-label/EditableLabel.d.ts +0 -19
- package/types/src/editable-label/index.d.ts +0 -1
- package/types/src/expando-input/ExpandoInput.d.ts +0 -6
- package/types/src/expando-input/index.d.ts +0 -1
- package/types/src/highlighter/Highlighter.d.ts +0 -6
- package/types/src/highlighter/index.d.ts +0 -1
- package/types/src/hover-overlay/HoverOverlay.d.ts +0 -8
- package/types/src/icon-button/Icon.d.ts +0 -6
- package/types/src/icon-button/IconButton.d.ts +0 -6
- package/types/src/icon-button/ToggleIconButton.d.ts +0 -5
- package/types/src/icon-button/index.d.ts +0 -3
- package/types/src/index.d.ts +0 -33
- package/types/src/instrument-picker/SearchCell.d.ts +0 -2
- package/types/src/instrument-picker/TablePicker.d.ts +0 -11
- package/types/src/instrument-picker/index.d.ts +0 -1
- package/types/src/instrument-picker/moving-window.d.ts +0 -14
- package/types/src/instrument-picker/useDataSource.d.ts +0 -6
- package/types/src/instrument-picker/useTablePicker.d.ts +0 -47
- package/types/src/item-picker/ItemPicker.d.ts +0 -14
- package/types/src/item-picker/useItemPicker.d.ts +0 -35
- package/types/src/measured-container/MeasuredContainer.d.ts +0 -16
- package/types/src/measured-container/index.d.ts +0 -2
- package/types/src/measured-container/useMeasuredContainer.d.ts +0 -23
- package/types/src/modal-provider/ModalProvider.d.ts +0 -13
- package/types/src/overflow-container/OverflowContainer.d.ts +0 -15
- package/types/src/overflow-container/index.d.ts +0 -2
- package/types/src/overflow-container/overflow-utils.d.ts +0 -48
- package/types/src/overflow-container/useOverflowContainer.d.ts +0 -19
- package/types/src/price-ticker/PriceTicker.d.ts +0 -7
- package/types/src/price-ticker/index.d.ts +0 -1
- package/types/src/prompt/Prompt.d.ts +0 -53
- package/types/src/sortable-list/SortableList.d.ts +0 -8
- package/types/src/split-button/SplitButton.d.ts +0 -11
- package/types/src/split-button/SplitStateButton.d.ts +0 -5
- package/types/src/split-button/index.d.ts +0 -2
- package/types/src/split-button/useSplitButton.d.ts +0 -311
- package/types/src/table-search/SearchCell.d.ts +0 -2
- package/types/src/table-search/TableSearch.d.ts +0 -9
- package/types/src/table-search/index.d.ts +0 -1
- package/types/src/table-search/moving-window.d.ts +0 -14
- package/types/src/table-search/useTableSearch.d.ts +0 -15
- package/types/src/tabs-next/TabBar.d.ts +0 -12
- package/types/src/tabs-next/TabListNext.d.ts +0 -12
- package/types/src/tabs-next/TabNext.d.ts +0 -12
- package/types/src/tabs-next/TabNextAction.d.ts +0 -5
- package/types/src/tabs-next/TabNextContext.d.ts +0 -12
- package/types/src/tabs-next/TabNextPanel.d.ts +0 -8
- package/types/src/tabs-next/TabNextTrigger.d.ts +0 -5
- package/types/src/tabs-next/TabOverflowList.d.ts +0 -11
- package/types/src/tabs-next/TabsNext.d.ts +0 -17
- package/types/src/tabs-next/TabsNextContext.d.ts +0 -21
- package/types/src/tabs-next/hooks/useCollection.d.ts +0 -18
- package/types/src/tabs-next/hooks/useFocusOutside.d.ts +0 -2
- package/types/src/tabs-next/hooks/useOverflow.d.ts +0 -11
- package/types/src/tabs-next/index.d.ts +0 -7
- package/types/src/tabstrip/Tab.d.ts +0 -27
- package/types/src/tabstrip/TabMenu.d.ts +0 -23
- package/types/src/tabstrip/TabMenuOptions.d.ts +0 -10
- package/types/src/tabstrip/TabsTypes.d.ts +0 -127
- package/types/src/tabstrip/Tabstrip.d.ts +0 -3
- package/types/src/tabstrip/index.d.ts +0 -5
- package/types/src/tabstrip/tabstrip-dom-utils.d.ts +0 -2
- package/types/src/tabstrip/useAnimatedSelectionThumb.d.ts +0 -7
- package/types/src/tabstrip/useKeyboardNavigation.d.ts +0 -29
- package/types/src/tabstrip/useSelection.d.ts +0 -13
- package/types/src/tabstrip/useTabstrip.d.ts +0 -55
- package/types/src/time-input/MaskedInput.d.ts +0 -49
- package/types/src/time-input/TimeInput.d.ts +0 -5
- package/types/src/time-input/useTimeInput.d.ts +0 -21
- package/types/src/toolbar/Toolbar.d.ts +0 -20
- package/types/src/toolbar/index.d.ts +0 -1
- package/types/src/toolbar/toolbar-dom-utils.d.ts +0 -3
- package/types/src/toolbar/useKeyboardNavigation.d.ts +0 -32
- package/types/src/toolbar/useSelection.d.ts +0 -22
- package/types/src/toolbar/useToolbar.d.ts +0 -28
- package/types/src/utils/deprecated-types.d.ts +0 -2
- package/types/src/utils/escapeRegExp.d.ts +0 -1
- package/types/src/utils/forwardCallbackProps.d.ts +0 -3
- package/types/src/utils/index.d.ts +0 -5
- package/types/src/utils/isOverflowElement.d.ts +0 -1
- package/types/src/utils/isPlainObject.d.ts +0 -1
- package/types/src/vuu-date-picker/VuuDatePicker.d.ts +0 -7
- package/types/src/vuu-date-picker/index.d.ts +0 -1
- package/types/src/vuu-input/VuuInput.d.ts +0 -18
- package/types/src/vuu-input/index.d.ts +0 -1
- package/types/src/vuu-time-picker/TimeRangePicker.d.ts +0 -0
- package/types/src/vuu-time-picker/VuuTimePicker.d.ts +0 -7
- package/types/src/vuu-typeahead-input/VuuTypeaheadInput.d.ts +0 -6
- package/types/src/vuu-typeahead-input/index.d.ts +0 -1
- package/types/src/vuu-typeahead-input/useVuuTypeaheadInput.d.ts +0 -49
package/package.json
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "
|
|
2
|
+
"version": "5.0.0-alpha.1",
|
|
3
3
|
"description": "VUU UI Controls",
|
|
4
4
|
"main": "./src/index.js",
|
|
5
5
|
"author": "heswell",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"build:dev": "node ../../scripts/run-build.mjs",
|
|
9
8
|
"build": "node ../../scripts/run-build-rslib.ts",
|
|
10
9
|
"type-defs": "node ../../scripts/build-type-defs.mjs"
|
|
11
10
|
},
|
|
12
11
|
"devDependencies": {
|
|
13
|
-
"@vuu-ui/vuu-data-types": "
|
|
14
|
-
"@vuu-ui/vuu-protocol-types": "
|
|
15
|
-
"@vuu-ui/vuu-table-types": "
|
|
12
|
+
"@vuu-ui/vuu-data-types": "5.0.0-alpha.1",
|
|
13
|
+
"@vuu-ui/vuu-protocol-types": "5.0.0-alpha.1",
|
|
14
|
+
"@vuu-ui/vuu-table-types": "5.0.0-alpha.1"
|
|
16
15
|
},
|
|
17
16
|
"dependencies": {
|
|
18
|
-
"@vuu-ui/vuu-context-menu": "
|
|
19
|
-
"@vuu-ui/vuu-data-react": "
|
|
20
|
-
"@vuu-ui/vuu-layout": "
|
|
21
|
-
"@vuu-ui/vuu-popups": "
|
|
22
|
-
"@vuu-ui/vuu-table": "
|
|
23
|
-
"@vuu-ui/vuu-utils": "
|
|
17
|
+
"@vuu-ui/vuu-context-menu": "5.0.0-alpha.1",
|
|
18
|
+
"@vuu-ui/vuu-data-react": "5.0.0-alpha.1",
|
|
19
|
+
"@vuu-ui/vuu-layout": "5.0.0-alpha.1",
|
|
20
|
+
"@vuu-ui/vuu-popups": "5.0.0-alpha.1",
|
|
21
|
+
"@vuu-ui/vuu-table": "5.0.0-alpha.1",
|
|
22
|
+
"@vuu-ui/vuu-utils": "5.0.0-alpha.1",
|
|
24
23
|
"@salt-ds/core": "1.74.0",
|
|
25
24
|
"@salt-ds/icons": "1.18.4",
|
|
26
25
|
"@salt-ds/styles": "0.4.2",
|
|
@@ -43,9 +42,9 @@
|
|
|
43
42
|
],
|
|
44
43
|
"exports": {
|
|
45
44
|
".": {
|
|
45
|
+
"types": "./types/index.d.ts",
|
|
46
46
|
"import": "./src/index.js",
|
|
47
|
-
"default": "./src/index.js"
|
|
48
|
-
"types": "./types/index.d.ts"
|
|
47
|
+
"default": "./src/index.js"
|
|
49
48
|
}
|
|
50
49
|
},
|
|
51
50
|
"module": "./src/index.js",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useCallback, useContext, useState } from "react";
|
|
3
|
-
import { isUnconfiguredProperty, layoutFromJson, useLayoutOperation } from "@vuu-ui/vuu-layout";
|
|
2
|
+
import { createContext, isValidElement, useCallback, useContext, useState } from "react";
|
|
4
3
|
import { Dialog, DialogCloseButton, DialogContent, DialogHeader } from "@salt-ds/core";
|
|
5
4
|
const UndefinedShowContextPanel = ()=>{
|
|
6
5
|
console.warn("[ContextPanelContext] no implementation for showContextPanel, you need to add a ContextPanelProvider");
|
|
@@ -8,54 +7,43 @@ const UndefinedShowContextPanel = ()=>{
|
|
|
8
7
|
const ContextPanelContext = /*#__PURE__*/ createContext({
|
|
9
8
|
showContextPanel: UndefinedShowContextPanel
|
|
10
9
|
});
|
|
11
|
-
const ContextPanelProvider = ({ children, hideContextPanel: hideContextPanelProp, showContextPanel: showContextPanelProp })=>{
|
|
10
|
+
const ContextPanelProvider = ({ children, hideContextPanel: hideContextPanelProp, resolveComponent, showContextPanel: showContextPanelProp })=>{
|
|
12
11
|
const { hideContextPanel: inheritedHideContextPanel, showContextPanel: inheritedShowContextPanel } = useContext(ContextPanelContext);
|
|
13
|
-
const { showComponentInContextPanel } = useLayoutOperation();
|
|
14
12
|
const [dialog, setDialog] = useState(null);
|
|
15
13
|
const handleOpenChange = useCallback((isOpen)=>{
|
|
16
14
|
if (!isOpen) setDialog(null);
|
|
17
15
|
}, []);
|
|
18
16
|
const hideContextPanel = hideContextPanelProp ?? inheritedHideContextPanel;
|
|
19
|
-
const showContextPanel = useCallback((
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
else if (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
})
|
|
45
|
-
]
|
|
46
|
-
}));
|
|
47
|
-
}
|
|
48
|
-
} else {
|
|
49
|
-
const component = "string" == typeof elementOrComponentType ? {
|
|
50
|
-
type: elementOrComponentType,
|
|
51
|
-
props
|
|
52
|
-
} : elementOrComponentType;
|
|
53
|
-
showComponentInContextPanel(component, title);
|
|
17
|
+
const showContextPanel = useCallback((component, title, componentProps)=>{
|
|
18
|
+
const resolvedComponent = "string" == typeof component && resolveComponent ? resolveComponent(component, componentProps) : component;
|
|
19
|
+
if (showContextPanelProp) showContextPanelProp(resolvedComponent, title, componentProps);
|
|
20
|
+
else if (inheritedShowContextPanel !== UndefinedShowContextPanel) inheritedShowContextPanel(resolvedComponent, title, componentProps);
|
|
21
|
+
else {
|
|
22
|
+
if (!/*#__PURE__*/ isValidElement(resolvedComponent)) throw new Error(`Context panel component "${component}" requires a configured resolver`);
|
|
23
|
+
setDialog(/*#__PURE__*/ jsxs(Dialog, {
|
|
24
|
+
open: true,
|
|
25
|
+
onOpenChange: handleOpenChange,
|
|
26
|
+
children: [
|
|
27
|
+
/*#__PURE__*/ jsx(DialogCloseButton, {
|
|
28
|
+
appearance: "transparent",
|
|
29
|
+
"data-embedded": true,
|
|
30
|
+
"data-icon": "close",
|
|
31
|
+
onClick: ()=>setDialog(null),
|
|
32
|
+
sentiment: "neutral"
|
|
33
|
+
}),
|
|
34
|
+
/*#__PURE__*/ jsx(DialogHeader, {
|
|
35
|
+
header: title
|
|
36
|
+
}),
|
|
37
|
+
/*#__PURE__*/ jsx(DialogContent, {
|
|
38
|
+
children: resolvedComponent
|
|
39
|
+
})
|
|
40
|
+
]
|
|
41
|
+
}));
|
|
54
42
|
}
|
|
55
43
|
}, [
|
|
56
44
|
handleOpenChange,
|
|
57
45
|
inheritedShowContextPanel,
|
|
58
|
-
|
|
46
|
+
resolveComponent,
|
|
59
47
|
showContextPanelProp
|
|
60
48
|
]);
|
|
61
49
|
return /*#__PURE__*/ jsxs(ContextPanelContext.Provider, {
|
|
@@ -292,6 +292,7 @@ const useDragDrop = ({ allowDragDrop, containerRef, draggableClassName, getDragP
|
|
|
292
292
|
scrollableContainerRef.current = scrollableContainer;
|
|
293
293
|
const containerRect = scrollableContainer.getBoundingClientRect();
|
|
294
294
|
const draggableRect = dragElement.getBoundingClientRect();
|
|
295
|
+
const dragElementStyle = getComputedStyle(dragElement);
|
|
295
296
|
const dragDropState = dragDropStateRef.current = new DragDropState(mousePosition, dragElement);
|
|
296
297
|
setDragBoundaries(containerRect, draggableRect);
|
|
297
298
|
beginDrag(dragElement);
|
|
@@ -303,7 +304,12 @@ const useDragDrop = ({ allowDragDrop, containerRef, draggableClassName, getDragP
|
|
|
303
304
|
onDropped: terminateDrag,
|
|
304
305
|
onTransitionEnd: terminateDrag,
|
|
305
306
|
ref: dragDropState.setDraggable,
|
|
306
|
-
style:
|
|
307
|
+
style: {
|
|
308
|
+
...constrainRect(draggableRect, containerRect),
|
|
309
|
+
backgroundColor: dragElementStyle.backgroundColor,
|
|
310
|
+
color: dragElementStyle.color,
|
|
311
|
+
font: dragElementStyle.font
|
|
312
|
+
},
|
|
307
313
|
wrapperClassName: draggableClassName
|
|
308
314
|
}),
|
|
309
315
|
draggedItemIndex: parseInt(index)
|
package/src/icon-button/Icon.js
CHANGED
|
@@ -16,10 +16,10 @@ const IconButton_IconButton = /*#__PURE__*/ forwardRef(function({ "aria-label":
|
|
|
16
16
|
});
|
|
17
17
|
return /*#__PURE__*/ jsx(Button, {
|
|
18
18
|
...buttonProps,
|
|
19
|
+
"aria-label": ariaLabel,
|
|
19
20
|
className: clsx(classBase, className),
|
|
20
21
|
ref: ref,
|
|
21
22
|
children: /*#__PURE__*/ jsx(Icon, {
|
|
22
|
-
"aria-label": ariaLabel,
|
|
23
23
|
name: icon,
|
|
24
24
|
size: size
|
|
25
25
|
})
|
package/src/index.js
CHANGED
|
@@ -26,7 +26,6 @@ export * from "./vuu-typeahead-input/index.js";
|
|
|
26
26
|
export { ContextPanelProvider, useContextPanel, useHideContextPanel } from "./context-panel-provider/ContextPanelProvider.js";
|
|
27
27
|
export { HoverOverlay } from "./hover-overlay/HoverOverlay.js";
|
|
28
28
|
export { ItemPicker } from "./item-picker/ItemPicker.js";
|
|
29
|
-
export { ModalProvider, useModal } from "./modal-provider/ModalProvider.js";
|
|
30
29
|
export { Prompt } from "./prompt/Prompt.js";
|
|
31
30
|
export { SortableList, SortableOption } from "./sortable-list/SortableList.js";
|
|
32
31
|
export { TimeInput } from "./time-input/TimeInput.js";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { flip, size, useClick, useDismiss, useInteractions } from "@floating-ui/react";
|
|
2
2
|
import { useFloatingUI } from "@salt-ds/core";
|
|
3
|
-
import { useCallback, useMemo, useRef, useState } from "react";
|
|
4
|
-
import { isStringColumn, toColumnName, useData } from "@vuu-ui/vuu-utils";
|
|
5
3
|
import { isNavigationKey, isRowSelectionKey, useControlledTableNavigation } from "@vuu-ui/vuu-table";
|
|
4
|
+
import { isStringColumn, toColumnName } from "@vuu-ui/vuu-utils";
|
|
5
|
+
import { useData } from "@vuu-ui/core";
|
|
6
|
+
import { useCallback, useMemo, useRef, useState } from "react";
|
|
6
7
|
const defaultRowToString = (dataRow)=>Object.values(dataRow).join(" ");
|
|
7
8
|
const useTablePicker = ({ TableProps, onSelect, rowToString = defaultRowToString, schema, searchColumns = schema.columns.filter(isStringColumn).map(toColumnName) })=>{
|
|
8
9
|
const { VuuDataSource } = useData();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Input, ListBox, Option } from "@salt-ds/core";
|
|
3
3
|
import { useComponentCssInjection } from "@salt-ds/styles";
|
|
4
4
|
import { useWindow } from "@salt-ds/window";
|
|
@@ -32,7 +32,7 @@ const useSorting = (id, index)=>{
|
|
|
32
32
|
ref
|
|
33
33
|
};
|
|
34
34
|
};
|
|
35
|
-
const
|
|
35
|
+
const DefaultSelectedListItem = ({ className: classNameProp, index, item, onRemove, searchPattern = "", ...optionProps })=>{
|
|
36
36
|
const { handleRef, ref } = useSorting(item.name, index);
|
|
37
37
|
const value = getItemLabel(item);
|
|
38
38
|
const valueWithHighlighting = applyHighlighting(value, searchPattern);
|
|
@@ -73,7 +73,7 @@ const SelectedListItem = ({ className: classNameProp, index, item, onRemove, sea
|
|
|
73
73
|
]
|
|
74
74
|
});
|
|
75
75
|
};
|
|
76
|
-
const
|
|
76
|
+
const DefaultAvailableListItem = ({ className: classNameProp, index, item, onAdd, searchPattern = "", disabled, ...optionProps })=>{
|
|
77
77
|
const value = getItemLabel(item);
|
|
78
78
|
const valueWithHighlighting = applyHighlighting(value, searchPattern);
|
|
79
79
|
return /*#__PURE__*/ jsxs(Option, {
|
|
@@ -98,7 +98,14 @@ const AvailableListItem = ({ className: classNameProp, index, item, onAdd, searc
|
|
|
98
98
|
]
|
|
99
99
|
});
|
|
100
100
|
};
|
|
101
|
-
const
|
|
101
|
+
const getOptionName = (option)=>{
|
|
102
|
+
if (option) {
|
|
103
|
+
const { name } = option.dataset;
|
|
104
|
+
if (name) return name;
|
|
105
|
+
}
|
|
106
|
+
throw Error("[ItemPicker] list option has no data-name");
|
|
107
|
+
};
|
|
108
|
+
const ItemPicker_ItemPicker = /*#__PURE__*/ forwardRef(function({ AvailableListItem = DefaultAvailableListItem, SelectedListItem = DefaultSelectedListItem, className, itemTypeName = 'Item', searchForm = true, allItems, layout = 'v-selected-available', selectedItems, maxSelections, onSelectedItemsChange, onSelectionChange, selected = NO_SELECTION, ...htmlAttributes }, forwardedRef) {
|
|
102
109
|
const targetWindow = useWindow();
|
|
103
110
|
useComponentCssInjection({
|
|
104
111
|
testId: "vuu-item-picker",
|
|
@@ -117,13 +124,6 @@ const ItemPicker_ItemPicker = /*#__PURE__*/ forwardRef(function({ className, ite
|
|
|
117
124
|
maxSelections
|
|
118
125
|
});
|
|
119
126
|
const listRef = useRef(null);
|
|
120
|
-
const getOptionName = (option)=>{
|
|
121
|
-
if (option) {
|
|
122
|
-
const { name } = option.dataset;
|
|
123
|
-
if (name) return name;
|
|
124
|
-
}
|
|
125
|
-
throw Error("[ItemPicker] list option has no data-name");
|
|
126
|
-
};
|
|
127
127
|
const handleDragEnd = useCallback(()=>{
|
|
128
128
|
setTimeout(()=>{
|
|
129
129
|
const listItems = listRef.current?.querySelectorAll(".saltOption");
|
|
@@ -133,19 +133,72 @@ const ItemPicker_ItemPicker = /*#__PURE__*/ forwardRef(function({ className, ite
|
|
|
133
133
|
}
|
|
134
134
|
}, 300);
|
|
135
135
|
}, [
|
|
136
|
-
|
|
137
|
-
selectedItemsFiltered
|
|
136
|
+
onReorderSelectedItems
|
|
138
137
|
]);
|
|
139
138
|
const searchPlaceholderText = `Find ${singularForm(itemTypeName)}`;
|
|
140
139
|
const maxSelectionsSubHeading = maxSelections ? `(${maxSelections} max)` : "";
|
|
141
140
|
const selectedItemsHeading = `${selectedItemsCount} ${1 === selectedItemsCount ? singularForm(itemTypeName) : pluralForm(itemTypeName)} in view ${maxSelectionsSubHeading}`;
|
|
142
141
|
const availableItemsHeading = `${availableItemsCount} available ${1 === availableItemsCount ? singularForm(itemTypeName) : pluralForm(itemTypeName)}`;
|
|
142
|
+
const selectedList = /*#__PURE__*/ jsxs(Fragment, {
|
|
143
|
+
children: [
|
|
144
|
+
/*#__PURE__*/ jsx("div", {
|
|
145
|
+
className: `${classBase}-sectionHeader`,
|
|
146
|
+
children: selectedItemsHeading
|
|
147
|
+
}),
|
|
148
|
+
/*#__PURE__*/ jsx(DragDropProvider, {
|
|
149
|
+
onDragEnd: handleDragEnd,
|
|
150
|
+
children: /*#__PURE__*/ jsx(ListBox, {
|
|
151
|
+
className: `${classBase}-selectedList`,
|
|
152
|
+
onSelectionChange: onSelectionChange,
|
|
153
|
+
ref: listRef,
|
|
154
|
+
selected: selected,
|
|
155
|
+
children: selectedItemsFiltered.map((item, index)=>/*#__PURE__*/ jsx(SelectedListItem, {
|
|
156
|
+
item: item,
|
|
157
|
+
index: index,
|
|
158
|
+
onRemove: onRemoveItemFromSelectedList,
|
|
159
|
+
searchPattern: searchText.toLowerCase(),
|
|
160
|
+
value: item
|
|
161
|
+
}, item.name))
|
|
162
|
+
})
|
|
163
|
+
})
|
|
164
|
+
]
|
|
165
|
+
});
|
|
166
|
+
const availableList = /*#__PURE__*/ jsxs(Fragment, {
|
|
167
|
+
children: [
|
|
168
|
+
/*#__PURE__*/ jsx("div", {
|
|
169
|
+
className: clsx(`${classBase}-sectionHeader`, `${classBase}-availableHeader`),
|
|
170
|
+
children: availableItemsHeading
|
|
171
|
+
}),
|
|
172
|
+
/*#__PURE__*/ jsx(ListBox, {
|
|
173
|
+
className: `${classBase}-availableList`,
|
|
174
|
+
selected: NO_SELECTION,
|
|
175
|
+
children: availableItemsFiltered.map((item, index)=>/*#__PURE__*/ jsx(AvailableListItem, {
|
|
176
|
+
item: item,
|
|
177
|
+
index: index,
|
|
178
|
+
onAdd: onAddItemToSelectedList,
|
|
179
|
+
searchPattern: searchText.toLowerCase(),
|
|
180
|
+
value: item,
|
|
181
|
+
disabled: selectedItemsCount === maxSelections
|
|
182
|
+
}, item.name))
|
|
183
|
+
})
|
|
184
|
+
]
|
|
185
|
+
});
|
|
143
186
|
return /*#__PURE__*/ jsxs("div", {
|
|
144
187
|
...htmlAttributes,
|
|
145
188
|
className: clsx(classBase, className),
|
|
146
189
|
ref: forwardedRef,
|
|
147
190
|
children: [
|
|
148
|
-
/*#__PURE__*/ jsx("form", {
|
|
191
|
+
searchForm ? /*#__PURE__*/ jsx("form", {
|
|
192
|
+
className: `${classBase}-search`,
|
|
193
|
+
role: "search",
|
|
194
|
+
children: /*#__PURE__*/ jsx(Input, {
|
|
195
|
+
startAdornment: searchIcon,
|
|
196
|
+
placeholder: searchPlaceholderText,
|
|
197
|
+
ref: searchCallbackRef,
|
|
198
|
+
value: searchText,
|
|
199
|
+
onChange: onChangeSearchInput
|
|
200
|
+
})
|
|
201
|
+
}) : /*#__PURE__*/ jsx("div", {
|
|
149
202
|
className: `${classBase}-search`,
|
|
150
203
|
role: "search",
|
|
151
204
|
children: /*#__PURE__*/ jsx(Input, {
|
|
@@ -156,46 +209,19 @@ const ItemPicker_ItemPicker = /*#__PURE__*/ forwardRef(function({ className, ite
|
|
|
156
209
|
onChange: onChangeSearchInput
|
|
157
210
|
})
|
|
158
211
|
}),
|
|
159
|
-
/*#__PURE__*/
|
|
212
|
+
/*#__PURE__*/ jsx("div", {
|
|
160
213
|
className: `${classBase}-scrollContainer vuuScrollable`,
|
|
161
|
-
children:
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
selected: selected,
|
|
173
|
-
children: selectedItemsFiltered.map((item, index)=>/*#__PURE__*/ jsx(SelectedListItem, {
|
|
174
|
-
item: item,
|
|
175
|
-
index: index,
|
|
176
|
-
onRemove: onRemoveItemFromSelectedList,
|
|
177
|
-
searchPattern: searchText.toLowerCase(),
|
|
178
|
-
value: item
|
|
179
|
-
}, item.name))
|
|
180
|
-
})
|
|
181
|
-
}),
|
|
182
|
-
/*#__PURE__*/ jsx("div", {
|
|
183
|
-
className: clsx(`${classBase}-sectionHeader`, `${classBase}-availableHeader`),
|
|
184
|
-
children: availableItemsHeading
|
|
185
|
-
}),
|
|
186
|
-
/*#__PURE__*/ jsx(ListBox, {
|
|
187
|
-
className: `${classBase}-availableList`,
|
|
188
|
-
selected: NO_SELECTION,
|
|
189
|
-
children: availableItemsFiltered.map((item, index)=>/*#__PURE__*/ jsx(AvailableListItem, {
|
|
190
|
-
item: item,
|
|
191
|
-
index: index,
|
|
192
|
-
onAdd: onAddItemToSelectedList,
|
|
193
|
-
searchPattern: searchText.toLowerCase(),
|
|
194
|
-
value: item,
|
|
195
|
-
disabled: selectedItemsCount === maxSelections
|
|
196
|
-
}, item.name))
|
|
197
|
-
})
|
|
198
|
-
]
|
|
214
|
+
children: 'v-selected-available' === layout ? /*#__PURE__*/ jsxs(Fragment, {
|
|
215
|
+
children: [
|
|
216
|
+
selectedList,
|
|
217
|
+
availableList
|
|
218
|
+
]
|
|
219
|
+
}) : /*#__PURE__*/ jsxs(Fragment, {
|
|
220
|
+
children: [
|
|
221
|
+
availableList,
|
|
222
|
+
selectedList
|
|
223
|
+
]
|
|
224
|
+
})
|
|
199
225
|
})
|
|
200
226
|
]
|
|
201
227
|
});
|
package/src/prompt/Prompt.css.js
CHANGED
|
@@ -3,8 +3,10 @@ const css = `
|
|
|
3
3
|
--vuu-icon-left: 0;
|
|
4
4
|
--vuu-icon-size: 16px;
|
|
5
5
|
--vuu-icon-top: -1px;
|
|
6
|
-
color:
|
|
7
|
-
|
|
6
|
+
color: inherit;
|
|
7
|
+
cursor: grab;
|
|
8
|
+
-webkit-user-select: none;
|
|
9
|
+
user-select: none;
|
|
8
10
|
align-items: center;
|
|
9
11
|
padding: 0 8px;
|
|
10
12
|
display: flex;
|
|
@@ -2,6 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useComponentCssInjection } from "@salt-ds/styles";
|
|
3
3
|
import { useWindow } from "@salt-ds/window";
|
|
4
4
|
import { applyHighlighting } from "@vuu-ui/vuu-table";
|
|
5
|
+
import { Icon } from "../icon-button/index.js";
|
|
5
6
|
import SearchCell from "./SearchCell.css";
|
|
6
7
|
const classBase = "vuuSearchCell";
|
|
7
8
|
const SearchCell_SearchCell = ({ column, dataRow, searchPattern = "" })=>{
|
|
@@ -16,8 +17,8 @@ const SearchCell_SearchCell = ({ column, dataRow, searchPattern = "" })=>{
|
|
|
16
17
|
className: classBase,
|
|
17
18
|
tabIndex: -1,
|
|
18
19
|
children: [
|
|
19
|
-
/*#__PURE__*/ jsx(
|
|
20
|
-
|
|
20
|
+
/*#__PURE__*/ jsx(Icon, {
|
|
21
|
+
name: "draggable"
|
|
21
22
|
}),
|
|
22
23
|
valueWithHighlighting
|
|
23
24
|
]
|
|
@@ -16,7 +16,7 @@ const defaultConfig = {
|
|
|
16
16
|
const searchIcon = /*#__PURE__*/ jsx("span", {
|
|
17
17
|
"data-icon": "search"
|
|
18
18
|
});
|
|
19
|
-
const TableSearch_TableSearch = ({ TableProps: { dataSource: dataSourceProp, ...TableProps }, autoFocus = false, className, placeHolder, searchColumns, ...htmlAttributes })=>{
|
|
19
|
+
const TableSearch_TableSearch = ({ TableProps: { dataSource: dataSourceProp, ...TableProps }, autoFocus = false, baseFilter, className, placeHolder, searchColumns, ...htmlAttributes })=>{
|
|
20
20
|
const targetWindow = useWindow();
|
|
21
21
|
useComponentCssInjection({
|
|
22
22
|
testId: "vuu-table-search",
|
|
@@ -30,6 +30,7 @@ const TableSearch_TableSearch = ({ TableProps: { dataSource: dataSourceProp, ...
|
|
|
30
30
|
TableProps?.config
|
|
31
31
|
]);
|
|
32
32
|
const { dataSource, onChange, searchState } = useTableSearch({
|
|
33
|
+
baseFilter,
|
|
33
34
|
dataSource: dataSourceProp,
|
|
34
35
|
searchColumns
|
|
35
36
|
});
|
|
@@ -46,6 +47,7 @@ const TableSearch_TableSearch = ({ TableProps: { dataSource: dataSourceProp, ...
|
|
|
46
47
|
/*#__PURE__*/ jsx("div", {
|
|
47
48
|
className: `${classBase}-inputField`,
|
|
48
49
|
children: /*#__PURE__*/ jsx(Input, {
|
|
50
|
+
bordered: true,
|
|
49
51
|
inputProps: {
|
|
50
52
|
onKeyDown
|
|
51
53
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useCallback, useMemo, useState } from "react";
|
|
2
|
-
const useTableSearch = ({ dataSource, searchColumns })=>{
|
|
1
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
2
|
+
const useTableSearch = ({ baseFilter = "", dataSource, searchColumns })=>{
|
|
3
3
|
const [searchState, setSearchState] = useState({
|
|
4
4
|
searchText: "",
|
|
5
5
|
filter: ""
|
|
@@ -14,12 +14,20 @@ const useTableSearch = ({ dataSource, searchColumns })=>{
|
|
|
14
14
|
searchText: value,
|
|
15
15
|
filter
|
|
16
16
|
});
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
}, [
|
|
18
|
+
baseFilterPattern
|
|
19
|
+
]);
|
|
20
|
+
useEffect(()=>{
|
|
21
|
+
dataSource.filter = {
|
|
22
|
+
filter: [
|
|
23
|
+
baseFilter,
|
|
24
|
+
searchState.filter
|
|
25
|
+
].filter(Boolean).map((filter)=>`(${filter})`).join(" and ")
|
|
19
26
|
};
|
|
20
27
|
}, [
|
|
21
|
-
|
|
22
|
-
dataSource
|
|
28
|
+
baseFilter,
|
|
29
|
+
dataSource,
|
|
30
|
+
searchState.filter
|
|
23
31
|
]);
|
|
24
32
|
return {
|
|
25
33
|
dataSource,
|
package/src/tabstrip/Tabstrip.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { type ReactElement, type ReactNode } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* If component is a string, the component will be read from the
|
|
4
|
-
* comoponent registry. In that case, componentProps can be used
|
|
5
|
-
* to pass props to the component.
|
|
6
|
-
*/
|
|
7
2
|
export type ShowContextPanel = (component: string | ReactElement, title: string, componentProps?: unknown) => void;
|
|
8
3
|
export interface ContextPanelProps {
|
|
9
4
|
hideContextPanel?: () => void;
|
|
10
5
|
showContextPanel: ShowContextPanel;
|
|
11
6
|
}
|
|
7
|
+
export type ResolveContextPanelComponent = (component: string, componentProps?: unknown) => ReactElement;
|
|
12
8
|
export declare const ContextPanelContext: import("react").Context<ContextPanelProps>;
|
|
13
|
-
export declare const ContextPanelProvider: ({ children, hideContextPanel: hideContextPanelProp, showContextPanel: showContextPanelProp, }: Partial<ContextPanelProps> & {
|
|
9
|
+
export declare const ContextPanelProvider: ({ children, hideContextPanel: hideContextPanelProp, resolveComponent, showContextPanel: showContextPanelProp, }: Partial<ContextPanelProps> & {
|
|
14
10
|
children: ReactNode;
|
|
11
|
+
resolveComponent?: ResolveContextPanelComponent;
|
|
15
12
|
}) => import("react").JSX.Element;
|
|
16
13
|
export declare function useContextPanel(): ShowContextPanel;
|
|
17
14
|
export declare function useHideContextPanel(): (() => void) | undefined;
|
package/types/index.d.ts
CHANGED
|
@@ -13,9 +13,8 @@ export { HoverOverlay, type HoverOverlayProps, } from "./hover-overlay/HoverOver
|
|
|
13
13
|
export * from "./icon-button";
|
|
14
14
|
export * from "./instrument-picker";
|
|
15
15
|
export { ItemPicker, type ItemPickerProps } from "./item-picker/ItemPicker";
|
|
16
|
-
export {
|
|
16
|
+
export type { ItemDescriptor, SelectedItemsChangeHandler as SelectedItemChangeHandler } from "./item-picker/useItemPicker";
|
|
17
17
|
export * from "./measured-container";
|
|
18
|
-
export { ModalProvider, useModal } from "./modal-provider/ModalProvider";
|
|
19
18
|
export * from "./overflow-container";
|
|
20
19
|
export * from "./price-ticker";
|
|
21
20
|
export { Prompt, type PromptProps } from "./prompt/Prompt";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ChangeEvent, KeyboardEventHandler, RefCallback } from "react";
|
|
2
1
|
import type { TableConfig, TableRowSelectHandler } from "@vuu-ui/vuu-table-types";
|
|
2
|
+
import { type ChangeEvent, type KeyboardEventHandler, type RefCallback } from "react";
|
|
3
3
|
import type { TablePickerProps } from "./TablePicker";
|
|
4
4
|
export interface TablePickerHookProps extends Pick<TablePickerProps, "TableProps" | "onSelect" | "rowToString" | "schema" | "searchColumns"> {
|
|
5
5
|
defaultIsOpen?: boolean;
|
|
@@ -1,13 +1,34 @@
|
|
|
1
|
-
import { ListBoxProps } from "@salt-ds/core";
|
|
2
|
-
import { ItemTypeName } from "@vuu-ui/vuu-utils";
|
|
3
|
-
import { HTMLAttributes } from "react";
|
|
4
|
-
import { ItemDescriptor, ItemPickerHookProps } from "./useItemPicker";
|
|
1
|
+
import { type ListBoxProps, type OptionProps } from "@salt-ds/core";
|
|
2
|
+
import { type ItemTypeName } from "@vuu-ui/vuu-utils";
|
|
3
|
+
import { type ComponentType, type HTMLAttributes, type MouseEventHandler } from "react";
|
|
4
|
+
import { type ItemDescriptor, type ItemPickerHookProps } from "./useItemPicker";
|
|
5
5
|
export declare const classBaseListItem = "vuuItemPickerListItem";
|
|
6
|
+
export type ItemPickerLayout = 'v-available-selected' | 'v-selected-available';
|
|
6
7
|
export interface ItemPickerProps extends ItemPickerHookProps, HTMLAttributes<HTMLDivElement>, Pick<ListBoxProps<ItemDescriptor>, "selected" | "onSelectionChange"> {
|
|
7
|
-
|
|
8
|
+
AvailableListItem?: ComponentType<AvailableListItemProps>;
|
|
9
|
+
SelectedListItem?: ComponentType<SelectedListItemProps>;
|
|
10
|
+
itemTypeName?: ItemTypeName;
|
|
11
|
+
/**
|
|
12
|
+
* Display order of SelectedItems List / AvailableItems List
|
|
13
|
+
*/
|
|
14
|
+
layout?: ItemPickerLayout;
|
|
15
|
+
searchForm?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface SelectedListItemProps extends OptionProps {
|
|
18
|
+
index: number;
|
|
19
|
+
item: ItemDescriptor;
|
|
20
|
+
onRemove: MouseEventHandler<HTMLButtonElement>;
|
|
21
|
+
searchPattern?: Lowercase<string>;
|
|
22
|
+
}
|
|
23
|
+
interface AvailableListItemProps extends OptionProps {
|
|
24
|
+
index: number;
|
|
25
|
+
item: ItemDescriptor;
|
|
26
|
+
onAdd: MouseEventHandler<HTMLButtonElement>;
|
|
27
|
+
searchPattern?: Lowercase<string>;
|
|
8
28
|
}
|
|
9
29
|
/** Generic controlled component that displays items in a 'picker' that are available to search, select, reorder or deselect.
|
|
10
30
|
* As input props, all available items, currently selected items, search text and callback functions for changes in selected items and search text
|
|
11
31
|
* must be supplied by the client.
|
|
12
32
|
*/
|
|
13
33
|
export declare const ItemPicker: import("react").ForwardRefExoticComponent<ItemPickerProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
34
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { FormEventHandler, MouseEventHandler } from "react";
|
|
1
|
+
import { type FormEventHandler, type MouseEventHandler } from "react";
|
|
2
|
+
export type SelectedItemsChangeHandler = (newSelectedItems: readonly ItemDescriptor[]) => void;
|
|
2
3
|
/** This is a public description of an Item that can be displayed in the ItemPicker component, defining all the
|
|
3
4
|
* mandatory and option attributes that can be defined by the client. */
|
|
4
5
|
export interface ItemDescriptor {
|
|
@@ -15,7 +16,7 @@ export interface ItemPickerHookProps {
|
|
|
15
16
|
allItems: ItemDescriptor[];
|
|
16
17
|
selectedItems: ItemDescriptor[];
|
|
17
18
|
maxSelections?: number;
|
|
18
|
-
onSelectedItemsChange:
|
|
19
|
+
onSelectedItemsChange: SelectedItemsChangeHandler;
|
|
19
20
|
}
|
|
20
21
|
export declare const getItemLabel: (item: ItemDescriptor) => string;
|
|
21
22
|
export declare const useItemPicker: ({ allItems, selectedItems, maxSelections, onSelectedItemsChange, }: ItemPickerHookProps) => {
|