@vuu-ui/vuu-ui-controls 4.0.0-alpha.3 → 4.0.0-alpha.31
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 +17 -15
- package/src/drag-drop/Draggable.css.js +2 -2
- package/src/drag-drop/useDragDrop.js +7 -1
- package/src/expando-input/ExpandoInput.css.js +1 -1
- package/src/hover-overlay/HoverOverlay.css.js +8 -0
- package/src/hover-overlay/HoverOverlay.js +87 -38
- package/src/icon-button/ToggleIconButton.css.js +1 -1
- package/src/index.js +1 -2
- package/src/instrument-picker/TablePicker.css.js +1 -0
- package/src/item-picker/ItemPicker.css.js +1 -1
- package/src/item-picker/useItemPicker.js +5 -1
- package/src/price-ticker/PriceTicker.css.js +4 -4
- package/src/prompt/Prompt.css.js +1 -0
- 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/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/Tab.css.js +3 -3
- package/src/tabstrip/Tabstrip.css.js +2 -2
- 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 +1 -1
- package/types/drag-drop/DragDropProvider.d.ts +1 -1
- package/types/hover-overlay/HoverOverlay.d.ts +7 -1
- package/types/icon-button/Icon.d.ts +1 -1
- package/types/icon-button/ToggleIconButton.d.ts +1 -1
- package/types/index.d.ts +5 -5
- package/types/instrument-picker/SearchCell.d.ts +1 -1
- package/types/instrument-picker/TablePicker.d.ts +1 -1
- package/types/item-picker/useItemPicker.d.ts +2 -2
- package/types/modal-provider/ModalProvider.d.ts +1 -1
- package/types/price-ticker/PriceTicker.d.ts +1 -1
- package/types/prompt/Prompt.d.ts +3 -3
- 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 +2 -1
- package/types/table-search/useTableSearch.d.ts +2 -2
- package/types/tabstrip/TabMenu.d.ts +1 -1
- package/types/tabstrip/Tabstrip.d.ts +1 -2
- 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/src/modal-provider/ModalProvider.js +0 -147
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { useCallback, useLayoutEffect, useRef, useState } from "react";
|
|
2
|
+
const parsePx = (value, defaultValue)=>value.endsWith("px") ? parseFloat(value) : defaultValue;
|
|
3
|
+
const measurePane = (el, dimension)=>{
|
|
4
|
+
const { [dimension]: size } = el.getBoundingClientRect();
|
|
5
|
+
const style = getComputedStyle(el);
|
|
6
|
+
return {
|
|
7
|
+
size,
|
|
8
|
+
minSize: parsePx(style.getPropertyValue(`min-${dimension}`), 0),
|
|
9
|
+
maxSize: parsePx(style.getPropertyValue(`max-${dimension}`), 1 / 0)
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
const getPanes = (root)=>{
|
|
13
|
+
const pane1 = root?.children[0];
|
|
14
|
+
const pane2 = root?.children[2];
|
|
15
|
+
if (pane1 && pane2) return [
|
|
16
|
+
pane1,
|
|
17
|
+
pane2
|
|
18
|
+
];
|
|
19
|
+
};
|
|
20
|
+
const toPercentage = ([size1, size2])=>{
|
|
21
|
+
const total = size1 + size2;
|
|
22
|
+
return 0 === total ? 0 : Math.round(size1 / total * 100);
|
|
23
|
+
};
|
|
24
|
+
const useSplitPane = ({ direction, onSplitterMoved, paneCount })=>{
|
|
25
|
+
const rootRef = useRef(null);
|
|
26
|
+
const resizeStateRef = useRef(void 0);
|
|
27
|
+
const [splitterPosition, setSplitterPosition] = useState(void 0);
|
|
28
|
+
const dimension = "column" === direction ? "height" : "width";
|
|
29
|
+
const hasSplitter = 2 === paneCount;
|
|
30
|
+
useLayoutEffect(()=>{
|
|
31
|
+
const panes = hasSplitter ? getPanes(rootRef.current) : void 0;
|
|
32
|
+
if (panes) {
|
|
33
|
+
const [pane1, pane2] = panes;
|
|
34
|
+
setSplitterPosition(toPercentage([
|
|
35
|
+
pane1.getBoundingClientRect()[dimension],
|
|
36
|
+
pane2.getBoundingClientRect()[dimension]
|
|
37
|
+
]));
|
|
38
|
+
}
|
|
39
|
+
}, [
|
|
40
|
+
dimension,
|
|
41
|
+
hasSplitter
|
|
42
|
+
]);
|
|
43
|
+
const beginResize = useCallback(()=>{
|
|
44
|
+
const panes = getPanes(rootRef.current);
|
|
45
|
+
if (panes) {
|
|
46
|
+
const [pane1, pane2] = panes;
|
|
47
|
+
const measurements = [
|
|
48
|
+
measurePane(pane1, dimension),
|
|
49
|
+
measurePane(pane2, dimension)
|
|
50
|
+
];
|
|
51
|
+
resizeStateRef.current = {
|
|
52
|
+
panes,
|
|
53
|
+
measurements,
|
|
54
|
+
sizes: [
|
|
55
|
+
measurements[0].size,
|
|
56
|
+
measurements[1].size
|
|
57
|
+
]
|
|
58
|
+
};
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
return false;
|
|
62
|
+
}, [
|
|
63
|
+
dimension
|
|
64
|
+
]);
|
|
65
|
+
const resize = useCallback((distance)=>{
|
|
66
|
+
const resizeState = resizeStateRef.current;
|
|
67
|
+
if (resizeState) {
|
|
68
|
+
const { panes: [pane1, pane2], measurements: [m1, m2] } = resizeState;
|
|
69
|
+
const total = m1.size + m2.size;
|
|
70
|
+
const lowerBound = Math.max(m1.minSize, total - m2.maxSize);
|
|
71
|
+
const upperBound = Math.min(m1.maxSize, total - m2.minSize);
|
|
72
|
+
const size1 = Math.max(lowerBound, Math.min(upperBound, m1.size + distance));
|
|
73
|
+
const size2 = total - size1;
|
|
74
|
+
pane1.style.flexBasis = `${size1}px`;
|
|
75
|
+
pane2.style.flexBasis = `${size2}px`;
|
|
76
|
+
resizeState.sizes = [
|
|
77
|
+
size1,
|
|
78
|
+
size2
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
}, []);
|
|
82
|
+
const endResize = useCallback(()=>{
|
|
83
|
+
const resizeState = resizeStateRef.current;
|
|
84
|
+
if (resizeState) {
|
|
85
|
+
resizeStateRef.current = void 0;
|
|
86
|
+
const { measurements, sizes } = resizeState;
|
|
87
|
+
setSplitterPosition(toPercentage(sizes));
|
|
88
|
+
if (sizes[0] !== measurements[0].size || sizes[1] !== measurements[1].size) onSplitterMoved?.(sizes);
|
|
89
|
+
}
|
|
90
|
+
}, [
|
|
91
|
+
onSplitterMoved
|
|
92
|
+
]);
|
|
93
|
+
return {
|
|
94
|
+
beginResize,
|
|
95
|
+
endResize,
|
|
96
|
+
resize,
|
|
97
|
+
rootRef,
|
|
98
|
+
splitterPosition
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
export { useSplitPane };
|
|
@@ -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/Tab.css.js
CHANGED
|
@@ -101,7 +101,7 @@ const css = `
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
.vuuTab.vuuFocusVisible {
|
|
104
|
-
background: var(--vuuTab-hover-background, var(--salt-navigable-
|
|
104
|
+
background: var(--vuuTab-hover-background, var(--salt-navigable-background-hover));
|
|
105
105
|
outline-color: var(--vuuTab-focusVisible-color, var(--salt-focused-outlineColor));
|
|
106
106
|
outline-offset: -1px;
|
|
107
107
|
outline-width: 1px;
|
|
@@ -121,7 +121,7 @@ const css = `
|
|
|
121
121
|
|
|
122
122
|
.vuuTabstrip-draggingTab .vuuTab-selected:before {
|
|
123
123
|
--tab-before-content: "";
|
|
124
|
-
--tab-before-background: var(--salt-navigable-indicator-
|
|
124
|
+
--tab-before-background: var(--salt-navigable-accent-indicator-active);
|
|
125
125
|
--tab-before-height: var(--tab-thumb-height);
|
|
126
126
|
--tab-before-inset: var(--tab-activationIndicator-inset);
|
|
127
127
|
--tab-before-width: var(--tab-activationIndicator-thumb-width);
|
|
@@ -140,7 +140,7 @@ const css = `
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
.vuuTab:hover:not(.vuuTab-closeHover, .vuuTab-selected) {
|
|
143
|
-
background: var(--vuuTab-hover-background, var(--salt-navigable-
|
|
143
|
+
background: var(--vuuTab-hover-background, var(--salt-navigable-background-hover));
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
|
|
@@ -52,7 +52,7 @@ const css = `
|
|
|
52
52
|
|
|
53
53
|
.vuuTabstrip-overflowMenu-open {
|
|
54
54
|
--saltButton-background: var(--salt-actionable-subtle-background-active);
|
|
55
|
-
--saltButton-text-color: var(--salt-actionable-subtle-
|
|
55
|
+
--saltButton-text-color: var(--salt-actionable-subtle-foreground-active);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
.vuuTabstrip-overflowMenu-open .saltButton {
|
|
@@ -82,7 +82,7 @@ const css = `
|
|
|
82
82
|
--tabstrip-display: flex;
|
|
83
83
|
--tabstrip-height: 100%;
|
|
84
84
|
--tabstrip-dragging-display: block;
|
|
85
|
-
--tabs-tab-background: var(--salt-navigable-
|
|
85
|
+
--tabs-tab-background: var(--salt-navigable-background-hover);
|
|
86
86
|
--tabs-tab-before-content: "";
|
|
87
87
|
--tabs-tab-before-background: var(--salt-navigable-indicator-hover);
|
|
88
88
|
--tabs-tab-before-height: var(--tab-activationIndicator-thumb-height);
|