@vuu-ui/vuu-ui-controls 4.0.0-alpha.9 → 4.0.0-beta.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 +16 -14
- package/src/context-panel-provider/ContextPanelProvider.js +40 -28
- package/src/drag-drop/Draggable.css.js +2 -2
- package/src/expando-input/ExpandoInput.css.js +1 -1
- package/src/icon-button/Icon.js +0 -1
- package/src/icon-button/IconButton.js +1 -1
- package/src/icon-button/ToggleIconButton.css.js +1 -1
- package/src/index.js +1 -1
- package/src/instrument-picker/useTablePicker.js +2 -3
- package/src/item-picker/ItemPicker.css.js +1 -1
- package/src/item-picker/ItemPicker.js +53 -79
- package/src/price-ticker/PriceTicker.css.js +4 -4
- package/src/split-pane/SplitPane.css.js +82 -0
- package/src/split-pane/SplitPane.js +60 -0
- package/src/split-pane/Splitter.js +82 -0
- package/src/split-pane/index.js +1 -0
- package/src/split-pane/useSplitPane.js +101 -0
- package/src/tabstrip/Tab.css.js +3 -3
- package/src/tabstrip/Tabstrip.css.js +2 -2
- package/src/tabstrip/Tabstrip.js +1 -1
- package/src/time-input/MaskedInput.js +176 -156
- package/src/time-input/TimeInput.css.js +41 -18
- package/src/time-input/TimeInput.js +25 -14
- package/src/time-input/useTimeInput.js +57 -47
- package/src/toolbar/Toolbar.css.js +1 -1
- package/src/vuu-date-picker/VuuDatePicker.js +46 -52
- package/src/vuu-time-picker/VuuTimePicker.js +6 -5
- package/types/context-panel-provider/ContextPanelProvider.d.ts +7 -4
- package/types/drag-drop/DragDropProvider.d.ts +1 -1
- package/types/hover-overlay/HoverOverlay.d.ts +1 -1
- package/types/icon-button/Icon.d.ts +2 -2
- package/types/icon-button/IconButton.d.ts +1 -1
- package/types/icon-button/ToggleIconButton.d.ts +1 -1
- package/types/index.d.ts +4 -3
- package/types/instrument-picker/SearchCell.d.ts +1 -1
- package/types/instrument-picker/TablePicker.d.ts +1 -1
- package/types/instrument-picker/useTablePicker.d.ts +1 -1
- package/types/item-picker/ItemPicker.d.ts +5 -26
- package/types/item-picker/useItemPicker.d.ts +3 -4
- package/types/modal-provider/ModalProvider.d.ts +1 -1
- package/types/price-ticker/PriceTicker.d.ts +1 -1
- package/types/prompt/Prompt.d.ts +1 -1
- package/types/sortable-list/SortableList.d.ts +2 -2
- package/types/split-button/useSplitButton.d.ts +12 -12
- package/types/split-pane/SplitPane.d.ts +44 -0
- package/types/split-pane/Splitter.d.ts +10 -0
- package/types/split-pane/index.d.ts +2 -0
- package/types/split-pane/useSplitPane.d.ts +18 -0
- package/types/table-search/SearchCell.d.ts +1 -1
- package/types/table-search/TableSearch.d.ts +1 -1
- package/types/tabstrip/TabMenu.d.ts +1 -1
- package/types/tabstrip/Tabstrip.d.ts +2 -3
- package/types/time-input/MaskedInput.d.ts +60 -10
- package/types/time-input/TimeInput.d.ts +4 -3
- package/types/time-input/useTimeInput.d.ts +24 -5
- package/types/toolbar/Toolbar.d.ts +1 -2
- package/types/vuu-date-picker/VuuDatePicker.d.ts +19 -3
- package/types/vuu-time-picker/VuuTimePicker.d.ts +8 -6
- package/types/vuu-typeahead-input/VuuTypeaheadInput.d.ts +1 -1
- 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,30 +1,30 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "4.0.0-
|
|
2
|
+
"version": "4.0.0-beta.1",
|
|
3
3
|
"description": "VUU UI Controls",
|
|
4
4
|
"main": "./src/index.js",
|
|
5
5
|
"author": "heswell",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
|
-
"type": "module",
|
|
8
7
|
"scripts": {
|
|
9
8
|
"build:dev": "node ../../scripts/run-build.mjs",
|
|
10
9
|
"build": "node ../../scripts/run-build-rslib.ts",
|
|
11
10
|
"type-defs": "node ../../scripts/build-type-defs.mjs"
|
|
12
11
|
},
|
|
13
12
|
"devDependencies": {
|
|
14
|
-
"@vuu-ui/vuu-data-types": "4.0.0-
|
|
15
|
-
"@vuu-ui/vuu-protocol-types": "4.0.0-
|
|
16
|
-
"@vuu-ui/vuu-table-types": "4.0.0-
|
|
13
|
+
"@vuu-ui/vuu-data-types": "4.0.0-beta.1",
|
|
14
|
+
"@vuu-ui/vuu-protocol-types": "4.0.0-beta.1",
|
|
15
|
+
"@vuu-ui/vuu-table-types": "4.0.0-beta.1"
|
|
17
16
|
},
|
|
18
17
|
"dependencies": {
|
|
19
|
-
"@vuu-ui/vuu-context-menu": "4.0.0-
|
|
20
|
-
"@vuu-ui/vuu-data-react": "4.0.0-
|
|
21
|
-
"@vuu-ui/vuu-
|
|
22
|
-
"@vuu-ui/vuu-
|
|
23
|
-
"@vuu-ui/vuu-
|
|
24
|
-
"@
|
|
25
|
-
"@salt-ds/
|
|
26
|
-
"@salt-ds/
|
|
27
|
-
"@salt-ds/
|
|
18
|
+
"@vuu-ui/vuu-context-menu": "4.0.0-beta.1",
|
|
19
|
+
"@vuu-ui/vuu-data-react": "4.0.0-beta.1",
|
|
20
|
+
"@vuu-ui/vuu-layout": "4.0.0-beta.1",
|
|
21
|
+
"@vuu-ui/vuu-popups": "4.0.0-beta.1",
|
|
22
|
+
"@vuu-ui/vuu-table": "4.0.0-beta.1",
|
|
23
|
+
"@vuu-ui/vuu-utils": "4.0.0-beta.1",
|
|
24
|
+
"@salt-ds/core": "1.72.0",
|
|
25
|
+
"@salt-ds/icons": "1.18.3",
|
|
26
|
+
"@salt-ds/styles": "0.4.1",
|
|
27
|
+
"@salt-ds/window": "0.1.2",
|
|
28
28
|
"tabbable": "^6.0.0"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"react-dom": "^19.2.3"
|
|
36
36
|
},
|
|
37
37
|
"sideEffects": false,
|
|
38
|
+
"type": "module",
|
|
38
39
|
"files": [
|
|
39
40
|
"README.md",
|
|
40
41
|
"src",
|
|
@@ -43,6 +44,7 @@
|
|
|
43
44
|
"exports": {
|
|
44
45
|
".": {
|
|
45
46
|
"import": "./src/index.js",
|
|
47
|
+
"default": "./src/index.js",
|
|
46
48
|
"types": "./types/index.d.ts"
|
|
47
49
|
}
|
|
48
50
|
},
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { createContext,
|
|
2
|
+
import { createContext, useCallback, useContext, useState } from "react";
|
|
3
|
+
import { isUnconfiguredProperty, layoutFromJson, useLayoutOperation } from "@vuu-ui/vuu-layout";
|
|
3
4
|
import { Dialog, DialogCloseButton, DialogContent, DialogHeader } from "@salt-ds/core";
|
|
4
5
|
const UndefinedShowContextPanel = ()=>{
|
|
5
6
|
console.warn("[ContextPanelContext] no implementation for showContextPanel, you need to add a ContextPanelProvider");
|
|
@@ -7,43 +8,54 @@ const UndefinedShowContextPanel = ()=>{
|
|
|
7
8
|
const ContextPanelContext = /*#__PURE__*/ createContext({
|
|
8
9
|
showContextPanel: UndefinedShowContextPanel
|
|
9
10
|
});
|
|
10
|
-
const ContextPanelProvider = ({ children, hideContextPanel: hideContextPanelProp,
|
|
11
|
+
const ContextPanelProvider = ({ children, hideContextPanel: hideContextPanelProp, showContextPanel: showContextPanelProp })=>{
|
|
11
12
|
const { hideContextPanel: inheritedHideContextPanel, showContextPanel: inheritedShowContextPanel } = useContext(ContextPanelContext);
|
|
13
|
+
const { showComponentInContextPanel } = useLayoutOperation();
|
|
12
14
|
const [dialog, setDialog] = useState(null);
|
|
13
15
|
const handleOpenChange = useCallback((isOpen)=>{
|
|
14
16
|
if (!isOpen) setDialog(null);
|
|
15
17
|
}, []);
|
|
16
18
|
const hideContextPanel = hideContextPanelProp ?? inheritedHideContextPanel;
|
|
17
|
-
const showContextPanel = useCallback((
|
|
18
|
-
|
|
19
|
-
if (
|
|
20
|
-
else if (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
19
|
+
const showContextPanel = useCallback((elementOrComponentType, title, props)=>{
|
|
20
|
+
if (showContextPanelProp) showContextPanelProp(elementOrComponentType, title, props);
|
|
21
|
+
else if (inheritedShowContextPanel !== UndefinedShowContextPanel) inheritedShowContextPanel(elementOrComponentType, title, props);
|
|
22
|
+
else if (isUnconfiguredProperty(showComponentInContextPanel)) {
|
|
23
|
+
if ("string" == typeof elementOrComponentType) {
|
|
24
|
+
const component = "string" == typeof elementOrComponentType ? layoutFromJson({
|
|
25
|
+
type: elementOrComponentType,
|
|
26
|
+
props
|
|
27
|
+
}, "") : elementOrComponentType;
|
|
28
|
+
setDialog(/*#__PURE__*/ jsxs(Dialog, {
|
|
29
|
+
open: true,
|
|
30
|
+
onOpenChange: handleOpenChange,
|
|
31
|
+
children: [
|
|
32
|
+
/*#__PURE__*/ jsx(DialogCloseButton, {
|
|
33
|
+
appearance: "transparent",
|
|
34
|
+
"data-embedded": true,
|
|
35
|
+
"data-icon": "close",
|
|
36
|
+
onClick: ()=>setDialog(null),
|
|
37
|
+
sentiment: "neutral"
|
|
38
|
+
}),
|
|
39
|
+
/*#__PURE__*/ jsx(DialogHeader, {
|
|
40
|
+
header: title
|
|
41
|
+
}),
|
|
42
|
+
/*#__PURE__*/ jsx(DialogContent, {
|
|
43
|
+
children: component
|
|
44
|
+
})
|
|
45
|
+
]
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
} else {
|
|
49
|
+
const component = "string" == typeof elementOrComponentType ? {
|
|
50
|
+
type: elementOrComponentType,
|
|
51
|
+
props
|
|
52
|
+
} : elementOrComponentType;
|
|
53
|
+
showComponentInContextPanel(component, title);
|
|
42
54
|
}
|
|
43
55
|
}, [
|
|
44
56
|
handleOpenChange,
|
|
45
57
|
inheritedShowContextPanel,
|
|
46
|
-
|
|
58
|
+
showComponentInContextPanel,
|
|
47
59
|
showContextPanelProp
|
|
48
60
|
]);
|
|
49
61
|
return /*#__PURE__*/ jsxs(ContextPanelContext.Provider, {
|
|
@@ -26,14 +26,14 @@ const css = `
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
.vuuDraggable-dropIndicator {
|
|
29
|
-
background-color: var(--salt-
|
|
29
|
+
background-color: var(--salt-sentiment-accent-background);
|
|
30
30
|
width: 100%;
|
|
31
31
|
height: 2px;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
.vuuDraggable-dropIndicator:before {
|
|
35
35
|
content: "";
|
|
36
|
-
background-color: var(--salt-
|
|
36
|
+
background-color: var(--salt-sentiment-accent-background);
|
|
37
37
|
border-radius: 3px;
|
|
38
38
|
width: 6px;
|
|
39
39
|
height: 6px;
|
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,
|
|
20
19
|
className: clsx(classBase, className),
|
|
21
20
|
ref: ref,
|
|
22
21
|
children: /*#__PURE__*/ jsx(Icon, {
|
|
22
|
+
"aria-label": ariaLabel,
|
|
23
23
|
name: icon,
|
|
24
24
|
size: size
|
|
25
25
|
})
|
package/src/index.js
CHANGED
|
@@ -14,6 +14,7 @@ export * from "./measured-container/index.js";
|
|
|
14
14
|
export * from "./overflow-container/index.js";
|
|
15
15
|
export * from "./price-ticker/index.js";
|
|
16
16
|
export * from "./split-button/index.js";
|
|
17
|
+
export * from "./split-pane/index.js";
|
|
17
18
|
export * from "./table-search/index.js";
|
|
18
19
|
export * from "./tabs-next/index.js";
|
|
19
20
|
export * from "./tabstrip/index.js";
|
|
@@ -25,7 +26,6 @@ export * from "./vuu-typeahead-input/index.js";
|
|
|
25
26
|
export { ContextPanelProvider, useContextPanel, useHideContextPanel } from "./context-panel-provider/ContextPanelProvider.js";
|
|
26
27
|
export { HoverOverlay } from "./hover-overlay/HoverOverlay.js";
|
|
27
28
|
export { ItemPicker } from "./item-picker/ItemPicker.js";
|
|
28
|
-
export { SelectedItemsChangeHandler as SelectedItemChangeHandler } from "./item-picker/useItemPicker.js";
|
|
29
29
|
export { ModalProvider, useModal } from "./modal-provider/ModalProvider.js";
|
|
30
30
|
export { Prompt } from "./prompt/Prompt.js";
|
|
31
31
|
export { SortableList, SortableOption } from "./sortable-list/SortableList.js";
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { flip, size, useClick, useDismiss, useInteractions } from "@floating-ui/react";
|
|
2
2
|
import { useFloatingUI } from "@salt-ds/core";
|
|
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
3
|
import { useCallback, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { isStringColumn, toColumnName, useData } from "@vuu-ui/vuu-utils";
|
|
5
|
+
import { isNavigationKey, isRowSelectionKey, useControlledTableNavigation } from "@vuu-ui/vuu-table";
|
|
7
6
|
const defaultRowToString = (dataRow)=>Object.values(dataRow).join(" ");
|
|
8
7
|
const useTablePicker = ({ TableProps, onSelect, rowToString = defaultRowToString, schema, searchColumns = schema.columns.filter(isStringColumn).map(toColumnName) })=>{
|
|
9
8
|
const { VuuDataSource } = useData();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { 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 SelectedListItem = ({ 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 DefaultSelectedListItem = ({ className: classNameProp, index, item, onRemo
|
|
|
73
73
|
]
|
|
74
74
|
});
|
|
75
75
|
};
|
|
76
|
-
const
|
|
76
|
+
const AvailableListItem = ({ 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,14 +98,7 @@ const DefaultAvailableListItem = ({ className: classNameProp, index, item, onAdd
|
|
|
98
98
|
]
|
|
99
99
|
});
|
|
100
100
|
};
|
|
101
|
-
const
|
|
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) {
|
|
101
|
+
const ItemPicker_ItemPicker = /*#__PURE__*/ forwardRef(function({ className, itemTypeName, allItems, selectedItems, maxSelections, onSelectedItemsChange, onSelectionChange, selected = NO_SELECTION, ...htmlAttributes }, forwardedRef) {
|
|
109
102
|
const targetWindow = useWindow();
|
|
110
103
|
useComponentCssInjection({
|
|
111
104
|
testId: "vuu-item-picker",
|
|
@@ -124,6 +117,13 @@ const ItemPicker_ItemPicker = /*#__PURE__*/ forwardRef(function({ AvailableListI
|
|
|
124
117
|
maxSelections
|
|
125
118
|
});
|
|
126
119
|
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,72 +133,19 @@ const ItemPicker_ItemPicker = /*#__PURE__*/ forwardRef(function({ AvailableListI
|
|
|
133
133
|
}
|
|
134
134
|
}, 300);
|
|
135
135
|
}, [
|
|
136
|
-
|
|
136
|
+
availableItemsFiltered,
|
|
137
|
+
selectedItemsFiltered
|
|
137
138
|
]);
|
|
138
139
|
const searchPlaceholderText = `Find ${singularForm(itemTypeName)}`;
|
|
139
140
|
const maxSelectionsSubHeading = maxSelections ? `(${maxSelections} max)` : "";
|
|
140
141
|
const selectedItemsHeading = `${selectedItemsCount} ${1 === selectedItemsCount ? singularForm(itemTypeName) : pluralForm(itemTypeName)} in view ${maxSelectionsSubHeading}`;
|
|
141
142
|
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
|
-
});
|
|
186
143
|
return /*#__PURE__*/ jsxs("div", {
|
|
187
144
|
...htmlAttributes,
|
|
188
145
|
className: clsx(classBase, className),
|
|
189
146
|
ref: forwardedRef,
|
|
190
147
|
children: [
|
|
191
|
-
|
|
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", {
|
|
148
|
+
/*#__PURE__*/ jsx("form", {
|
|
202
149
|
className: `${classBase}-search`,
|
|
203
150
|
role: "search",
|
|
204
151
|
children: /*#__PURE__*/ jsx(Input, {
|
|
@@ -209,19 +156,46 @@ const ItemPicker_ItemPicker = /*#__PURE__*/ forwardRef(function({ AvailableListI
|
|
|
209
156
|
onChange: onChangeSearchInput
|
|
210
157
|
})
|
|
211
158
|
}),
|
|
212
|
-
/*#__PURE__*/
|
|
159
|
+
/*#__PURE__*/ jsxs("div", {
|
|
213
160
|
className: `${classBase}-scrollContainer vuuScrollable`,
|
|
214
|
-
children:
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
161
|
+
children: [
|
|
162
|
+
/*#__PURE__*/ jsx("div", {
|
|
163
|
+
className: `${classBase}-sectionHeader`,
|
|
164
|
+
children: selectedItemsHeading
|
|
165
|
+
}),
|
|
166
|
+
/*#__PURE__*/ jsx(DragDropProvider, {
|
|
167
|
+
onDragEnd: handleDragEnd,
|
|
168
|
+
children: /*#__PURE__*/ jsx(ListBox, {
|
|
169
|
+
className: `${classBase}-selectedList`,
|
|
170
|
+
onSelectionChange: onSelectionChange,
|
|
171
|
+
ref: listRef,
|
|
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
|
+
]
|
|
225
199
|
})
|
|
226
200
|
]
|
|
227
201
|
});
|
|
@@ -15,15 +15,15 @@ const css = `
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
.vuuPriceTicker.up1, .vuuPriceTicker.up2 {
|
|
18
|
-
--vuu-icon-color: var(--
|
|
19
|
-
color: var(--
|
|
18
|
+
--vuu-icon-color: var(--salt-color-green-500);
|
|
19
|
+
color: var(--salt-color-green-500);
|
|
20
20
|
animation-duration: 30s;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
.vuuPriceTicker.down1, .vuuPriceTicker.down2 {
|
|
24
24
|
--vuu-icon-transform: rotate(180deg);
|
|
25
|
-
--vuu-icon-color: var(--
|
|
26
|
-
color: var(--
|
|
25
|
+
--vuu-icon-color: var(--salt-color-red-500);
|
|
26
|
+
color: var(--salt-color-red-500);
|
|
27
27
|
animation-duration: 30s;
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
const css = `
|
|
2
|
+
.vuuSplitPane {
|
|
3
|
+
--vuuSplitPane-align: stretch;
|
|
4
|
+
--vuuSplitPane-direction: row;
|
|
5
|
+
--vuuSplitPane-gap: 0;
|
|
6
|
+
--vuuSplitPane-justify: flex-start;
|
|
7
|
+
--vuuSplitPane-margin: 0;
|
|
8
|
+
--vuuSplitPane-padding: 0;
|
|
9
|
+
--vuuSplitPane-splitterSize: 3px;
|
|
10
|
+
--vuuSplitPane-splitter-background: var(--salt-separable-secondary-borderColor);
|
|
11
|
+
--vuuSplitPane-splitter-background-active: var(--salt-separable-primary-borderColor);
|
|
12
|
+
--vuuSplitPane-splitter-grabZone: 4px;
|
|
13
|
+
align-items: var(--vuuSplitPane-align);
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
flex-direction: var(--vuuSplitPane-direction);
|
|
16
|
+
gap: var(--vuuSplitPane-gap);
|
|
17
|
+
justify-content: var(--vuuSplitPane-justify);
|
|
18
|
+
margin: var(--vuuSplitPane-margin);
|
|
19
|
+
min-width: 0;
|
|
20
|
+
min-height: 0;
|
|
21
|
+
padding: var(--vuuSplitPane-padding);
|
|
22
|
+
flex-wrap: nowrap;
|
|
23
|
+
display: flex;
|
|
24
|
+
overflow: hidden;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
:where(.vuuSplitPane) > :where(:not(.vuuSplitPane-splitter)) {
|
|
28
|
+
box-sizing: border-box;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
:where(.vuuSplitPane-row) > :where(:not(.vuuSplitPane-splitter)) {
|
|
32
|
+
min-width: 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
:where(.vuuSplitPane-column) > :where(:not(.vuuSplitPane-splitter)) {
|
|
36
|
+
min-height: 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.vuuSplitPane-splitter {
|
|
40
|
+
background-color: var(--vuuSplitPane-splitter-background);
|
|
41
|
+
flex: 0 0 var(--vuuSplitPane-splitterSize);
|
|
42
|
+
touch-action: none;
|
|
43
|
+
z-index: 1;
|
|
44
|
+
outline: none;
|
|
45
|
+
position: relative;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.vuuSplitPane-splitter:before {
|
|
49
|
+
content: "";
|
|
50
|
+
position: absolute;
|
|
51
|
+
inset: 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.vuuSplitPane-row > .vuuSplitPane-splitter {
|
|
55
|
+
cursor: ew-resize;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.vuuSplitPane-row > .vuuSplitPane-splitter:before {
|
|
59
|
+
left: calc(-1 * var(--vuuSplitPane-splitter-grabZone));
|
|
60
|
+
right: calc(-1 * var(--vuuSplitPane-splitter-grabZone));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.vuuSplitPane-column > .vuuSplitPane-splitter {
|
|
64
|
+
cursor: ns-resize;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.vuuSplitPane-column > .vuuSplitPane-splitter:before {
|
|
68
|
+
bottom: calc(-1 * var(--vuuSplitPane-splitter-grabZone));
|
|
69
|
+
top: calc(-1 * var(--vuuSplitPane-splitter-grabZone));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.vuuSplitPane-splitter:hover, .vuuSplitPane-splitter-active {
|
|
73
|
+
--vuuSplitPane-splitter-background: var(--vuuSplitPane-splitter-background-active);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.vuuSplitPane-splitter:focus-visible {
|
|
77
|
+
outline: var(--salt-focused-outline);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
`;
|
|
82
|
+
export default css;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { resolveResponsiveValue, useBreakpoint, useForkRef } from "@salt-ds/core";
|
|
3
|
+
import { useComponentCssInjection } from "@salt-ds/styles";
|
|
4
|
+
import { useWindow } from "@salt-ds/window";
|
|
5
|
+
import clsx from "clsx";
|
|
6
|
+
import { Children, forwardRef } from "react";
|
|
7
|
+
import { Splitter } from "./Splitter.js";
|
|
8
|
+
import { useSplitPane } from "./useSplitPane.js";
|
|
9
|
+
import SplitPane_0 from "./SplitPane.css";
|
|
10
|
+
const classBase = "vuuSplitPane";
|
|
11
|
+
const parseSpacing = (value)=>"number" == typeof value ? `calc(var(--salt-spacing-100) * ${value})` : value;
|
|
12
|
+
const parseAlignment = (value)=>"start" === value || "end" === value ? `flex-${value}` : value;
|
|
13
|
+
const SplitPane_SplitPane = /*#__PURE__*/ forwardRef(function({ align, children, className, direction = "row", gap = 0, justify, margin = 0, onSplitterMoved, padding = 0, splitterSize, style, ...htmlAttributes }, forwardedRef) {
|
|
14
|
+
const targetWindow = useWindow();
|
|
15
|
+
useComponentCssInjection({
|
|
16
|
+
testId: "vuu-split-pane",
|
|
17
|
+
css: SplitPane_0,
|
|
18
|
+
window: targetWindow
|
|
19
|
+
});
|
|
20
|
+
const { matchedBreakpoints } = useBreakpoint();
|
|
21
|
+
const flexDirection = resolveResponsiveValue(direction, matchedBreakpoints) ?? "row";
|
|
22
|
+
const flexGap = resolveResponsiveValue(gap, matchedBreakpoints);
|
|
23
|
+
const flexMargin = resolveResponsiveValue(margin, matchedBreakpoints);
|
|
24
|
+
const flexPadding = resolveResponsiveValue(padding, matchedBreakpoints);
|
|
25
|
+
const panes = Children.toArray(children);
|
|
26
|
+
if (panes.length > 2) throw Error(`[SplitPane] supports a maximum of two children, ${panes.length} were provided`);
|
|
27
|
+
const { beginResize, endResize, resize, rootRef, splitterPosition } = useSplitPane({
|
|
28
|
+
direction: flexDirection,
|
|
29
|
+
onSplitterMoved,
|
|
30
|
+
paneCount: panes.length
|
|
31
|
+
});
|
|
32
|
+
const splitPaneStyle = {
|
|
33
|
+
...style,
|
|
34
|
+
"--vuuSplitPane-align": parseAlignment(align),
|
|
35
|
+
"--vuuSplitPane-direction": flexDirection,
|
|
36
|
+
"--vuuSplitPane-gap": parseSpacing(flexGap),
|
|
37
|
+
"--vuuSplitPane-justify": parseAlignment(justify),
|
|
38
|
+
"--vuuSplitPane-margin": parseSpacing(flexMargin),
|
|
39
|
+
"--vuuSplitPane-padding": parseSpacing(flexPadding),
|
|
40
|
+
"--vuuSplitPane-splitterSize": void 0 === splitterSize ? void 0 : `${splitterSize}px`
|
|
41
|
+
};
|
|
42
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
43
|
+
...htmlAttributes,
|
|
44
|
+
className: clsx(classBase, `${classBase}-${flexDirection}`, className),
|
|
45
|
+
ref: useForkRef(rootRef, forwardedRef),
|
|
46
|
+
style: splitPaneStyle,
|
|
47
|
+
children: [
|
|
48
|
+
panes[0],
|
|
49
|
+
2 === panes.length ? /*#__PURE__*/ jsx(Splitter, {
|
|
50
|
+
direction: flexDirection,
|
|
51
|
+
onResize: resize,
|
|
52
|
+
onResizeEnd: endResize,
|
|
53
|
+
onResizeStart: beginResize,
|
|
54
|
+
position: splitterPosition
|
|
55
|
+
}) : null,
|
|
56
|
+
panes[1]
|
|
57
|
+
]
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
export { SplitPane_SplitPane as SplitPane };
|