@vuu-ui/vuu-ui-controls 3.3.17 → 4.0.0-alpha.10
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/icon-button/Icon.js +1 -0
- package/src/icon-button/IconButton.js +1 -1
- package/src/index.js +1 -1
- package/src/instrument-picker/useTablePicker.js +3 -2
- package/src/item-picker/ItemPicker.js +79 -53
- package/src/tabstrip/Tabstrip.js +1 -1
- package/types/calendar/useCalendar.d.ts +3 -3
- package/types/calendar/useSelection.d.ts +1 -1
- package/types/context-panel-provider/ContextPanelProvider.d.ts +4 -7
- package/types/date-input/DateInput.d.ts +1 -1
- package/types/date-picker/DatePicker.d.ts +1 -1
- package/types/date-picker/DatePickerContext.d.ts +2 -2
- package/types/date-picker/DatePickerPanel.d.ts +1 -1
- 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 +1 -2
- 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 +5 -5
- package/types/item-picker/ItemPicker.d.ts +26 -5
- package/types/item-picker/useItemPicker.d.ts +4 -3
- 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 +131 -131
- package/types/table-search/SearchCell.d.ts +1 -1
- package/types/table-search/TableSearch.d.ts +1 -1
- package/types/tabs-next/hooks/useOverflow.d.ts +1 -1
- package/types/tabstrip/Tab.d.ts +1 -1
- package/types/tabstrip/TabMenu.d.ts +1 -1
- package/types/tabstrip/Tabstrip.d.ts +3 -2
- package/types/tabstrip/useTabstrip.d.ts +1 -1
- package/types/toolbar/Toolbar.d.ts +2 -1
- package/types/toolbar/useToolbar.d.ts +1 -1
- package/types/vuu-date-picker/VuuDatePicker.d.ts +1 -1
- package/types/vuu-time-picker/VuuTimePicker.d.ts +1 -1
- package/types/vuu-typeahead-input/VuuTypeaheadInput.d.ts +1 -1
- package/src/modal-provider/ModalProvider.js +0 -147
package/package.json
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "
|
|
2
|
+
"version": "4.0.0-alpha.10",
|
|
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",
|
|
7
8
|
"scripts": {
|
|
8
9
|
"build:dev": "node ../../scripts/run-build.mjs",
|
|
9
10
|
"build": "node ../../scripts/run-build-rslib.ts",
|
|
10
11
|
"type-defs": "node ../../scripts/build-type-defs.mjs"
|
|
11
12
|
},
|
|
12
13
|
"devDependencies": {
|
|
13
|
-
"@vuu-ui/vuu-data-types": "
|
|
14
|
-
"@vuu-ui/vuu-protocol-types": "
|
|
15
|
-
"@vuu-ui/vuu-table-types": "
|
|
14
|
+
"@vuu-ui/vuu-data-types": "4.0.0-alpha.10",
|
|
15
|
+
"@vuu-ui/vuu-protocol-types": "4.0.0-alpha.10",
|
|
16
|
+
"@vuu-ui/vuu-table-types": "4.0.0-alpha.10"
|
|
16
17
|
},
|
|
17
18
|
"dependencies": {
|
|
18
|
-
"@vuu-ui/vuu-context-menu": "
|
|
19
|
-
"@vuu-ui/vuu-data-react": "
|
|
20
|
-
"@vuu-ui/vuu-
|
|
21
|
-
"@vuu-ui/vuu-
|
|
22
|
-
"@vuu-ui/vuu-
|
|
23
|
-
"@
|
|
24
|
-
"@salt-ds/core": "1.54.1",
|
|
19
|
+
"@vuu-ui/vuu-context-menu": "4.0.0-alpha.10",
|
|
20
|
+
"@vuu-ui/vuu-data-react": "4.0.0-alpha.10",
|
|
21
|
+
"@vuu-ui/vuu-popups": "4.0.0-alpha.10",
|
|
22
|
+
"@vuu-ui/vuu-table": "4.0.0-alpha.10",
|
|
23
|
+
"@vuu-ui/vuu-utils": "4.0.0-alpha.10",
|
|
24
|
+
"@salt-ds/core": "1.67.0",
|
|
25
25
|
"@salt-ds/icons": "1.16.0",
|
|
26
26
|
"@salt-ds/styles": "0.2.1",
|
|
27
27
|
"@salt-ds/window": "0.1.1",
|
|
@@ -29,13 +29,12 @@
|
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@internationalized/date": "^3.0.0",
|
|
32
|
-
"@floating-ui/react": "^0.
|
|
32
|
+
"@floating-ui/react": "^0.27.19",
|
|
33
33
|
"clsx": "^2.0.0",
|
|
34
34
|
"react": "^19.2.3",
|
|
35
35
|
"react-dom": "^19.2.3"
|
|
36
36
|
},
|
|
37
37
|
"sideEffects": false,
|
|
38
|
-
"type": "module",
|
|
39
38
|
"files": [
|
|
40
39
|
"README.md",
|
|
41
40
|
"src",
|
|
@@ -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, {
|
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
|
@@ -25,7 +25,7 @@ export * from "./vuu-typeahead-input/index.js";
|
|
|
25
25
|
export { ContextPanelProvider, useContextPanel, useHideContextPanel } from "./context-panel-provider/ContextPanelProvider.js";
|
|
26
26
|
export { HoverOverlay } from "./hover-overlay/HoverOverlay.js";
|
|
27
27
|
export { ItemPicker } from "./item-picker/ItemPicker.js";
|
|
28
|
-
export {
|
|
28
|
+
export { SelectedItemsChangeHandler as SelectedItemChangeHandler } from "./item-picker/useItemPicker.js";
|
|
29
29
|
export { Prompt } from "./prompt/Prompt.js";
|
|
30
30
|
export { SortableList, SortableOption } from "./sortable-list/SortableList.js";
|
|
31
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/tabstrip/Tabstrip.js
CHANGED
|
@@ -16,16 +16,16 @@ interface BaseUseCalendarProps {
|
|
|
16
16
|
export type useCalendarProps = (Omit<UseSingleSelectionCalendarProps, "isDaySelectable"> | Omit<UseMultiSelectionCalendarProps, "isDaySelectable"> | Omit<UseRangeSelectionCalendarProps, "isDaySelectable"> | Omit<UseOffsetSelectionCalendarProps, "isDaySelectable">) & BaseUseCalendarProps;
|
|
17
17
|
export declare function useCalendar(props: useCalendarProps): {
|
|
18
18
|
state: {
|
|
19
|
-
selectedDate: DateValue |
|
|
19
|
+
selectedDate: DateValue[] | {
|
|
20
20
|
startDate?: DateValue;
|
|
21
21
|
endDate?: DateValue;
|
|
22
|
-
} | DateValue
|
|
22
|
+
} | import("./useSelection").RangeSelectionValueType | DateValue | null | undefined;
|
|
23
23
|
hoveredDate: import("@internationalized/date").CalendarDate | import("@internationalized/date").CalendarDateTime | import("@internationalized/date").ZonedDateTime | null | undefined;
|
|
24
24
|
visibleMonth: DateValue;
|
|
25
25
|
focusedDate: DateValue;
|
|
26
26
|
minDate: DateValue | undefined;
|
|
27
27
|
maxDate: DateValue | undefined;
|
|
28
|
-
selectionVariant: "
|
|
28
|
+
selectionVariant: "default" | "multiselect" | "offset" | "range";
|
|
29
29
|
hideOutOfRangeDates: boolean | undefined;
|
|
30
30
|
calendarFocused: boolean;
|
|
31
31
|
};
|
|
@@ -38,7 +38,7 @@ export declare function isRangeOrOffsetSelectionValue(selectionValue?: AllSelect
|
|
|
38
38
|
export declare function isRangeOrOffsetSelectionWithStartDate(selectionValue?: AllSelectionValueType): selectionValue is RangeSelectionValueType | OffsetSelectionValueType;
|
|
39
39
|
export declare function useSelectionCalendar(props: useSelectionCalendarProps): {
|
|
40
40
|
state: {
|
|
41
|
-
selectedDate:
|
|
41
|
+
selectedDate: MultiSelectionValueType | OffsetSelectionValueType | RangeSelectionValueType | DateValue | null | undefined;
|
|
42
42
|
hoveredDate: CalendarDate | import("@internationalized/date").CalendarDateTime | import("@internationalized/date").ZonedDateTime | null | undefined;
|
|
43
43
|
};
|
|
44
44
|
helpers: {
|
|
@@ -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;
|
|
15
|
-
|
|
11
|
+
resolveComponent?: ResolveContextPanelComponent;
|
|
12
|
+
}) => import("react").JSX.Element;
|
|
16
13
|
export declare function useContextPanel(): ShowContextPanel;
|
|
17
14
|
export declare function useHideContextPanel(): (() => void) | undefined;
|
|
@@ -57,4 +57,4 @@ export interface DateInputProps<SelectionVariantType> extends Omit<ComponentProp
|
|
|
57
57
|
*/
|
|
58
58
|
onChange?: SelectionVariantType extends SingleSelectionValueType ? (event: ChangeEvent<HTMLInputElement>, selectedDateInputValue?: string) => void : (event: ChangeEvent<HTMLInputElement>, startDateInputValue?: string, endDateInputValue?: string) => void;
|
|
59
59
|
}
|
|
60
|
-
export declare const DateInput: import("react").ForwardRefExoticComponent<DateInputProps<
|
|
60
|
+
export declare const DateInput: import("react").ForwardRefExoticComponent<DateInputProps<RangeSelectionValueType | DateValue> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -63,4 +63,4 @@ export interface DatePickerProps<SelectionVariantType> extends DateInputProps<Se
|
|
|
63
63
|
*/
|
|
64
64
|
visibleMonths?: 1 | 2;
|
|
65
65
|
}
|
|
66
|
-
export declare const DatePicker: import("react").ForwardRefExoticComponent<DatePickerProps<
|
|
66
|
+
export declare const DatePicker: import("react").ForwardRefExoticComponent<DatePickerProps<RangeSelectionValueType | DateValue> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -15,5 +15,5 @@ export interface DatePickerContextValue<SelectionVariantType> extends Partial<Pi
|
|
|
15
15
|
selectionVariant: "default" | "range";
|
|
16
16
|
getPanelPosition: () => Record<string, unknown>;
|
|
17
17
|
}
|
|
18
|
-
export declare const DatePickerContext: import("react").Context<DatePickerContextValue<
|
|
19
|
-
export declare function useDatePickerContext(): DatePickerContextValue<
|
|
18
|
+
export declare const DatePickerContext: import("react").Context<DatePickerContextValue<RangeSelectionValueType | DateValue>>;
|
|
19
|
+
export declare function useDatePickerContext(): DatePickerContextValue<RangeSelectionValueType | DateValue>;
|
|
@@ -7,4 +7,4 @@ export interface DatePickerPanelProps<SelectionVariantType> extends ComponentPro
|
|
|
7
7
|
visibleMonths?: 1 | 2;
|
|
8
8
|
CalendarProps?: Partial<Omit<CalendarProps, "selectionVariant" | "selectedDate" | "defaultSelectedDate" | "onSelectedDateChange">>;
|
|
9
9
|
}
|
|
10
|
-
export declare const DatePickerPanel: import("react").ForwardRefExoticComponent<DatePickerPanelProps<
|
|
10
|
+
export declare const DatePickerPanel: import("react").ForwardRefExoticComponent<DatePickerPanelProps<RangeSelectionValueType | DateValue> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -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) => import("react
|
|
30
|
+
export declare const DragDropProvider: ({ children, dragSources: dragSourcesProp, }: DragDropProviderProps) => import("react").JSX.Element;
|
|
31
31
|
export interface DragDropProviderResult {
|
|
32
32
|
isDragSource?: boolean;
|
|
33
33
|
isDropTarget?: boolean;
|
|
@@ -5,4 +5,4 @@ export interface HoverOverlayProps extends Pick<OverlayProps, "placement" | "onO
|
|
|
5
5
|
open?: boolean;
|
|
6
6
|
trigger: ReactNode;
|
|
7
7
|
}
|
|
8
|
-
export declare const HoverOverlay: ({ children, open: openProp, onOpenChange, placement, trigger, }: HoverOverlayProps) => import("react
|
|
8
|
+
export declare const HoverOverlay: ({ children, open: openProp, onOpenChange, placement, trigger, }: HoverOverlayProps) => import("react").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { HTMLAttributes } from "react";
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
2
|
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) => import("react
|
|
6
|
+
export declare const Icon: ({ className, name, size, style: styleProp, ...htmlAttributes }: IconProps) => import("react").JSX.Element;
|
|
@@ -2,4 +2,4 @@ import { IconButtonProps } from "./IconButton";
|
|
|
2
2
|
export interface ToggleIconButtonProps extends Omit<IconButtonProps, "icon"> {
|
|
3
3
|
isExpanded: boolean;
|
|
4
4
|
}
|
|
5
|
-
export declare const ToggleIconButton: ({ className, isExpanded, size, ...props }: ToggleIconButtonProps) => import("react
|
|
5
|
+
export declare const ToggleIconButton: ({ className, isExpanded, size, ...props }: ToggleIconButtonProps) => import("react").JSX.Element;
|
package/types/index.d.ts
CHANGED
|
@@ -13,9 +13,8 @@ export { HoverOverlay } from "./hover-overlay/HoverOverlay";
|
|
|
13
13
|
export * from "./icon-button";
|
|
14
14
|
export * from "./instrument-picker";
|
|
15
15
|
export { ItemPicker, type ItemPickerProps } from "./item-picker/ItemPicker";
|
|
16
|
-
export { type ItemDescriptor } from "./item-picker/useItemPicker";
|
|
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,2 +1,2 @@
|
|
|
1
1
|
import { TableCellRendererProps } from "@vuu-ui/vuu-table-types";
|
|
2
|
-
export declare const SearchCell: ({ column, dataRow }: TableCellRendererProps) => import("react
|
|
2
|
+
export declare const SearchCell: ({ column, dataRow }: TableCellRendererProps) => import("react").JSX.Element;
|
|
@@ -8,4 +8,4 @@ export interface TablePickerProps extends Omit<HTMLAttributes<HTMLElement>, "onS
|
|
|
8
8
|
schema: TableSchema;
|
|
9
9
|
searchColumns?: string[];
|
|
10
10
|
}
|
|
11
|
-
export declare const TablePicker: ({ TableProps, onSelect, rowToString, schema, searchColumns, ...htmlAttributes }: TablePickerProps) => import("react
|
|
11
|
+
export declare const TablePicker: ({ TableProps, onSelect, rowToString, schema, searchColumns, ...htmlAttributes }: TablePickerProps) => import("react").JSX.Element;
|
|
@@ -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;
|
|
@@ -10,13 +10,9 @@ export declare const useTablePicker: ({ TableProps, onSelect, rowToString, schem
|
|
|
10
10
|
dataSource: import("@vuu-ui/vuu-data-types").DataSource;
|
|
11
11
|
highlightedIndex: number | undefined;
|
|
12
12
|
floatingUIProps: {
|
|
13
|
-
reference: ((node: import("@floating-ui/react-dom").ReferenceType | null) => void) & ((node: import("@floating-ui/react").ReferenceType | null) => void);
|
|
14
|
-
floating: ((node: HTMLElement | null) => void) & ((node: HTMLElement | null) => void);
|
|
15
13
|
placement: import("@floating-ui/utils").Placement;
|
|
16
14
|
strategy: import("@floating-ui/utils").Strategy;
|
|
17
15
|
middlewareData: import("@floating-ui/core").MiddlewareData;
|
|
18
|
-
x: number;
|
|
19
|
-
y: number;
|
|
20
16
|
isPositioned: boolean;
|
|
21
17
|
update: () => void;
|
|
22
18
|
floatingStyles: React.CSSProperties;
|
|
@@ -26,6 +22,10 @@ export declare const useTablePicker: ({ TableProps, onSelect, rowToString, schem
|
|
|
26
22
|
setReference: (node: import("@floating-ui/react-dom").ReferenceType | null) => void;
|
|
27
23
|
setFloating: (node: HTMLElement | null) => void;
|
|
28
24
|
} & import("@floating-ui/react").ExtendedRefs<import("@floating-ui/react").ReferenceType>;
|
|
25
|
+
reference: ((node: import("@floating-ui/react-dom").ReferenceType | null) => void) & ((node: import("@floating-ui/react").ReferenceType | null) => void);
|
|
26
|
+
floating: ((node: HTMLElement | null) => void) & ((node: HTMLElement | null) => void);
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
29
|
};
|
|
30
30
|
inputProps: {
|
|
31
31
|
inputProps: {
|
|
@@ -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 {};
|