@vuu-ui/vuu-ui-controls 0.8.24-debug → 0.8.25-debug
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/index.js +1291 -914
- package/cjs/index.js.map +4 -4
- package/esm/index.js +1016 -645
- package/esm/index.js.map +4 -4
- package/index.css +165 -69
- package/index.css.map +3 -3
- package/package.json +7 -7
- package/types/date-input/DateInput.d.ts +12 -0
- package/types/date-input/DateRangeInput.d.ts +11 -0
- package/types/date-input/index.d.ts +2 -0
- package/types/date-input/types.d.ts +16 -0
- package/types/date-input/useBaseDatePickerDropdown.d.ts +15 -0
- package/types/date-input/useDatePicker.d.ts +7 -0
- package/types/date-popup/DatePopup.d.ts +12 -0
- package/types/date-popup/index.d.ts +1 -0
- package/types/date-popup/useDatePopup.d.ts +20 -0
- package/types/dropdown/dropdownTypes.d.ts +1 -0
- package/types/dropdown/useClickAway.d.ts +1 -0
- package/types/index.d.ts +3 -0
- package/types/instrument-picker/InstrumentPicker.d.ts +4 -5
- package/types/instrument-picker/useInstrumentPicker.d.ts +2 -3
- package/types/overflow-container/OverflowContainer.d.ts +0 -1
- package/types/overflow-container/overflow-utils.d.ts +5 -5
- package/types/overflow-container/useOverflowContainer.d.ts +1 -1
- package/types/split-button/SplitButton.d.ts +3 -4
- package/types/split-button/SplitStateButton.d.ts +7 -0
- package/types/split-button/index.d.ts +1 -0
- package/types/split-button/useSplitButton.d.ts +2 -3
- package/types/tabstrip/TabsTypes.d.ts +5 -0
- package/types/tabstrip/Tabstrip.d.ts +1 -1
package/cjs/index.js
CHANGED
|
@@ -43,7 +43,10 @@ __export(src_exports, {
|
|
|
43
43
|
CollectionProvider: () => CollectionProvider,
|
|
44
44
|
ComboBox: () => ComboBox,
|
|
45
45
|
CycleStateButton: () => CycleStateButton,
|
|
46
|
+
DateInput: () => DateInput,
|
|
46
47
|
DatePicker: () => DatePicker,
|
|
48
|
+
DatePopup: () => DatePopup,
|
|
49
|
+
DateRangeInput: () => DateRangeInput,
|
|
47
50
|
DateRangePicker: () => DateRangePicker,
|
|
48
51
|
DragDropProvider: () => DragDropProvider,
|
|
49
52
|
DragDropState: () => DragDropState,
|
|
@@ -84,6 +87,7 @@ __export(src_exports, {
|
|
|
84
87
|
RadioIcon: () => RadioIcon,
|
|
85
88
|
Space: () => Space,
|
|
86
89
|
SplitButton: () => SplitButton,
|
|
90
|
+
SplitStateButton: () => SplitStateButton,
|
|
87
91
|
Tab: () => Tab,
|
|
88
92
|
Tabstrip: () => Tabstrip,
|
|
89
93
|
Toolbar: () => Toolbar,
|
|
@@ -185,19 +189,18 @@ __export(src_exports, {
|
|
|
185
189
|
module.exports = __toCommonJS(src_exports);
|
|
186
190
|
|
|
187
191
|
// src/calendar/Calendar.tsx
|
|
188
|
-
var
|
|
189
|
-
var
|
|
190
|
-
var
|
|
192
|
+
var import_react50 = require("react");
|
|
193
|
+
var import_clsx17 = require("clsx");
|
|
194
|
+
var import_core21 = require("@salt-ds/core");
|
|
191
195
|
|
|
192
196
|
// src/calendar/internal/CalendarNavigation.tsx
|
|
193
|
-
var
|
|
194
|
-
var
|
|
195
|
-
var
|
|
196
|
-
var import_react42 = require("react");
|
|
197
|
+
var import_core14 = require("@salt-ds/core");
|
|
198
|
+
var import_clsx12 = require("clsx");
|
|
199
|
+
var import_react43 = require("react");
|
|
197
200
|
|
|
198
201
|
// src/dropdown/DropdownBase.tsx
|
|
199
202
|
var import_vuu_popups = require("@vuu-ui/vuu-popups");
|
|
200
|
-
var
|
|
203
|
+
var import_vuu_utils2 = require("@vuu-ui/vuu-utils");
|
|
201
204
|
var import_core2 = require("@salt-ds/core");
|
|
202
205
|
var import_clsx = __toESM(require("clsx"));
|
|
203
206
|
var import_react9 = require("react");
|
|
@@ -970,8 +973,24 @@ var useStateRef = (initialValue) => {
|
|
|
970
973
|
};
|
|
971
974
|
|
|
972
975
|
// src/dropdown/useClickAway.ts
|
|
976
|
+
var import_vuu_utils = require("@vuu-ui/vuu-utils");
|
|
973
977
|
var import_react7 = require("react");
|
|
974
978
|
var NO_HANDLERS = [];
|
|
979
|
+
var targetWithinSubPopup = (source, target) => {
|
|
980
|
+
if (source === null) {
|
|
981
|
+
return false;
|
|
982
|
+
}
|
|
983
|
+
const sourcePortal = (0, import_vuu_utils.queryClosest)(source, ".vuuPortal");
|
|
984
|
+
const targetPortal = (0, import_vuu_utils.queryClosest)(target, ".vuuPortal");
|
|
985
|
+
if (sourcePortal && targetPortal) {
|
|
986
|
+
const targetWithId = targetPortal.querySelector("[id]");
|
|
987
|
+
const targetOwner = sourcePortal.querySelector(
|
|
988
|
+
`[aria-owns="${targetWithId == null ? void 0 : targetWithId.id}"]`
|
|
989
|
+
);
|
|
990
|
+
return targetOwner !== null;
|
|
991
|
+
}
|
|
992
|
+
return false;
|
|
993
|
+
};
|
|
975
994
|
var useClickAway = ({
|
|
976
995
|
popperRef,
|
|
977
996
|
rootRef,
|
|
@@ -986,9 +1005,12 @@ var useClickAway = ({
|
|
|
986
1005
|
const [clickHandler, escapeKeyHandler] = isOpen ? [
|
|
987
1006
|
(evt) => {
|
|
988
1007
|
var _a2, _b;
|
|
1008
|
+
console.log("click away");
|
|
989
1009
|
const targetElement = evt.target;
|
|
990
1010
|
if (!((_a2 = popperRef.current) == null ? void 0 : _a2.contains(targetElement)) && !((_b = rootRef.current) == null ? void 0 : _b.contains(targetElement))) {
|
|
991
|
-
|
|
1011
|
+
if (!targetWithinSubPopup(popperRef.current, targetElement)) {
|
|
1012
|
+
onClose("click-away");
|
|
1013
|
+
}
|
|
992
1014
|
}
|
|
993
1015
|
},
|
|
994
1016
|
(e) => {
|
|
@@ -1178,7 +1200,7 @@ var DropdownBase = (0, import_react9.forwardRef)(
|
|
|
1178
1200
|
const [trigger, popupComponent] = import_react9.Children.toArray(
|
|
1179
1201
|
children
|
|
1180
1202
|
);
|
|
1181
|
-
const id = (0,
|
|
1203
|
+
const id = (0, import_vuu_utils2.useId)(idProp);
|
|
1182
1204
|
const { componentProps, isOpen, popupComponentRef, triggerProps } = useDropdownBase({
|
|
1183
1205
|
ariaLabelledBy: ariaLabelledByProp,
|
|
1184
1206
|
defaultIsOpen,
|
|
@@ -1310,7 +1332,7 @@ var DropdownButton = (0, import_react10.forwardRef)(function DropdownButton2({
|
|
|
1310
1332
|
// src/dropdown/Dropdown.tsx
|
|
1311
1333
|
var import_core12 = require("@salt-ds/core");
|
|
1312
1334
|
var import_react40 = require("react");
|
|
1313
|
-
var
|
|
1335
|
+
var import_vuu_utils14 = require("@vuu-ui/vuu-utils");
|
|
1314
1336
|
|
|
1315
1337
|
// src/list/common-hooks/keyUtils.ts
|
|
1316
1338
|
function union(set1, ...sets) {
|
|
@@ -1522,7 +1544,7 @@ var useImperativeScrollingAPI = ({
|
|
|
1522
1544
|
// src/list/common-hooks/useKeyboardNavigation.ts
|
|
1523
1545
|
var import_core4 = require("@salt-ds/core");
|
|
1524
1546
|
var import_react13 = require("react");
|
|
1525
|
-
var
|
|
1547
|
+
var import_vuu_utils3 = require("@vuu-ui/vuu-utils");
|
|
1526
1548
|
var LIST_FOCUS_VISIBLE = -2;
|
|
1527
1549
|
function nextItemIdx(count, key, idx) {
|
|
1528
1550
|
if (key === ArrowUp || key === End) {
|
|
@@ -1548,7 +1570,7 @@ var getIndexOfSelectedItem = (selected) => {
|
|
|
1548
1570
|
const el = document.getElementById(selectedItemId);
|
|
1549
1571
|
if (el) {
|
|
1550
1572
|
const index = parseInt((_a2 = el.dataset.index) != null ? _a2 : "-1");
|
|
1551
|
-
if ((0,
|
|
1573
|
+
if ((0, import_vuu_utils3.isValidNumber)(index)) {
|
|
1552
1574
|
return index;
|
|
1553
1575
|
}
|
|
1554
1576
|
}
|
|
@@ -1582,7 +1604,7 @@ var pageDown = (containerEl, itemEl, itemCount, index) => {
|
|
|
1582
1604
|
let nextRect;
|
|
1583
1605
|
do {
|
|
1584
1606
|
nextIdx += 1;
|
|
1585
|
-
nextRect = (0,
|
|
1607
|
+
nextRect = (0, import_vuu_utils3.getElementByDataIndex)(
|
|
1586
1608
|
containerEl,
|
|
1587
1609
|
nextIdx,
|
|
1588
1610
|
true
|
|
@@ -1603,7 +1625,7 @@ var pageUp = (containerEl, itemEl, index) => {
|
|
|
1603
1625
|
let nextRect;
|
|
1604
1626
|
do {
|
|
1605
1627
|
nextIdx -= 1;
|
|
1606
|
-
nextRect = (0,
|
|
1628
|
+
nextRect = (0, import_vuu_utils3.getElementByDataIndex)(
|
|
1607
1629
|
containerEl,
|
|
1608
1630
|
nextIdx,
|
|
1609
1631
|
true
|
|
@@ -1614,7 +1636,7 @@ var pageUp = (containerEl, itemEl, index) => {
|
|
|
1614
1636
|
};
|
|
1615
1637
|
var isLeaf = (element) => element !== void 0;
|
|
1616
1638
|
var isFocusable2 = (container, index) => {
|
|
1617
|
-
const targetEl = (0,
|
|
1639
|
+
const targetEl = (0, import_vuu_utils3.getElementByDataIndex)(container, index);
|
|
1618
1640
|
return isLeaf(targetEl);
|
|
1619
1641
|
};
|
|
1620
1642
|
var useKeyboardNavigation = ({
|
|
@@ -1649,7 +1671,7 @@ var useKeyboardNavigation = ({
|
|
|
1649
1671
|
);
|
|
1650
1672
|
const nextPageItemIdx = (0, import_react13.useCallback)(
|
|
1651
1673
|
(key, index) => {
|
|
1652
|
-
const itemEl = (0,
|
|
1674
|
+
const itemEl = (0, import_vuu_utils3.getElementByDataIndex)(containerRef.current, index, true);
|
|
1653
1675
|
let result;
|
|
1654
1676
|
if (itemEl) {
|
|
1655
1677
|
const { current: containerEl } = containerRef;
|
|
@@ -1801,7 +1823,7 @@ var useKeyboardNavigation = ({
|
|
|
1801
1823
|
};
|
|
1802
1824
|
|
|
1803
1825
|
// src/common-hooks/useSelection.ts
|
|
1804
|
-
var
|
|
1826
|
+
var import_vuu_utils4 = require("@vuu-ui/vuu-utils");
|
|
1805
1827
|
var import_react14 = require("react");
|
|
1806
1828
|
var CHECKBOX = "checkbox";
|
|
1807
1829
|
var GROUP_SELECTION_NONE = "none";
|
|
@@ -1859,7 +1881,7 @@ var useSelection = ({
|
|
|
1859
1881
|
(idx, preserveExistingSelection) => {
|
|
1860
1882
|
const currentSelection = preserveExistingSelection ? selected : [];
|
|
1861
1883
|
const [lastSelectedItemId] = selected.slice(-1);
|
|
1862
|
-
const lastSelectedItemIndex = lastSelectedItemId ? (0,
|
|
1884
|
+
const lastSelectedItemIndex = lastSelectedItemId ? (0, import_vuu_utils4.getElementDataIndex)(document.getElementById(lastSelectedItemId)) : 0;
|
|
1863
1885
|
const startRegion = Math.min(idx, lastSelectedItemIndex);
|
|
1864
1886
|
const endRegion = Math.max(idx, lastSelectedItemIndex);
|
|
1865
1887
|
const container = containerRef.current;
|
|
@@ -1876,7 +1898,7 @@ var useSelection = ({
|
|
|
1876
1898
|
const selectItemAtIndex = (0, import_react14.useCallback)(
|
|
1877
1899
|
(evt, idx, rangeSelect, preserveExistingSelection) => {
|
|
1878
1900
|
const { current: container } = containerRef;
|
|
1879
|
-
const { id } = (0,
|
|
1901
|
+
const { id } = (0, import_vuu_utils4.getElementByDataIndex)(container, idx, true);
|
|
1880
1902
|
let newSelected;
|
|
1881
1903
|
if (isMultipleSelect) {
|
|
1882
1904
|
newSelected = selectMultiple(id);
|
|
@@ -1920,8 +1942,8 @@ var useSelection = ({
|
|
|
1920
1942
|
const handleKeyDown = (0, import_react14.useCallback)(
|
|
1921
1943
|
(evt) => {
|
|
1922
1944
|
const { current: container } = containerRef;
|
|
1923
|
-
const element = (0,
|
|
1924
|
-
if ((0,
|
|
1945
|
+
const element = (0, import_vuu_utils4.getElementByDataIndex)(container, highlightedIndex);
|
|
1946
|
+
if ((0, import_vuu_utils4.isSelectableElement)(element)) {
|
|
1925
1947
|
if (isSelectionEvent(evt) || tabToSelect && evt.key === "Tab") {
|
|
1926
1948
|
if (evt.key !== "Tab") {
|
|
1927
1949
|
evt.preventDefault();
|
|
@@ -1951,8 +1973,8 @@ var useSelection = ({
|
|
|
1951
1973
|
(evt, currentIndex) => {
|
|
1952
1974
|
if (isExtendedSelect && evt.shiftKey) {
|
|
1953
1975
|
const { current: container } = containerRef;
|
|
1954
|
-
const element = (0,
|
|
1955
|
-
if ((0,
|
|
1976
|
+
const element = (0, import_vuu_utils4.getElementByDataIndex)(container, currentIndex);
|
|
1977
|
+
if ((0, import_vuu_utils4.isSelectableElement)(element)) {
|
|
1956
1978
|
selectItemAtIndex(evt, currentIndex, true);
|
|
1957
1979
|
}
|
|
1958
1980
|
}
|
|
@@ -1962,8 +1984,8 @@ var useSelection = ({
|
|
|
1962
1984
|
const handleClick = (0, import_react14.useCallback)(
|
|
1963
1985
|
(evt) => {
|
|
1964
1986
|
const { current: container } = containerRef;
|
|
1965
|
-
const element = (0,
|
|
1966
|
-
if (!disableSelection && (0,
|
|
1987
|
+
const element = (0, import_vuu_utils4.getElementByDataIndex)(container, highlightedIndex);
|
|
1988
|
+
if (!disableSelection && (0, import_vuu_utils4.isSelectableElement)(element)) {
|
|
1967
1989
|
evt.preventDefault();
|
|
1968
1990
|
evt.stopPropagation();
|
|
1969
1991
|
selectItemAtIndex(
|
|
@@ -2244,7 +2266,7 @@ var CheckboxIcon = ({
|
|
|
2244
2266
|
// src/list/ListItem.tsx
|
|
2245
2267
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
2246
2268
|
var classBase4 = "vuuListItem";
|
|
2247
|
-
var ListItemProxy = (0, import_react17.forwardRef)(function
|
|
2269
|
+
var ListItemProxy = (0, import_react17.forwardRef)(function ListItemProxy2({
|
|
2248
2270
|
height,
|
|
2249
2271
|
...htmlAttributes
|
|
2250
2272
|
}, forwardedRef) {
|
|
@@ -2308,13 +2330,13 @@ var ListItem = (0, import_react17.forwardRef)(
|
|
|
2308
2330
|
);
|
|
2309
2331
|
|
|
2310
2332
|
// src/list/List.tsx
|
|
2311
|
-
var
|
|
2333
|
+
var import_vuu_utils13 = require("@vuu-ui/vuu-utils");
|
|
2312
2334
|
var import_core10 = require("@salt-ds/core");
|
|
2313
2335
|
var import_clsx8 = __toESM(require("clsx"));
|
|
2314
2336
|
var import_react37 = require("react");
|
|
2315
2337
|
|
|
2316
2338
|
// src/list/useList.ts
|
|
2317
|
-
var
|
|
2339
|
+
var import_vuu_utils11 = require("@vuu-ui/vuu-utils");
|
|
2318
2340
|
var import_react31 = require("react");
|
|
2319
2341
|
|
|
2320
2342
|
// src/drag-drop/dragDropTypes.ts
|
|
@@ -2325,7 +2347,7 @@ var BWD = "bwd";
|
|
|
2325
2347
|
var import_react19 = require("react");
|
|
2326
2348
|
|
|
2327
2349
|
// src/drag-drop/useGlobalDragDrop.ts
|
|
2328
|
-
var
|
|
2350
|
+
var import_vuu_utils5 = require("@vuu-ui/vuu-utils");
|
|
2329
2351
|
var import_react18 = require("react");
|
|
2330
2352
|
var useGlobalDragDrop = ({
|
|
2331
2353
|
onDragOverDropTarget,
|
|
@@ -2339,7 +2361,7 @@ var useGlobalDragDrop = ({
|
|
|
2339
2361
|
const { current: dropTargets } = measuredDropTargetsRef;
|
|
2340
2362
|
if (dropTargets) {
|
|
2341
2363
|
for (const [id, measuredTarget] of Object.entries(dropTargets)) {
|
|
2342
|
-
if ((0,
|
|
2364
|
+
if ((0, import_vuu_utils5.boxContainsPoint)(measuredTarget, x, y)) {
|
|
2343
2365
|
return id;
|
|
2344
2366
|
}
|
|
2345
2367
|
}
|
|
@@ -2390,7 +2412,7 @@ var useGlobalDragDrop = ({
|
|
|
2390
2412
|
onDrop(dropTargetRef.current, dragDropState);
|
|
2391
2413
|
}
|
|
2392
2414
|
if (dragDropState.draggableElement) {
|
|
2393
|
-
(0,
|
|
2415
|
+
(0, import_vuu_utils5.dispatchCustomEvent)(dragDropState.draggableElement, "vuu-dropped");
|
|
2394
2416
|
}
|
|
2395
2417
|
}
|
|
2396
2418
|
}, [dragMouseMoveHandler, onDrop]);
|
|
@@ -2575,21 +2597,21 @@ var DragDropState = class {
|
|
|
2575
2597
|
};
|
|
2576
2598
|
|
|
2577
2599
|
// src/drag-drop/useDragDrop.tsx
|
|
2578
|
-
var
|
|
2600
|
+
var import_vuu_utils10 = require("@vuu-ui/vuu-utils");
|
|
2579
2601
|
var import_react29 = require("react");
|
|
2580
2602
|
|
|
2581
2603
|
// src/overflow-container/OverflowContainer.tsx
|
|
2582
2604
|
var import_vuu_popups2 = require("@vuu-ui/vuu-popups");
|
|
2583
|
-
var
|
|
2605
|
+
var import_vuu_utils8 = require("@vuu-ui/vuu-utils");
|
|
2584
2606
|
var import_clsx5 = __toESM(require("clsx"));
|
|
2585
2607
|
var import_react21 = __toESM(require("react"));
|
|
2586
2608
|
|
|
2587
2609
|
// src/overflow-container/useOverflowContainer.ts
|
|
2588
|
-
var
|
|
2610
|
+
var import_vuu_utils7 = require("@vuu-ui/vuu-utils");
|
|
2589
2611
|
var import_react20 = require("react");
|
|
2590
2612
|
|
|
2591
2613
|
// src/overflow-container/overflow-utils.ts
|
|
2592
|
-
var
|
|
2614
|
+
var import_vuu_utils6 = require("@vuu-ui/vuu-utils");
|
|
2593
2615
|
var NON_WRAPPED_ITEM = ".vuuOverflowContainer-item:not(.wrapped)";
|
|
2594
2616
|
var isOverflowElement = (element) => element !== null && element.dataset.index === "overflow" && element.parentElement !== null && element.parentElement.classList.contains(
|
|
2595
2617
|
"vuuOverflowContainer-wrapContainer-overflowed"
|
|
@@ -2618,7 +2640,7 @@ var sortByScreenOrder = (elements) => elements.sort((e1, e2) => {
|
|
|
2618
2640
|
return parseInt(idx1) > parseInt(idx2) ? 1 : -1;
|
|
2619
2641
|
});
|
|
2620
2642
|
var NO_WRAPPED_ITEMS = [];
|
|
2621
|
-
var getNonWrappedAndWrappedItems = (container, orientation
|
|
2643
|
+
var getNonWrappedAndWrappedItems = (container, orientation) => {
|
|
2622
2644
|
const nonWrappedItems = [];
|
|
2623
2645
|
const wrappedItems = [];
|
|
2624
2646
|
let currentPosition = -1;
|
|
@@ -2649,9 +2671,9 @@ var getNonWrappedAndWrappedItems = (container, orientation = "horizontal") => {
|
|
|
2649
2671
|
}
|
|
2650
2672
|
return [nonWrappedItems, wrappedItems];
|
|
2651
2673
|
};
|
|
2652
|
-
var applyOverflowClassToWrappedItems = (container, overflowedItems,
|
|
2674
|
+
var applyOverflowClassToWrappedItems = (container, overflowedItems, classBase30) => {
|
|
2653
2675
|
let ignoreOverflow = false;
|
|
2654
|
-
const className =
|
|
2676
|
+
const className = classBase30 ? `${classBase30}-overflowed` : "overflow";
|
|
2655
2677
|
if (overflowedItems.find(({ index }) => index === "overflow")) {
|
|
2656
2678
|
if (overflowedItems.length === 1) {
|
|
2657
2679
|
ignoreOverflow = true;
|
|
@@ -2702,22 +2724,23 @@ var highPriorityItemsHaveWrappedButShouldNotHave = (nonWrappedItems, wrappedItem
|
|
|
2702
2724
|
return wrappedItems.length > 1 && ((_a2 = wrappedItems.at(-1)) == null ? void 0 : _a2.index) === "overflow";
|
|
2703
2725
|
}
|
|
2704
2726
|
};
|
|
2705
|
-
var correctForWrappedOverflowIndicator = (container, overflowedItems) => new Promise((resolve) => {
|
|
2727
|
+
var correctForWrappedOverflowIndicator = (container, overflowedItems, orientation) => new Promise((resolve) => {
|
|
2706
2728
|
requestAnimationFrame(() => {
|
|
2707
|
-
const [, o2] = getNonWrappedAndWrappedItems(container);
|
|
2729
|
+
const [, o2] = getNonWrappedAndWrappedItems(container, orientation);
|
|
2708
2730
|
const newlyOverflowed = getNewItems(overflowedItems, o2);
|
|
2709
2731
|
newlyOverflowed.forEach((item) => markElementAsWrapped(container, item));
|
|
2710
2732
|
resolve(o2);
|
|
2711
2733
|
});
|
|
2712
2734
|
});
|
|
2713
|
-
var correctForWrappedHighPriorityItems = (container, nonWrapped, wrapped) => new Promise((resolve) => {
|
|
2735
|
+
var correctForWrappedHighPriorityItems = (container, nonWrapped, wrapped, orientation) => new Promise((resolve) => {
|
|
2714
2736
|
requestAnimationFrame(() => {
|
|
2715
|
-
const [, o2] = getNonWrappedAndWrappedItems(container);
|
|
2737
|
+
const [, o2] = getNonWrappedAndWrappedItems(container, orientation);
|
|
2716
2738
|
const highPriorityWrappedItem = getHighestPriorityItem(o2);
|
|
2717
2739
|
if (highPriorityWrappedItem) {
|
|
2718
2740
|
const [nonWrappedItems, wrappedItems] = switchWrappedItemIntoView(
|
|
2719
2741
|
container,
|
|
2720
|
-
highPriorityWrappedItem
|
|
2742
|
+
highPriorityWrappedItem,
|
|
2743
|
+
orientation
|
|
2721
2744
|
);
|
|
2722
2745
|
resolve([nonWrappedItems, wrappedItems]);
|
|
2723
2746
|
} else {
|
|
@@ -2726,7 +2749,7 @@ var correctForWrappedHighPriorityItems = (container, nonWrapped, wrapped) => new
|
|
|
2726
2749
|
});
|
|
2727
2750
|
});
|
|
2728
2751
|
var markElementAsWrapped = (container, item) => {
|
|
2729
|
-
const el = (0,
|
|
2752
|
+
const el = (0, import_vuu_utils6.getElementByDataIndex)(container, item.index);
|
|
2730
2753
|
if (el) {
|
|
2731
2754
|
el.classList.add("wrapped");
|
|
2732
2755
|
} else {
|
|
@@ -2758,23 +2781,41 @@ var unmarkItemsWhichAreNoLongerWrapped = (container, wrappedItems) => {
|
|
|
2758
2781
|
};
|
|
2759
2782
|
var getOverflowIndicator = (container) => container.querySelector('[data-index="overflow"]');
|
|
2760
2783
|
var getOverflowedItem = (container) => container.querySelector(".wrapped");
|
|
2761
|
-
var
|
|
2762
|
-
|
|
2763
|
-
const
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2784
|
+
var getElementSize = (el, sizeProperty) => {
|
|
2785
|
+
const size = parseInt(getComputedStyle(el).getPropertyValue(sizeProperty));
|
|
2786
|
+
const margin = sizeProperty === "width" ? parseInt(getComputedStyle(el).getPropertyValue("margin-left")) + parseInt(getComputedStyle(el).getPropertyValue("margin-right")) : parseInt(getComputedStyle(el).getPropertyValue("margin-top")) + parseInt(getComputedStyle(el).getPropertyValue("margin-bottom"));
|
|
2787
|
+
return size + margin;
|
|
2788
|
+
};
|
|
2789
|
+
var getAvailableSpace = (container, overflowIndicator, orientation) => {
|
|
2790
|
+
if (orientation === "horizontal") {
|
|
2791
|
+
const { right: containerRight } = container.getBoundingClientRect();
|
|
2792
|
+
const paddingRight = parseInt(
|
|
2793
|
+
getComputedStyle(container).getPropertyValue("padding-right")
|
|
2794
|
+
);
|
|
2795
|
+
const { right: indicatorRight } = overflowIndicator.getBoundingClientRect();
|
|
2796
|
+
return containerRight - paddingRight - indicatorRight;
|
|
2797
|
+
} else {
|
|
2798
|
+
const { bottom: containerBottom } = container.getBoundingClientRect();
|
|
2799
|
+
const paddingBottom = parseInt(
|
|
2800
|
+
getComputedStyle(container).getPropertyValue("padding-bottom")
|
|
2801
|
+
);
|
|
2802
|
+
const { bottom: indicatorBottom } = overflowIndicator.getBoundingClientRect();
|
|
2803
|
+
return containerBottom - paddingBottom - indicatorBottom;
|
|
2804
|
+
}
|
|
2769
2805
|
};
|
|
2770
|
-
var removeOverflowIndicatorIfNoLongerNeeded = (container) => {
|
|
2806
|
+
var removeOverflowIndicatorIfNoLongerNeeded = (container, orientation) => {
|
|
2807
|
+
const sizeProperty = orientation === "horizontal" ? "width" : "height";
|
|
2771
2808
|
const overflowIndicator = getOverflowIndicator(container);
|
|
2772
|
-
const availableSpace = getAvailableSpace(
|
|
2773
|
-
|
|
2809
|
+
const availableSpace = getAvailableSpace(
|
|
2810
|
+
container,
|
|
2811
|
+
overflowIndicator,
|
|
2812
|
+
orientation
|
|
2813
|
+
);
|
|
2814
|
+
const indicatorWidth = getElementSize(overflowIndicator, sizeProperty);
|
|
2774
2815
|
const overflowedItem = getOverflowedItem(container);
|
|
2775
|
-
const overflowWidth =
|
|
2816
|
+
const overflowWidth = getElementSize(overflowedItem, sizeProperty);
|
|
2776
2817
|
if (overflowWidth <= availableSpace + indicatorWidth) {
|
|
2777
|
-
container.classList.remove("overflowed");
|
|
2818
|
+
container.classList.remove("vuuOverflowContainer-wrapContainer-overflowed");
|
|
2778
2819
|
overflowedItem.classList.remove("wrapped");
|
|
2779
2820
|
return true;
|
|
2780
2821
|
}
|
|
@@ -2798,19 +2839,20 @@ var byPriorityDescending = (h1, h2) => {
|
|
|
2798
2839
|
var getNonwrappedItemsByPriority = (container) => Array.from(container.querySelectorAll(NON_WRAPPED_ITEM)).sort(
|
|
2799
2840
|
byPriorityDescending
|
|
2800
2841
|
);
|
|
2801
|
-
var switchWrappedItemIntoView = (container, overflowItem) => {
|
|
2842
|
+
var switchWrappedItemIntoView = (container, overflowItem, orientation) => {
|
|
2802
2843
|
const unwrappedItems = getNonwrappedItemsByPriority(container);
|
|
2803
|
-
const targetElement = (0,
|
|
2844
|
+
const targetElement = (0, import_vuu_utils6.getElementByDataIndex)(
|
|
2804
2845
|
container,
|
|
2805
2846
|
overflowItem.index,
|
|
2806
2847
|
true
|
|
2807
2848
|
);
|
|
2808
2849
|
let pos = -1;
|
|
2809
2850
|
let unwrappedItem = unwrappedItems.at(pos);
|
|
2810
|
-
const
|
|
2811
|
-
const
|
|
2851
|
+
const sizeProperty = orientation === "horizontal" ? "width" : "height";
|
|
2852
|
+
const itemWidth = getElementSize(unwrappedItem, sizeProperty);
|
|
2853
|
+
const targetWidth = getElementSize(targetElement, sizeProperty);
|
|
2812
2854
|
const overflowIndicator = getOverflowIndicator(container);
|
|
2813
|
-
let availableSpace = getAvailableSpace(container, overflowIndicator) + itemWidth;
|
|
2855
|
+
let availableSpace = getAvailableSpace(container, overflowIndicator, orientation) + itemWidth;
|
|
2814
2856
|
if (availableSpace >= targetWidth) {
|
|
2815
2857
|
switchWrapOnElements(targetElement, unwrappedItem);
|
|
2816
2858
|
} else {
|
|
@@ -2830,7 +2872,10 @@ var switchWrappedItemIntoView = (container, overflowItem) => {
|
|
|
2830
2872
|
item.classList.add("wrapped");
|
|
2831
2873
|
});
|
|
2832
2874
|
}
|
|
2833
|
-
const [nonWrappedItems, wrappedItems] = getNonWrappedAndWrappedItems(
|
|
2875
|
+
const [nonWrappedItems, wrappedItems] = getNonWrappedAndWrappedItems(
|
|
2876
|
+
container,
|
|
2877
|
+
orientation
|
|
2878
|
+
);
|
|
2834
2879
|
unmarkItemsWhichAreNoLongerWrapped(container, wrappedItems);
|
|
2835
2880
|
return [nonWrappedItems, wrappedItems];
|
|
2836
2881
|
};
|
|
@@ -2848,7 +2893,7 @@ var useOverflowContainer = ({
|
|
|
2848
2893
|
itemCount,
|
|
2849
2894
|
onMoveItem,
|
|
2850
2895
|
onSwitchWrappedItemIntoView,
|
|
2851
|
-
orientation
|
|
2896
|
+
orientation
|
|
2852
2897
|
}) => {
|
|
2853
2898
|
const [container, setContainer] = (0, import_react20.useState)(null);
|
|
2854
2899
|
const wrappedItemsRef = (0, import_react20.useRef)(NO_WRAPPED_ITEMS);
|
|
@@ -2871,17 +2916,22 @@ var useOverflowContainer = ({
|
|
|
2871
2916
|
"vuuOverflowContainer-wrapContainer"
|
|
2872
2917
|
);
|
|
2873
2918
|
if (overflowIndicatorHasWrappedButShouldNotHave(wrapped)) {
|
|
2874
|
-
wrapped = await correctForWrappedOverflowIndicator(
|
|
2919
|
+
wrapped = await correctForWrappedOverflowIndicator(
|
|
2920
|
+
container,
|
|
2921
|
+
wrapped,
|
|
2922
|
+
orientation
|
|
2923
|
+
);
|
|
2875
2924
|
}
|
|
2876
2925
|
while (highPriorityItemsHaveWrappedButShouldNotHave(nonWrapped, wrapped)) {
|
|
2877
2926
|
[nonWrapped, wrapped] = await correctForWrappedHighPriorityItems(
|
|
2878
2927
|
container,
|
|
2879
2928
|
nonWrapped,
|
|
2880
|
-
wrapped
|
|
2929
|
+
wrapped,
|
|
2930
|
+
orientation
|
|
2881
2931
|
);
|
|
2882
2932
|
}
|
|
2883
2933
|
if (wrapped.length === 1) {
|
|
2884
|
-
if (removeOverflowIndicatorIfNoLongerNeeded(container)) {
|
|
2934
|
+
if (removeOverflowIndicatorIfNoLongerNeeded(container, orientation)) {
|
|
2885
2935
|
wrapped = NO_WRAPPED_ITEMS;
|
|
2886
2936
|
}
|
|
2887
2937
|
}
|
|
@@ -2912,7 +2962,8 @@ var useOverflowContainer = ({
|
|
|
2912
2962
|
if (container && hasOverflowItem(options)) {
|
|
2913
2963
|
const [, wrappedItems] = switchWrappedItemIntoView(
|
|
2914
2964
|
container,
|
|
2915
|
-
options.overflowItem
|
|
2965
|
+
options.overflowItem,
|
|
2966
|
+
orientation
|
|
2916
2967
|
);
|
|
2917
2968
|
wrappedItemsRef.current = wrappedItems;
|
|
2918
2969
|
onSwitchWrappedItemIntoView == null ? void 0 : onSwitchWrappedItemIntoView(options.overflowItem);
|
|
@@ -2920,22 +2971,22 @@ var useOverflowContainer = ({
|
|
|
2920
2971
|
return true;
|
|
2921
2972
|
}
|
|
2922
2973
|
];
|
|
2923
|
-
}, [container, onSwitchWrappedItemIntoView]);
|
|
2974
|
+
}, [container, onSwitchWrappedItemIntoView, orientation]);
|
|
2924
2975
|
const resizeObserver3 = (0, import_react20.useMemo)(() => {
|
|
2925
|
-
const { sizeProp } =
|
|
2976
|
+
const { sizeProp } = import_vuu_utils7.MEASURES[orientation];
|
|
2926
2977
|
let currentSize = 0;
|
|
2927
2978
|
return new ResizeObserver((entries) => {
|
|
2928
2979
|
for (const entry of entries) {
|
|
2929
2980
|
const { [sizeProp]: actualSize } = entry.contentRect;
|
|
2930
2981
|
const size = Math.round(actualSize);
|
|
2931
|
-
if ((0,
|
|
2982
|
+
if ((0, import_vuu_utils7.isValidNumber)(size) && currentSize !== size) {
|
|
2932
2983
|
currentSize = size;
|
|
2933
2984
|
handleResize();
|
|
2934
2985
|
}
|
|
2935
2986
|
}
|
|
2936
2987
|
});
|
|
2937
2988
|
}, [handleResize, orientation]);
|
|
2938
|
-
(0,
|
|
2989
|
+
(0, import_vuu_utils7.useLayoutEffectSkipFirst)(() => {
|
|
2939
2990
|
handleResize();
|
|
2940
2991
|
}, [handleResize, itemCount]);
|
|
2941
2992
|
(0, import_react20.useMemo)(() => {
|
|
@@ -2979,15 +3030,13 @@ var WrapContainer = import_react21.default.memo(
|
|
|
2979
3030
|
PopupMenuProps: PopupMenuProps3,
|
|
2980
3031
|
allowDragDrop,
|
|
2981
3032
|
children,
|
|
2982
|
-
className: classNameProp,
|
|
2983
|
-
height: heightProp,
|
|
2984
3033
|
id,
|
|
2985
3034
|
onMoveItem,
|
|
2986
3035
|
onSwitchWrappedItemIntoView,
|
|
2987
|
-
orientation
|
|
3036
|
+
orientation,
|
|
2988
3037
|
overflowIcon
|
|
2989
3038
|
}) => {
|
|
2990
|
-
const childElements = (0,
|
|
3039
|
+
const childElements = (0, import_vuu_utils8.asReactElements)(children);
|
|
2991
3040
|
const {
|
|
2992
3041
|
draggable,
|
|
2993
3042
|
draggedItemIndex,
|
|
@@ -3002,14 +3051,6 @@ var WrapContainer = import_react21.default.memo(
|
|
|
3002
3051
|
onSwitchWrappedItemIntoView,
|
|
3003
3052
|
orientation
|
|
3004
3053
|
});
|
|
3005
|
-
const height = orientation === "vertical" ? "100%" : `${heightProp}px`;
|
|
3006
|
-
const style = {
|
|
3007
|
-
"--overflow-container-height": `${height}`
|
|
3008
|
-
};
|
|
3009
|
-
const className = (0, import_clsx5.default)(`${classBase5}-wrapContainer`, classNameProp, {
|
|
3010
|
-
[`${classBase5}-horizontal`]: orientation === "horizontal",
|
|
3011
|
-
[`${classBase5}-vertical`]: orientation === "vertical"
|
|
3012
|
-
});
|
|
3013
3054
|
const content = childElements.map((childEl, i) => {
|
|
3014
3055
|
const {
|
|
3015
3056
|
"data-align": align,
|
|
@@ -3043,6 +3084,7 @@ var WrapContainer = import_react21.default.memo(
|
|
|
3043
3084
|
import_vuu_popups2.PopupMenu,
|
|
3044
3085
|
{
|
|
3045
3086
|
...PopupMenuProps3,
|
|
3087
|
+
"data-embedded": true,
|
|
3046
3088
|
icon: overflowIcon,
|
|
3047
3089
|
menuBuilder,
|
|
3048
3090
|
menuActionHandler,
|
|
@@ -3053,7 +3095,7 @@ var WrapContainer = import_react21.default.memo(
|
|
|
3053
3095
|
"overflow"
|
|
3054
3096
|
);
|
|
3055
3097
|
content.push(overflowIndicator);
|
|
3056
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className, ref: rootRef,
|
|
3098
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: (0, import_clsx5.default)(`${classBase5}-wrapContainer`), ref: rootRef, children: [
|
|
3057
3099
|
content,
|
|
3058
3100
|
draggable
|
|
3059
3101
|
] });
|
|
@@ -3065,21 +3107,25 @@ var OverflowContainer = (0, import_react21.forwardRef)(function OverflowContaine
|
|
|
3065
3107
|
allowDragDrop = false,
|
|
3066
3108
|
children,
|
|
3067
3109
|
className,
|
|
3068
|
-
height = 44,
|
|
3069
3110
|
id: idProp,
|
|
3070
3111
|
onMoveItem,
|
|
3071
3112
|
onSwitchWrappedItemIntoView,
|
|
3072
|
-
orientation,
|
|
3113
|
+
orientation = "horizontal",
|
|
3073
3114
|
overflowIcon,
|
|
3074
3115
|
overflowPosition,
|
|
3075
3116
|
...htmlAttributes
|
|
3076
3117
|
}, forwardedRef) {
|
|
3077
|
-
const id = (0,
|
|
3118
|
+
const id = (0, import_vuu_utils8.useId)(idProp);
|
|
3078
3119
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3079
3120
|
"div",
|
|
3080
3121
|
{
|
|
3081
3122
|
...htmlAttributes,
|
|
3082
|
-
className: (0, import_clsx5.default)(
|
|
3123
|
+
className: (0, import_clsx5.default)(
|
|
3124
|
+
(0, import_clsx5.default)(className, classBase5, {
|
|
3125
|
+
"vuuOrientation-horizontal": orientation === "horizontal",
|
|
3126
|
+
"vuuOrientation-vertical": orientation === "vertical"
|
|
3127
|
+
})
|
|
3128
|
+
),
|
|
3083
3129
|
id,
|
|
3084
3130
|
ref: forwardedRef,
|
|
3085
3131
|
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
@@ -3087,7 +3133,6 @@ var OverflowContainer = (0, import_react21.forwardRef)(function OverflowContaine
|
|
|
3087
3133
|
{
|
|
3088
3134
|
PopupMenuProps: PopupMenuProps3,
|
|
3089
3135
|
allowDragDrop,
|
|
3090
|
-
height,
|
|
3091
3136
|
id,
|
|
3092
3137
|
orientation,
|
|
3093
3138
|
overflowIcon,
|
|
@@ -3932,7 +3977,7 @@ var useDragDisplacers = (orientation = "horizontal") => {
|
|
|
3932
3977
|
};
|
|
3933
3978
|
|
|
3934
3979
|
// src/drag-drop/useDragDropNaturalMovement.tsx
|
|
3935
|
-
var
|
|
3980
|
+
var import_vuu_utils9 = require("@vuu-ui/vuu-utils");
|
|
3936
3981
|
var useDragDropNaturalMovement = ({
|
|
3937
3982
|
containerRef,
|
|
3938
3983
|
orientation = "horizontal",
|
|
@@ -4099,7 +4144,7 @@ var useDragDropNaturalMovement = ({
|
|
|
4099
4144
|
".vuuPopupMenu"
|
|
4100
4145
|
);
|
|
4101
4146
|
if (button) {
|
|
4102
|
-
(0,
|
|
4147
|
+
(0, import_vuu_utils9.dispatchMouseEvent)(button, "click");
|
|
4103
4148
|
}
|
|
4104
4149
|
}
|
|
4105
4150
|
};
|
|
@@ -4110,7 +4155,7 @@ var useDragDropNaturalMovement = ({
|
|
|
4110
4155
|
".vuuPopupMenu"
|
|
4111
4156
|
);
|
|
4112
4157
|
if (button) {
|
|
4113
|
-
(0,
|
|
4158
|
+
(0, import_vuu_utils9.dispatchMouseEvent)(button, "click");
|
|
4114
4159
|
}
|
|
4115
4160
|
}
|
|
4116
4161
|
};
|
|
@@ -4314,7 +4359,7 @@ var useDragDrop = ({
|
|
|
4314
4359
|
draggable: void 0
|
|
4315
4360
|
}));
|
|
4316
4361
|
if (settlingItem2) {
|
|
4317
|
-
(0,
|
|
4362
|
+
(0, import_vuu_utils10.dispatchCustomEvent)(settlingItem2, "vuu-dropped");
|
|
4318
4363
|
}
|
|
4319
4364
|
}, [containerRef, itemQuery, onDropSettle]);
|
|
4320
4365
|
const getScrollDirection = (0, import_react29.useCallback)(
|
|
@@ -4894,7 +4939,7 @@ var useList = ({
|
|
|
4894
4939
|
setSelected: selectionHook.setSelected
|
|
4895
4940
|
});
|
|
4896
4941
|
const { setSelected } = selectionHook;
|
|
4897
|
-
(0,
|
|
4942
|
+
(0, import_vuu_utils11.useLayoutEffectSkipFirst)(() => {
|
|
4898
4943
|
if (hasSelection(lastSelection.current)) {
|
|
4899
4944
|
setSelected([]);
|
|
4900
4945
|
}
|
|
@@ -5167,7 +5212,7 @@ var useScrollPosition = ({
|
|
|
5167
5212
|
var import_react36 = require("react");
|
|
5168
5213
|
|
|
5169
5214
|
// src/measured-container/useMeasuredContainer.ts
|
|
5170
|
-
var
|
|
5215
|
+
var import_vuu_utils12 = require("@vuu-ui/vuu-utils");
|
|
5171
5216
|
var import_react35 = require("react");
|
|
5172
5217
|
|
|
5173
5218
|
// src/measured-container/useResizeObserver.ts
|
|
@@ -5304,7 +5349,7 @@ var NO_MEASUREMENT = [];
|
|
|
5304
5349
|
var isNumber = (val) => Number.isFinite(val);
|
|
5305
5350
|
var FULL_SIZE = { height: "100%", width: "auto" };
|
|
5306
5351
|
var getInitialCssSize = (height, width) => {
|
|
5307
|
-
if ((0,
|
|
5352
|
+
if ((0, import_vuu_utils12.isValidNumber)(height) && (0, import_vuu_utils12.isValidNumber)(width)) {
|
|
5308
5353
|
return {
|
|
5309
5354
|
height: `${height}px`,
|
|
5310
5355
|
width: `${width}px`
|
|
@@ -5319,7 +5364,7 @@ var getInitialCssSize = (height, width) => {
|
|
|
5319
5364
|
}
|
|
5320
5365
|
};
|
|
5321
5366
|
var getInitialInnerSize = (height, width) => {
|
|
5322
|
-
if ((0,
|
|
5367
|
+
if ((0, import_vuu_utils12.isValidNumber)(height) && (0, import_vuu_utils12.isValidNumber)(width)) {
|
|
5323
5368
|
return {
|
|
5324
5369
|
height,
|
|
5325
5370
|
width
|
|
@@ -5348,12 +5393,12 @@ var useMeasuredContainer = ({
|
|
|
5348
5393
|
(0, import_react35.useMemo)(() => {
|
|
5349
5394
|
setSize((currentSize) => {
|
|
5350
5395
|
const { inner, outer } = currentSize;
|
|
5351
|
-
if ((0,
|
|
5396
|
+
if ((0, import_vuu_utils12.isValidNumber)(height) && (0, import_vuu_utils12.isValidNumber)(width) && inner && outer) {
|
|
5352
5397
|
const { height: innerHeight, width: innerWidth } = inner;
|
|
5353
5398
|
const { height: outerHeight, width: outerWidth } = outer;
|
|
5354
5399
|
if (outerHeight !== height || outerWidth !== width) {
|
|
5355
|
-
const heightDiff = (0,
|
|
5356
|
-
const widthDiff = (0,
|
|
5400
|
+
const heightDiff = (0, import_vuu_utils12.isValidNumber)(outerHeight) ? outerHeight - innerHeight : 0;
|
|
5401
|
+
const widthDiff = (0, import_vuu_utils12.isValidNumber)(outerWidth) ? outerWidth - innerWidth : 0;
|
|
5357
5402
|
return {
|
|
5358
5403
|
...currentSize,
|
|
5359
5404
|
outer: { height, width },
|
|
@@ -5527,7 +5572,7 @@ var List = (0, import_react37.forwardRef)(function List2({
|
|
|
5527
5572
|
...htmlAttributes
|
|
5528
5573
|
}, forwardedRef) {
|
|
5529
5574
|
var _a2, _b;
|
|
5530
|
-
const id = (0,
|
|
5575
|
+
const id = (0, import_vuu_utils13.useId)(idProp);
|
|
5531
5576
|
const contentContainerRef = (0, import_react37.useRef)(null);
|
|
5532
5577
|
const [size, setSize] = (0, import_react37.useState)();
|
|
5533
5578
|
const handleResize = (0, import_react37.useCallback)((size2) => {
|
|
@@ -5743,7 +5788,14 @@ var List = (0, import_react37.forwardRef)(function List2({
|
|
|
5743
5788
|
style: { ...styleProp, ...sizeStyles },
|
|
5744
5789
|
tabIndex: listDisabled || disableFocus ? void 0 : tabIndex,
|
|
5745
5790
|
children: [
|
|
5746
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
5791
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
5792
|
+
ListItemProxy,
|
|
5793
|
+
{
|
|
5794
|
+
ref: rowHeightProxyRef,
|
|
5795
|
+
height: itemHeightProp
|
|
5796
|
+
},
|
|
5797
|
+
"canary"
|
|
5798
|
+
),
|
|
5747
5799
|
collectionHook.data.length === 0 && ListPlaceholder !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ListPlaceholder, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: `${classBase6}-viewport`, onScroll: onVerticalScroll, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
5748
5800
|
"div",
|
|
5749
5801
|
{
|
|
@@ -5893,7 +5945,7 @@ var Dropdown2 = (0, import_react40.forwardRef)(function Dropdown3({
|
|
|
5893
5945
|
width = 180,
|
|
5894
5946
|
...props
|
|
5895
5947
|
}, forwardedRef) {
|
|
5896
|
-
const id = (0,
|
|
5948
|
+
const id = (0, import_vuu_utils14.useId)(idProp);
|
|
5897
5949
|
const rootRef = (0, import_react40.useRef)(null);
|
|
5898
5950
|
const listRef = (0, import_react40.useRef)(null);
|
|
5899
5951
|
const forkedRef = (0, import_core12.useForkRef)(rootRef, forwardedRef);
|
|
@@ -7845,17 +7897,17 @@ function $64244302c3013299$export$dd0bbc9b26defe37(name) {
|
|
|
7845
7897
|
}
|
|
7846
7898
|
|
|
7847
7899
|
// src/calendar/internal/utils.ts
|
|
7848
|
-
var
|
|
7900
|
+
var import_vuu_utils15 = require("@vuu-ui/vuu-utils");
|
|
7849
7901
|
var localTimezone = $14e0f24ef4ac5c92$export$aa8b41735afcabd2();
|
|
7850
7902
|
function getCurrentLocale() {
|
|
7851
7903
|
return navigator.languages[0];
|
|
7852
7904
|
}
|
|
7853
7905
|
function formatDate(date, options) {
|
|
7854
|
-
const formatter = (0,
|
|
7906
|
+
const formatter = (0, import_vuu_utils15.getDateFormatter)(getCurrentLocale(), options);
|
|
7855
7907
|
return formatter.format(date.toDate(localTimezone));
|
|
7856
7908
|
}
|
|
7857
7909
|
function getCalender() {
|
|
7858
|
-
const calendarIdentifier = (0,
|
|
7910
|
+
const calendarIdentifier = (0, import_vuu_utils15.getDateFormatter)(
|
|
7859
7911
|
getCurrentLocale()
|
|
7860
7912
|
).resolvedOptions().calendar;
|
|
7861
7913
|
return $64244302c3013299$export$dd0bbc9b26defe37(calendarIdentifier);
|
|
@@ -7896,9 +7948,45 @@ function monthDiff(a, b) {
|
|
|
7896
7948
|
return b.month - a.month + 12 * (b.year - a.year);
|
|
7897
7949
|
}
|
|
7898
7950
|
|
|
7899
|
-
// src/
|
|
7951
|
+
// src/icon-button/Icon.tsx
|
|
7952
|
+
var import_clsx10 = __toESM(require("clsx"));
|
|
7900
7953
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
7901
|
-
var
|
|
7954
|
+
var classBase8 = "vuuIcon";
|
|
7955
|
+
var Icon = ({
|
|
7956
|
+
className,
|
|
7957
|
+
name,
|
|
7958
|
+
size,
|
|
7959
|
+
style: styleProp,
|
|
7960
|
+
...htmlAttributes
|
|
7961
|
+
}) => {
|
|
7962
|
+
const style = typeof size === "number" ? { ...styleProp, "--vuu-icon-size": `${size}px` } : styleProp;
|
|
7963
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
7964
|
+
"span",
|
|
7965
|
+
{
|
|
7966
|
+
...htmlAttributes,
|
|
7967
|
+
className: (0, import_clsx10.default)(classBase8, className),
|
|
7968
|
+
"data-icon": name,
|
|
7969
|
+
role: "img",
|
|
7970
|
+
style
|
|
7971
|
+
}
|
|
7972
|
+
);
|
|
7973
|
+
};
|
|
7974
|
+
|
|
7975
|
+
// src/icon-button/IconButton.tsx
|
|
7976
|
+
var import_clsx11 = __toESM(require("clsx"));
|
|
7977
|
+
var import_core13 = require("@salt-ds/core");
|
|
7978
|
+
var import_react42 = require("react");
|
|
7979
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
7980
|
+
var classBase9 = "vuuIconButton";
|
|
7981
|
+
var IconButton = (0, import_react42.forwardRef)(
|
|
7982
|
+
function IconButton2({ "aria-label": ariaLabel, className, icon, ...buttonProps }, ref) {
|
|
7983
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_core13.Button, { ...buttonProps, className: (0, import_clsx11.default)(classBase9, className), ref, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon, { "aria-label": ariaLabel, name: icon }) });
|
|
7984
|
+
}
|
|
7985
|
+
);
|
|
7986
|
+
|
|
7987
|
+
// src/calendar/internal/CalendarNavigation.tsx
|
|
7988
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
7989
|
+
var withBaseName2 = (0, import_core14.makePrefixer)("saltCalendarNavigation");
|
|
7902
7990
|
function useCalendarNavigation() {
|
|
7903
7991
|
const {
|
|
7904
7992
|
state: { visibleMonth, minDate, maxDate },
|
|
@@ -7958,16 +8046,16 @@ var ListItemWithTooltip = ({
|
|
|
7958
8046
|
item,
|
|
7959
8047
|
label,
|
|
7960
8048
|
...props
|
|
7961
|
-
}) => /* @__PURE__ */ (0,
|
|
7962
|
-
|
|
8049
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
8050
|
+
import_core14.Tooltip,
|
|
7963
8051
|
{
|
|
7964
8052
|
placement: "right",
|
|
7965
8053
|
disabled: !(item == null ? void 0 : item.disabled),
|
|
7966
8054
|
content: "This month is out of range",
|
|
7967
|
-
children: /* @__PURE__ */ (0,
|
|
8055
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ListItem, { ...props, children: label })
|
|
7968
8056
|
}
|
|
7969
8057
|
);
|
|
7970
|
-
var CalendarNavigation = (0,
|
|
8058
|
+
var CalendarNavigation = (0, import_react43.forwardRef)(function CalendarNavigation2(props, ref) {
|
|
7971
8059
|
const {
|
|
7972
8060
|
className,
|
|
7973
8061
|
MonthDropdownProps,
|
|
@@ -8003,15 +8091,15 @@ var CalendarNavigation = (0, import_react42.forwardRef)(function CalendarNavigat
|
|
|
8003
8091
|
moveToMonth(event, year.value);
|
|
8004
8092
|
}
|
|
8005
8093
|
};
|
|
8006
|
-
const monthDropdownId = (0,
|
|
8007
|
-
const monthDropdownLabelledBy = (0,
|
|
8094
|
+
const monthDropdownId = (0, import_core14.useId)(MonthDropdownProps == null ? void 0 : MonthDropdownProps.id) || "";
|
|
8095
|
+
const monthDropdownLabelledBy = (0, import_clsx12.clsx)(
|
|
8008
8096
|
MonthDropdownProps == null ? void 0 : MonthDropdownProps["aria-labelledby"],
|
|
8009
8097
|
// TODO need a prop on Dropdown to allow buttonId to be passed, should not make assumptions about internal
|
|
8010
8098
|
// id assignment like this
|
|
8011
8099
|
`${monthDropdownId}-control`
|
|
8012
8100
|
);
|
|
8013
|
-
const yearDropdownId = (0,
|
|
8014
|
-
const yearDropdownLabelledBy = (0,
|
|
8101
|
+
const yearDropdownId = (0, import_core14.useId)(YearDropdownProps == null ? void 0 : YearDropdownProps.id) || "";
|
|
8102
|
+
const yearDropdownLabelledBy = (0, import_clsx12.clsx)(
|
|
8015
8103
|
YearDropdownProps == null ? void 0 : YearDropdownProps["aria-labelledby"],
|
|
8016
8104
|
`${yearDropdownId}-control`
|
|
8017
8105
|
);
|
|
@@ -8024,10 +8112,10 @@ var CalendarNavigation = (0, import_react42.forwardRef)(function CalendarNavigat
|
|
|
8024
8112
|
const defaultItemToYear = (date) => {
|
|
8025
8113
|
return formatDate(date.value, { year: "numeric" });
|
|
8026
8114
|
};
|
|
8027
|
-
return /* @__PURE__ */ (0,
|
|
8115
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
8028
8116
|
"div",
|
|
8029
8117
|
{
|
|
8030
|
-
className: (0,
|
|
8118
|
+
className: (0, import_clsx12.clsx)(
|
|
8031
8119
|
withBaseName2(),
|
|
8032
8120
|
{ [withBaseName2("hideYearDropdown")]: hideYearDropdown },
|
|
8033
8121
|
className
|
|
@@ -8035,33 +8123,29 @@ var CalendarNavigation = (0, import_react42.forwardRef)(function CalendarNavigat
|
|
|
8035
8123
|
ref,
|
|
8036
8124
|
...rest,
|
|
8037
8125
|
children: [
|
|
8038
|
-
/* @__PURE__ */ (0,
|
|
8039
|
-
|
|
8126
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
8127
|
+
import_core14.Tooltip,
|
|
8040
8128
|
{
|
|
8041
8129
|
placement: "top",
|
|
8042
8130
|
disabled: canNavigatePrevious,
|
|
8043
8131
|
content: "Past dates are out of range",
|
|
8044
|
-
children: /* @__PURE__ */ (0,
|
|
8045
|
-
|
|
8132
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
8133
|
+
IconButton,
|
|
8046
8134
|
{
|
|
8135
|
+
"aria-label": `Previous Month, ${formatDate(
|
|
8136
|
+
visibleMonth.subtract({ months: 1 })
|
|
8137
|
+
)}`,
|
|
8047
8138
|
disabled: !canNavigatePrevious,
|
|
8139
|
+
icon: "chevron-left",
|
|
8048
8140
|
variant: "secondary",
|
|
8049
8141
|
onClick: handleNavigatePrevious,
|
|
8050
8142
|
className: withBaseName2("previousButton"),
|
|
8051
|
-
focusableWhenDisabled: true
|
|
8052
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8053
|
-
import_icons.ChevronLeftIcon,
|
|
8054
|
-
{
|
|
8055
|
-
"aria-label": `Previous Month, ${formatDate(
|
|
8056
|
-
visibleMonth.subtract({ months: 1 })
|
|
8057
|
-
)}`
|
|
8058
|
-
}
|
|
8059
|
-
)
|
|
8143
|
+
focusableWhenDisabled: true
|
|
8060
8144
|
}
|
|
8061
8145
|
)
|
|
8062
8146
|
}
|
|
8063
8147
|
),
|
|
8064
|
-
/* @__PURE__ */ (0,
|
|
8148
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
8065
8149
|
Dropdown2,
|
|
8066
8150
|
{
|
|
8067
8151
|
source: months,
|
|
@@ -8076,7 +8160,7 @@ var CalendarNavigation = (0, import_react42.forwardRef)(function CalendarNavigat
|
|
|
8076
8160
|
fullWidth: true
|
|
8077
8161
|
}
|
|
8078
8162
|
),
|
|
8079
|
-
!hideYearDropdown && /* @__PURE__ */ (0,
|
|
8163
|
+
!hideYearDropdown && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
8080
8164
|
Dropdown2,
|
|
8081
8165
|
{
|
|
8082
8166
|
source: years,
|
|
@@ -8091,28 +8175,24 @@ var CalendarNavigation = (0, import_react42.forwardRef)(function CalendarNavigat
|
|
|
8091
8175
|
fullWidth: true
|
|
8092
8176
|
}
|
|
8093
8177
|
),
|
|
8094
|
-
/* @__PURE__ */ (0,
|
|
8095
|
-
|
|
8178
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
8179
|
+
import_core14.Tooltip,
|
|
8096
8180
|
{
|
|
8097
8181
|
placement: "top",
|
|
8098
8182
|
disabled: canNavigateNext,
|
|
8099
8183
|
content: "Future dates are out of range",
|
|
8100
|
-
children: /* @__PURE__ */ (0,
|
|
8101
|
-
|
|
8184
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
8185
|
+
IconButton,
|
|
8102
8186
|
{
|
|
8187
|
+
"aria-label": `Next Month, ${formatDate(
|
|
8188
|
+
visibleMonth.add({ months: 1 })
|
|
8189
|
+
)}`,
|
|
8103
8190
|
disabled: !canNavigateNext,
|
|
8191
|
+
icon: "chevron-right",
|
|
8104
8192
|
variant: "secondary",
|
|
8105
8193
|
onClick: handleNavigateNext,
|
|
8106
8194
|
className: withBaseName2("nextButton"),
|
|
8107
|
-
focusableWhenDisabled: true
|
|
8108
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8109
|
-
import_icons.ChevronRightIcon,
|
|
8110
|
-
{
|
|
8111
|
-
"aria-label": `Next Month, ${formatDate(
|
|
8112
|
-
visibleMonth.add({ months: 1 })
|
|
8113
|
-
)}`
|
|
8114
|
-
}
|
|
8115
|
-
)
|
|
8195
|
+
focusableWhenDisabled: true
|
|
8116
8196
|
}
|
|
8117
8197
|
)
|
|
8118
8198
|
}
|
|
@@ -8123,22 +8203,22 @@ var CalendarNavigation = (0, import_react42.forwardRef)(function CalendarNavigat
|
|
|
8123
8203
|
});
|
|
8124
8204
|
|
|
8125
8205
|
// src/calendar/internal/CalendarWeekHeader.tsx
|
|
8126
|
-
var
|
|
8127
|
-
var
|
|
8128
|
-
var
|
|
8129
|
-
var
|
|
8130
|
-
var withBaseName3 = (0,
|
|
8131
|
-
var CalendarWeekHeader = (0,
|
|
8206
|
+
var import_react44 = require("react");
|
|
8207
|
+
var import_clsx13 = require("clsx");
|
|
8208
|
+
var import_core15 = require("@salt-ds/core");
|
|
8209
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
8210
|
+
var withBaseName3 = (0, import_core15.makePrefixer)("saltCalendarWeekHeader");
|
|
8211
|
+
var CalendarWeekHeader = (0, import_react44.forwardRef)(function CalendarWeekHeader2({ className, ...rest }, ref) {
|
|
8132
8212
|
const weekdaysShort = daysForLocale("narrow");
|
|
8133
8213
|
const weekdaysLong = daysForLocale("long");
|
|
8134
|
-
return /* @__PURE__ */ (0,
|
|
8214
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
8135
8215
|
"div",
|
|
8136
8216
|
{
|
|
8137
8217
|
"data-testid": "CalendarWeekHeader",
|
|
8138
|
-
className: (0,
|
|
8218
|
+
className: (0, import_clsx13.clsx)(withBaseName3(), className),
|
|
8139
8219
|
ref,
|
|
8140
8220
|
...rest,
|
|
8141
|
-
children: weekdaysShort.map((day, index) => /* @__PURE__ */ (0,
|
|
8221
|
+
children: weekdaysShort.map((day, index) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
8142
8222
|
"small",
|
|
8143
8223
|
{
|
|
8144
8224
|
"aria-hidden": "true",
|
|
@@ -8152,21 +8232,21 @@ var CalendarWeekHeader = (0, import_react43.forwardRef)(function CalendarWeekHea
|
|
|
8152
8232
|
});
|
|
8153
8233
|
|
|
8154
8234
|
// src/calendar/internal/CalendarCarousel.tsx
|
|
8155
|
-
var
|
|
8235
|
+
var import_react48 = require("react");
|
|
8156
8236
|
|
|
8157
8237
|
// src/calendar/internal/CalendarMonth.tsx
|
|
8158
|
-
var
|
|
8159
|
-
var
|
|
8160
|
-
var
|
|
8238
|
+
var import_react47 = require("react");
|
|
8239
|
+
var import_clsx16 = require("clsx");
|
|
8240
|
+
var import_core18 = require("@salt-ds/core");
|
|
8161
8241
|
|
|
8162
8242
|
// src/calendar/internal/CalendarDay.tsx
|
|
8163
|
-
var
|
|
8164
|
-
var
|
|
8165
|
-
var
|
|
8166
|
-
var
|
|
8243
|
+
var import_core17 = require("@salt-ds/core");
|
|
8244
|
+
var import_icons = require("@salt-ds/icons");
|
|
8245
|
+
var import_clsx15 = require("clsx");
|
|
8246
|
+
var import_react46 = require("react");
|
|
8167
8247
|
|
|
8168
8248
|
// src/calendar/useCalendarDay.ts
|
|
8169
|
-
var
|
|
8249
|
+
var import_react45 = require("react");
|
|
8170
8250
|
|
|
8171
8251
|
// src/calendar/internal/useFocusManagement.ts
|
|
8172
8252
|
function useFocusManagement({ date }) {
|
|
@@ -8226,8 +8306,8 @@ function useFocusManagement({ date }) {
|
|
|
8226
8306
|
}
|
|
8227
8307
|
|
|
8228
8308
|
// src/calendar/useSelection.ts
|
|
8229
|
-
var
|
|
8230
|
-
var
|
|
8309
|
+
var import_core16 = require("@salt-ds/core");
|
|
8310
|
+
var import_clsx14 = require("clsx");
|
|
8231
8311
|
function addOrRemoveFromArray(array = [], item) {
|
|
8232
8312
|
if (Array.isArray(array)) {
|
|
8233
8313
|
if (array.find((element) => $14e0f24ef4ac5c92$export$ea39ec197993aef0(element, item))) {
|
|
@@ -8241,7 +8321,7 @@ var defaultOffset = (date) => date;
|
|
|
8241
8321
|
function isRangeOrOffsetSelectionValue(selectionValue) {
|
|
8242
8322
|
return selectionValue != null && isPlainObject(selectionValue);
|
|
8243
8323
|
}
|
|
8244
|
-
var withBaseName4 = (0,
|
|
8324
|
+
var withBaseName4 = (0, import_core16.makePrefixer)("saltCalendarDay");
|
|
8245
8325
|
function useSelectionCalendar(props) {
|
|
8246
8326
|
const {
|
|
8247
8327
|
hoveredDate: hoveredDateProp,
|
|
@@ -8254,7 +8334,7 @@ function useSelectionCalendar(props) {
|
|
|
8254
8334
|
// startDateOffset,
|
|
8255
8335
|
// endDateOffset,
|
|
8256
8336
|
} = props;
|
|
8257
|
-
const [selectedDate, setSelectedDateState] = (0,
|
|
8337
|
+
const [selectedDate, setSelectedDateState] = (0, import_core16.useControlled)({
|
|
8258
8338
|
controlled: selectedDateProp,
|
|
8259
8339
|
default: defaultSelectedDate,
|
|
8260
8340
|
name: "Calendar",
|
|
@@ -8326,7 +8406,7 @@ function useSelectionCalendar(props) {
|
|
|
8326
8406
|
return false;
|
|
8327
8407
|
}
|
|
8328
8408
|
};
|
|
8329
|
-
const [hoveredDate, setHoveredDateState] = (0,
|
|
8409
|
+
const [hoveredDate, setHoveredDateState] = (0, import_core16.useControlled)({
|
|
8330
8410
|
controlled: hoveredDateProp,
|
|
8331
8411
|
default: void 0,
|
|
8332
8412
|
name: "Calendar",
|
|
@@ -8445,7 +8525,7 @@ function useSelectionDay({ date }) {
|
|
|
8445
8525
|
hoveredOffset
|
|
8446
8526
|
},
|
|
8447
8527
|
dayProps: {
|
|
8448
|
-
className: (0,
|
|
8528
|
+
className: (0, import_clsx14.clsx)({
|
|
8449
8529
|
[withBaseName4("selected")]: selected,
|
|
8450
8530
|
[withBaseName4("selectedSpan")]: selectedSpan,
|
|
8451
8531
|
[withBaseName4("hoveredSpan")]: hoveredSpan,
|
|
@@ -8492,12 +8572,12 @@ function useCalendarDay({ date, month }, ref) {
|
|
|
8492
8572
|
const outOfRange = !$14e0f24ef4ac5c92$export$a18c89cbd24170ff(date, month);
|
|
8493
8573
|
const focused = $14e0f24ef4ac5c92$export$ea39ec197993aef0(date, focusedDate) && calendarFocused && !outOfRange;
|
|
8494
8574
|
const tabIndex = $14e0f24ef4ac5c92$export$ea39ec197993aef0(date, focusedDate) && !outOfRange ? 0 : -1;
|
|
8495
|
-
const
|
|
8575
|
+
const today2 = $14e0f24ef4ac5c92$export$629b0a497aa65267(date, $14e0f24ef4ac5c92$export$aa8b41735afcabd2());
|
|
8496
8576
|
const unselectableResult = isDayUnselectable(date) || outOfRange && isOutsideAllowedMonths(date);
|
|
8497
8577
|
const unselectableReason = typeof unselectableResult !== "boolean" ? unselectableResult == null ? void 0 : unselectableResult.tooltip : "";
|
|
8498
8578
|
const unselectable = typeof unselectableResult !== "boolean" ? unselectableResult.emphasis : unselectableResult ? "low" : false;
|
|
8499
8579
|
const hidden = hideOutOfRangeDates && outOfRange;
|
|
8500
|
-
(0,
|
|
8580
|
+
(0, import_react45.useEffect)(() => {
|
|
8501
8581
|
var _a2;
|
|
8502
8582
|
if (focused) {
|
|
8503
8583
|
(_a2 = ref.current) == null ? void 0 : _a2.focus({ preventScroll: true });
|
|
@@ -8506,7 +8586,7 @@ function useCalendarDay({ date, month }, ref) {
|
|
|
8506
8586
|
return {
|
|
8507
8587
|
status: {
|
|
8508
8588
|
outOfRange,
|
|
8509
|
-
today,
|
|
8589
|
+
today: today2,
|
|
8510
8590
|
unselectable,
|
|
8511
8591
|
focused,
|
|
8512
8592
|
hidden,
|
|
@@ -8514,7 +8594,7 @@ function useCalendarDay({ date, month }, ref) {
|
|
|
8514
8594
|
},
|
|
8515
8595
|
dayProps: {
|
|
8516
8596
|
tabIndex,
|
|
8517
|
-
"aria-current":
|
|
8597
|
+
"aria-current": today2 ? "date" : void 0,
|
|
8518
8598
|
"aria-hidden": hidden ? "true" : void 0,
|
|
8519
8599
|
...eventHandlers,
|
|
8520
8600
|
...selectionManager.dayProps
|
|
@@ -8524,13 +8604,13 @@ function useCalendarDay({ date, month }, ref) {
|
|
|
8524
8604
|
}
|
|
8525
8605
|
|
|
8526
8606
|
// src/calendar/internal/CalendarDay.tsx
|
|
8527
|
-
var
|
|
8528
|
-
var withBaseName5 = (0,
|
|
8529
|
-
var CalendarDay = (0,
|
|
8607
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
8608
|
+
var withBaseName5 = (0, import_core17.makePrefixer)("saltCalendarDay");
|
|
8609
|
+
var CalendarDay = (0, import_react46.forwardRef)(
|
|
8530
8610
|
function CalendarDay2(props, ref) {
|
|
8531
8611
|
const { className, day, renderDayContents, month, TooltipProps: TooltipProps2, ...rest } = props;
|
|
8532
|
-
const dayRef = (0,
|
|
8533
|
-
const forkedRef = (0,
|
|
8612
|
+
const dayRef = (0, import_react46.useRef)(null);
|
|
8613
|
+
const forkedRef = (0, import_core17.useForkRef)(ref, dayRef);
|
|
8534
8614
|
const { status, dayProps, unselectableReason } = useCalendarDay(
|
|
8535
8615
|
{
|
|
8536
8616
|
date: day,
|
|
@@ -8538,9 +8618,9 @@ var CalendarDay = (0, import_react45.forwardRef)(
|
|
|
8538
8618
|
},
|
|
8539
8619
|
dayRef
|
|
8540
8620
|
);
|
|
8541
|
-
const { outOfRange, today, unselectable, hidden } = status;
|
|
8542
|
-
return /* @__PURE__ */ (0,
|
|
8543
|
-
|
|
8621
|
+
const { outOfRange, today: today2, unselectable, hidden } = status;
|
|
8622
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8623
|
+
import_core17.Tooltip,
|
|
8544
8624
|
{
|
|
8545
8625
|
hideIcon: true,
|
|
8546
8626
|
status: "error",
|
|
@@ -8549,19 +8629,19 @@ var CalendarDay = (0, import_react45.forwardRef)(
|
|
|
8549
8629
|
placement: "top",
|
|
8550
8630
|
enterDelay: 300,
|
|
8551
8631
|
...TooltipProps2,
|
|
8552
|
-
children: /* @__PURE__ */ (0,
|
|
8632
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
8553
8633
|
"button",
|
|
8554
8634
|
{
|
|
8555
8635
|
"aria-label": formatDate(day),
|
|
8556
8636
|
...dayProps,
|
|
8557
8637
|
ref: forkedRef,
|
|
8558
8638
|
...rest,
|
|
8559
|
-
className: (0,
|
|
8639
|
+
className: (0, import_clsx15.clsx)(
|
|
8560
8640
|
withBaseName5(),
|
|
8561
8641
|
{
|
|
8562
8642
|
[withBaseName5("hidden")]: hidden,
|
|
8563
8643
|
[withBaseName5("outOfRange")]: outOfRange,
|
|
8564
|
-
[withBaseName5("today")]:
|
|
8644
|
+
[withBaseName5("today")]: today2,
|
|
8565
8645
|
[withBaseName5("unselectable")]: !!unselectable,
|
|
8566
8646
|
[withBaseName5("unselectableLow")]: unselectable === "low",
|
|
8567
8647
|
[withBaseName5("unselectableMedium")]: unselectable === "medium"
|
|
@@ -8570,8 +8650,8 @@ var CalendarDay = (0, import_react45.forwardRef)(
|
|
|
8570
8650
|
className
|
|
8571
8651
|
),
|
|
8572
8652
|
children: [
|
|
8573
|
-
unselectable === "medium" && /* @__PURE__ */ (0,
|
|
8574
|
-
|
|
8653
|
+
unselectable === "medium" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8654
|
+
import_icons.CloseIcon,
|
|
8575
8655
|
{
|
|
8576
8656
|
"aria-hidden": true,
|
|
8577
8657
|
"aria-label": void 0,
|
|
@@ -8588,9 +8668,9 @@ var CalendarDay = (0, import_react45.forwardRef)(
|
|
|
8588
8668
|
);
|
|
8589
8669
|
|
|
8590
8670
|
// src/calendar/internal/CalendarMonth.tsx
|
|
8591
|
-
var
|
|
8592
|
-
var withBaseName6 = (0,
|
|
8593
|
-
var CalendarMonth = (0,
|
|
8671
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
8672
|
+
var withBaseName6 = (0, import_core18.makePrefixer)("saltCalendarMonth");
|
|
8673
|
+
var CalendarMonth = (0, import_react47.forwardRef)(
|
|
8594
8674
|
function CalendarMonth2(props, ref) {
|
|
8595
8675
|
const {
|
|
8596
8676
|
className,
|
|
@@ -8610,20 +8690,20 @@ var CalendarMonth = (0, import_react46.forwardRef)(
|
|
|
8610
8690
|
setHoveredDate(event, null);
|
|
8611
8691
|
onMouseLeave == null ? void 0 : onMouseLeave(event);
|
|
8612
8692
|
};
|
|
8613
|
-
return /* @__PURE__ */ (0,
|
|
8693
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8614
8694
|
"div",
|
|
8615
8695
|
{
|
|
8616
|
-
className: (0,
|
|
8696
|
+
className: (0, import_clsx16.clsx)(withBaseName6(), className),
|
|
8617
8697
|
ref,
|
|
8618
8698
|
onMouseLeave: handleMouseLeave,
|
|
8619
8699
|
...rest,
|
|
8620
|
-
children: /* @__PURE__ */ (0,
|
|
8700
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8621
8701
|
"div",
|
|
8622
8702
|
{
|
|
8623
8703
|
"data-testid": "CalendarDateGrid",
|
|
8624
8704
|
className: withBaseName6("dateGrid"),
|
|
8625
8705
|
children: days.map((day) => {
|
|
8626
|
-
return /* @__PURE__ */ (0,
|
|
8706
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8627
8707
|
CalendarDay,
|
|
8628
8708
|
{
|
|
8629
8709
|
day: day.date,
|
|
@@ -8642,26 +8722,26 @@ var CalendarMonth = (0, import_react46.forwardRef)(
|
|
|
8642
8722
|
);
|
|
8643
8723
|
|
|
8644
8724
|
// src/calendar/internal/CalendarCarousel.tsx
|
|
8645
|
-
var
|
|
8646
|
-
var
|
|
8725
|
+
var import_core19 = require("@salt-ds/core");
|
|
8726
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
8647
8727
|
function getMonths(month) {
|
|
8648
8728
|
return [month.subtract({ months: 1 }), month, month.add({ months: 1 })];
|
|
8649
8729
|
}
|
|
8650
8730
|
function usePreviousMonth(visibleMonth) {
|
|
8651
|
-
const previous = (0,
|
|
8731
|
+
const previous = (0, import_core19.usePrevious)(visibleMonth, [formatDate(visibleMonth)]);
|
|
8652
8732
|
return previous != null ? previous : $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3($14e0f24ef4ac5c92$export$aa8b41735afcabd2());
|
|
8653
8733
|
}
|
|
8654
|
-
var withBaseName7 = (0,
|
|
8655
|
-
var CalendarCarousel = (0,
|
|
8734
|
+
var withBaseName7 = (0, import_core19.makePrefixer)("saltCalendarCarousel");
|
|
8735
|
+
var CalendarCarousel = (0, import_react48.forwardRef)(function CalendarCarousel2(props, ref) {
|
|
8656
8736
|
const { ...rest } = props;
|
|
8657
8737
|
const {
|
|
8658
8738
|
state: { visibleMonth }
|
|
8659
8739
|
} = useCalendarContext();
|
|
8660
|
-
const containerRef = (0,
|
|
8740
|
+
const containerRef = (0, import_react48.useRef)(null);
|
|
8661
8741
|
const diffIndex = (a, b) => monthDiff(a, b);
|
|
8662
|
-
const { current: baseIndex } = (0,
|
|
8742
|
+
const { current: baseIndex } = (0, import_react48.useRef)(visibleMonth);
|
|
8663
8743
|
const previousVisibleMonth = usePreviousMonth(visibleMonth);
|
|
8664
|
-
(0,
|
|
8744
|
+
(0, import_core19.useIsomorphicLayoutEffect)(() => {
|
|
8665
8745
|
var _a2, _b;
|
|
8666
8746
|
if (Math.abs(diffIndex(visibleMonth, previousVisibleMonth)) > 1) {
|
|
8667
8747
|
(_a2 = containerRef.current) == null ? void 0 : _a2.classList.remove(withBaseName7("shouldAnimate"));
|
|
@@ -8669,13 +8749,13 @@ var CalendarCarousel = (0, import_react47.forwardRef)(function CalendarCarousel2
|
|
|
8669
8749
|
(_b = containerRef.current) == null ? void 0 : _b.classList.add(withBaseName7("shouldAnimate"));
|
|
8670
8750
|
}
|
|
8671
8751
|
}, [formatDate(visibleMonth), formatDate(previousVisibleMonth)]);
|
|
8672
|
-
(0,
|
|
8752
|
+
(0, import_core19.useIsomorphicLayoutEffect)(() => {
|
|
8673
8753
|
if (containerRef.current) {
|
|
8674
8754
|
containerRef.current.style.transform = `translate3d(${diffIndex(baseIndex, visibleMonth) * 100}%, 0, 0)`;
|
|
8675
8755
|
}
|
|
8676
8756
|
});
|
|
8677
|
-
const [months, setMonths] = (0,
|
|
8678
|
-
(0,
|
|
8757
|
+
const [months, setMonths] = (0, import_react48.useState)(() => getMonths(visibleMonth));
|
|
8758
|
+
(0, import_react48.useEffect)(() => {
|
|
8679
8759
|
setMonths((oldMonths) => {
|
|
8680
8760
|
const newMonths = getMonths(visibleMonth).filter((month) => {
|
|
8681
8761
|
return !oldMonths.find((oldMonth) => $14e0f24ef4ac5c92$export$a18c89cbd24170ff(oldMonth, month));
|
|
@@ -8696,7 +8776,7 @@ var CalendarCarousel = (0, import_react47.forwardRef)(function CalendarCarousel2
|
|
|
8696
8776
|
}
|
|
8697
8777
|
return void 0;
|
|
8698
8778
|
}, [formatDate(visibleMonth)]);
|
|
8699
|
-
return /* @__PURE__ */ (0,
|
|
8779
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8700
8780
|
"div",
|
|
8701
8781
|
{
|
|
8702
8782
|
className: withBaseName7(),
|
|
@@ -8705,7 +8785,7 @@ var CalendarCarousel = (0, import_react47.forwardRef)(function CalendarCarousel2
|
|
|
8705
8785
|
position: "relative"
|
|
8706
8786
|
},
|
|
8707
8787
|
ref,
|
|
8708
|
-
children: /* @__PURE__ */ (0,
|
|
8788
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: withBaseName7("track"), ref: containerRef, children: months.map((date, index) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8709
8789
|
"div",
|
|
8710
8790
|
{
|
|
8711
8791
|
className: withBaseName7("slide"),
|
|
@@ -8713,7 +8793,7 @@ var CalendarCarousel = (0, import_react47.forwardRef)(function CalendarCarousel2
|
|
|
8713
8793
|
transform: `translateX(${diffIndex(date, baseIndex) * 100}%)`
|
|
8714
8794
|
},
|
|
8715
8795
|
"aria-hidden": index !== 1 ? "true" : void 0,
|
|
8716
|
-
children: /* @__PURE__ */ (0,
|
|
8796
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CalendarMonth, { isVisible: index === 1, ...rest, date })
|
|
8717
8797
|
},
|
|
8718
8798
|
formatDate(date)
|
|
8719
8799
|
)) })
|
|
@@ -8722,8 +8802,8 @@ var CalendarCarousel = (0, import_react47.forwardRef)(function CalendarCarousel2
|
|
|
8722
8802
|
});
|
|
8723
8803
|
|
|
8724
8804
|
// src/calendar/useCalendar.ts
|
|
8725
|
-
var
|
|
8726
|
-
var
|
|
8805
|
+
var import_core20 = require("@salt-ds/core");
|
|
8806
|
+
var import_react49 = require("react");
|
|
8727
8807
|
var defaultIsDayUnselectable = () => false;
|
|
8728
8808
|
function useCalendar(props) {
|
|
8729
8809
|
const {
|
|
@@ -8744,7 +8824,7 @@ function useCalendar(props) {
|
|
|
8744
8824
|
// startDateOffset,
|
|
8745
8825
|
// endDateOffset,
|
|
8746
8826
|
} = props;
|
|
8747
|
-
const isOutsideAllowedDates = (0,
|
|
8827
|
+
const isOutsideAllowedDates = (0, import_react49.useCallback)(
|
|
8748
8828
|
(date) => {
|
|
8749
8829
|
return minDate != null && date.compare(minDate) < 0 || maxDate != null && date.compare(maxDate) > 0;
|
|
8750
8830
|
},
|
|
@@ -8756,7 +8836,7 @@ function useCalendar(props) {
|
|
|
8756
8836
|
const isOutsideAllowedYears = (date) => {
|
|
8757
8837
|
return minDate != null && $14e0f24ef4ac5c92$export$8b7aa55c66d5569e(date).compare(minDate) < 0 || maxDate != null && $14e0f24ef4ac5c92$export$f91e89d3d0406102(date).compare(maxDate) > 0;
|
|
8758
8838
|
};
|
|
8759
|
-
const isDaySelectable = (0,
|
|
8839
|
+
const isDaySelectable = (0, import_react49.useCallback)(
|
|
8760
8840
|
(date) => !(date && (isDayUnselectable(date) || isOutsideAllowedDates(date))),
|
|
8761
8841
|
[isDayUnselectable, isOutsideAllowedDates]
|
|
8762
8842
|
);
|
|
@@ -8771,17 +8851,17 @@ function useCalendar(props) {
|
|
|
8771
8851
|
onHoveredDateChange,
|
|
8772
8852
|
hoveredDate
|
|
8773
8853
|
});
|
|
8774
|
-
const [visibleMonth, setVisibleMonthState] = (0,
|
|
8854
|
+
const [visibleMonth, setVisibleMonthState] = (0, import_core20.useControlled)({
|
|
8775
8855
|
controlled: visibleMonthProp ? $14e0f24ef4ac5c92$export$a5a3b454ada2268e(visibleMonthProp) : void 0,
|
|
8776
8856
|
default: $14e0f24ef4ac5c92$export$a5a3b454ada2268e(defaultVisibleMonth),
|
|
8777
8857
|
name: "Calendar",
|
|
8778
8858
|
state: "visibleMonth"
|
|
8779
8859
|
});
|
|
8780
|
-
const [calendarFocused, setCalendarFocused] = (0,
|
|
8781
|
-
const [focusedDate, setFocusedDateState] = (0,
|
|
8860
|
+
const [calendarFocused, setCalendarFocused] = (0, import_react49.useState)(false);
|
|
8861
|
+
const [focusedDate, setFocusedDateState] = (0, import_react49.useState)(
|
|
8782
8862
|
$14e0f24ef4ac5c92$export$a5a3b454ada2268e(visibleMonth)
|
|
8783
8863
|
);
|
|
8784
|
-
const isDayVisible = (0,
|
|
8864
|
+
const isDayVisible = (0, import_react49.useCallback)(
|
|
8785
8865
|
(date) => {
|
|
8786
8866
|
const startInsideDays = $14e0f24ef4ac5c92$export$a5a3b454ada2268e(visibleMonth);
|
|
8787
8867
|
if (date.compare(startInsideDays) < 0)
|
|
@@ -8791,14 +8871,14 @@ function useCalendar(props) {
|
|
|
8791
8871
|
},
|
|
8792
8872
|
[visibleMonth]
|
|
8793
8873
|
);
|
|
8794
|
-
const setVisibleMonth = (0,
|
|
8874
|
+
const setVisibleMonth = (0, import_react49.useCallback)(
|
|
8795
8875
|
(event, newVisibleMonth) => {
|
|
8796
8876
|
setVisibleMonthState(newVisibleMonth);
|
|
8797
8877
|
onVisibleMonthChange == null ? void 0 : onVisibleMonthChange(event, newVisibleMonth);
|
|
8798
8878
|
},
|
|
8799
8879
|
[onVisibleMonthChange, setVisibleMonthState]
|
|
8800
8880
|
);
|
|
8801
|
-
const setFocusedDate = (0,
|
|
8881
|
+
const setFocusedDate = (0, import_react49.useCallback)(
|
|
8802
8882
|
(event, date) => {
|
|
8803
8883
|
if ($14e0f24ef4ac5c92$export$ea39ec197993aef0(date, focusedDate) || isOutsideAllowedDates(date))
|
|
8804
8884
|
return;
|
|
@@ -8816,7 +8896,7 @@ function useCalendar(props) {
|
|
|
8816
8896
|
setVisibleMonth
|
|
8817
8897
|
]
|
|
8818
8898
|
);
|
|
8819
|
-
(0,
|
|
8899
|
+
(0, import_react49.useEffect)(() => {
|
|
8820
8900
|
if (!isDayVisible(focusedDate)) {
|
|
8821
8901
|
setFocusedDateState($14e0f24ef4ac5c92$export$a5a3b454ada2268e(visibleMonth));
|
|
8822
8902
|
}
|
|
@@ -8847,9 +8927,9 @@ function useCalendar(props) {
|
|
|
8847
8927
|
}
|
|
8848
8928
|
|
|
8849
8929
|
// src/calendar/Calendar.tsx
|
|
8850
|
-
var
|
|
8851
|
-
var withBaseName8 = (0,
|
|
8852
|
-
var Calendar = (0,
|
|
8930
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
8931
|
+
var withBaseName8 = (0, import_core21.makePrefixer)("saltCalendar");
|
|
8932
|
+
var Calendar = (0, import_react50.forwardRef)(
|
|
8853
8933
|
function Calendar2(props, ref) {
|
|
8854
8934
|
const {
|
|
8855
8935
|
className,
|
|
@@ -8860,29 +8940,29 @@ var Calendar = (0, import_react49.forwardRef)(
|
|
|
8860
8940
|
} = props;
|
|
8861
8941
|
const { state, helpers } = useCalendar({ hideYearDropdown, ...rest });
|
|
8862
8942
|
const { setCalendarFocused } = helpers;
|
|
8863
|
-
const handleFocus = (0,
|
|
8943
|
+
const handleFocus = (0, import_react50.useCallback)(() => {
|
|
8864
8944
|
setCalendarFocused(true);
|
|
8865
8945
|
}, [setCalendarFocused]);
|
|
8866
|
-
const handleBlur = (0,
|
|
8946
|
+
const handleBlur = (0, import_react50.useCallback)(() => {
|
|
8867
8947
|
setCalendarFocused(false);
|
|
8868
8948
|
}, [setCalendarFocused]);
|
|
8869
|
-
return /* @__PURE__ */ (0,
|
|
8949
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
8870
8950
|
CalendarContext.Provider,
|
|
8871
8951
|
{
|
|
8872
8952
|
value: {
|
|
8873
8953
|
state,
|
|
8874
8954
|
helpers
|
|
8875
8955
|
},
|
|
8876
|
-
children: /* @__PURE__ */ (0,
|
|
8956
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
8877
8957
|
"div",
|
|
8878
8958
|
{
|
|
8879
|
-
className: (0,
|
|
8959
|
+
className: (0, import_clsx17.clsx)(withBaseName8(), className),
|
|
8880
8960
|
role: "application",
|
|
8881
8961
|
ref,
|
|
8882
8962
|
children: [
|
|
8883
|
-
/* @__PURE__ */ (0,
|
|
8884
|
-
/* @__PURE__ */ (0,
|
|
8885
|
-
/* @__PURE__ */ (0,
|
|
8963
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CalendarNavigation, { hideYearDropdown }),
|
|
8964
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CalendarWeekHeader, {}),
|
|
8965
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
8886
8966
|
CalendarCarousel,
|
|
8887
8967
|
{
|
|
8888
8968
|
onFocus: handleFocus,
|
|
@@ -8900,23 +8980,23 @@ var Calendar = (0, import_react49.forwardRef)(
|
|
|
8900
8980
|
);
|
|
8901
8981
|
|
|
8902
8982
|
// src/combo-box/ComboBox.tsx
|
|
8903
|
-
var
|
|
8904
|
-
var
|
|
8905
|
-
var
|
|
8983
|
+
var import_vuu_utils17 = require("@vuu-ui/vuu-utils");
|
|
8984
|
+
var import_core23 = require("@salt-ds/core");
|
|
8985
|
+
var import_react52 = require("react");
|
|
8906
8986
|
|
|
8907
8987
|
// src/list/ChevronIcon.tsx
|
|
8908
|
-
var
|
|
8909
|
-
var
|
|
8910
|
-
var
|
|
8988
|
+
var import_clsx18 = __toESM(require("clsx"));
|
|
8989
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
8990
|
+
var classBase10 = "vuuChevronIcon";
|
|
8911
8991
|
var ChevronIcon = (props) => {
|
|
8912
8992
|
const { direction, ...htmlAttributes } = props;
|
|
8913
|
-
return /* @__PURE__ */ (0,
|
|
8993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { ...htmlAttributes, className: (0, import_clsx18.default)(classBase10, direction) });
|
|
8914
8994
|
};
|
|
8915
8995
|
|
|
8916
8996
|
// src/combo-box/useCombobox.ts
|
|
8917
|
-
var
|
|
8918
|
-
var
|
|
8919
|
-
var
|
|
8997
|
+
var import_vuu_utils16 = require("@vuu-ui/vuu-utils");
|
|
8998
|
+
var import_core22 = require("@salt-ds/core");
|
|
8999
|
+
var import_react51 = require("react");
|
|
8920
9000
|
var EnterOnly = ["Enter"];
|
|
8921
9001
|
var useCombobox = ({
|
|
8922
9002
|
allowBackspaceClearsSelection,
|
|
@@ -8957,36 +9037,36 @@ var useCombobox = ({
|
|
|
8957
9037
|
const isMultiSelect = isMultiSelection(selectionStrategy);
|
|
8958
9038
|
const noSelection = () => isMultiSelect ? [] : null;
|
|
8959
9039
|
const { setFilterPattern } = collectionHook;
|
|
8960
|
-
const setHighlightedIndexRef = (0,
|
|
8961
|
-
const selectedRef = (0,
|
|
8962
|
-
const ignoreSelectOnFocus = (0,
|
|
8963
|
-
const [isOpen, _setIsOpen] = (0,
|
|
9040
|
+
const setHighlightedIndexRef = (0, import_react51.useRef)(null);
|
|
9041
|
+
const selectedRef = (0, import_react51.useRef)((_a2 = selectedProp != null ? selectedProp : defaultSelected) != null ? _a2 : noSelection());
|
|
9042
|
+
const ignoreSelectOnFocus = (0, import_react51.useRef)(true);
|
|
9043
|
+
const [isOpen, _setIsOpen] = (0, import_core22.useControlled)({
|
|
8964
9044
|
controlled: isOpenProp,
|
|
8965
9045
|
default: defaultIsOpen != null ? defaultIsOpen : false,
|
|
8966
9046
|
name: "useDropdownList"
|
|
8967
9047
|
});
|
|
8968
|
-
const [value, setValue] = (0,
|
|
9048
|
+
const [value, setValue] = (0, import_core22.useControlled)({
|
|
8969
9049
|
controlled: void 0,
|
|
8970
9050
|
default: defaultValue != null ? defaultValue : valueProp,
|
|
8971
9051
|
name: "ComboBox",
|
|
8972
9052
|
state: "value"
|
|
8973
9053
|
});
|
|
8974
|
-
const [disableAriaActiveDescendant, setDisableAriaActiveDescendant] = (0,
|
|
8975
|
-
const setIsOpen = (0,
|
|
9054
|
+
const [disableAriaActiveDescendant, setDisableAriaActiveDescendant] = (0, import_react51.useState)(true);
|
|
9055
|
+
const setIsOpen = (0, import_react51.useCallback)(
|
|
8976
9056
|
(isOpen2) => {
|
|
8977
9057
|
_setIsOpen(isOpen2);
|
|
8978
9058
|
setDisableAriaActiveDescendant(!isOpen2);
|
|
8979
9059
|
},
|
|
8980
9060
|
[_setIsOpen]
|
|
8981
9061
|
);
|
|
8982
|
-
const highlightSelectedItem = (0,
|
|
9062
|
+
const highlightSelectedItem = (0, import_react51.useCallback)((selected2) => {
|
|
8983
9063
|
var _a3;
|
|
8984
9064
|
if (Array.isArray(selected2)) {
|
|
8985
9065
|
} else if (selected2 == null) {
|
|
8986
9066
|
(_a3 = setHighlightedIndexRef.current) == null ? void 0 : _a3.call(setHighlightedIndexRef, -1);
|
|
8987
9067
|
}
|
|
8988
9068
|
}, []);
|
|
8989
|
-
const setTextValue = (0,
|
|
9069
|
+
const setTextValue = (0, import_react51.useCallback)(
|
|
8990
9070
|
(value2, applyFilter = true) => {
|
|
8991
9071
|
setValue(value2);
|
|
8992
9072
|
if (applyFilter) {
|
|
@@ -8995,7 +9075,7 @@ var useCombobox = ({
|
|
|
8995
9075
|
},
|
|
8996
9076
|
[setFilterPattern, setValue]
|
|
8997
9077
|
);
|
|
8998
|
-
const reconcileInput = (0,
|
|
9078
|
+
const reconcileInput = (0, import_react51.useCallback)(
|
|
8999
9079
|
(selected2) => {
|
|
9000
9080
|
let newValue = allowFreeText ? value != null ? value : "" : "";
|
|
9001
9081
|
if (Array.isArray(selected2)) {
|
|
@@ -9025,7 +9105,7 @@ var useCombobox = ({
|
|
|
9025
9105
|
value
|
|
9026
9106
|
]
|
|
9027
9107
|
);
|
|
9028
|
-
const applySelection = (0,
|
|
9108
|
+
const applySelection = (0, import_react51.useCallback)(() => {
|
|
9029
9109
|
const { current: selected2 } = selectedRef;
|
|
9030
9110
|
if (reconcileInput(selected2)) {
|
|
9031
9111
|
if (selected2) {
|
|
@@ -9043,7 +9123,7 @@ var useCombobox = ({
|
|
|
9043
9123
|
}
|
|
9044
9124
|
}
|
|
9045
9125
|
}, [onSelectionChange, reconcileInput]);
|
|
9046
|
-
const selectFreeTextInputValue = (0,
|
|
9126
|
+
const selectFreeTextInputValue = (0, import_react51.useCallback)(() => {
|
|
9047
9127
|
if (allowFreeText) {
|
|
9048
9128
|
const text = value == null ? void 0 : value.trim();
|
|
9049
9129
|
const { current: selected2 } = selectedRef;
|
|
@@ -9073,7 +9153,7 @@ var useCombobox = ({
|
|
|
9073
9153
|
onSelectionChange,
|
|
9074
9154
|
itemToString2
|
|
9075
9155
|
]);
|
|
9076
|
-
const handleOpenChange = (0,
|
|
9156
|
+
const handleOpenChange = (0, import_react51.useCallback)(
|
|
9077
9157
|
(open, closeReason) => {
|
|
9078
9158
|
if (open && isMultiSelect) {
|
|
9079
9159
|
setTextValue("", false);
|
|
@@ -9095,7 +9175,7 @@ var useCombobox = ({
|
|
|
9095
9175
|
setTextValue
|
|
9096
9176
|
]
|
|
9097
9177
|
);
|
|
9098
|
-
const handleSelectionChange = (0,
|
|
9178
|
+
const handleSelectionChange = (0, import_react51.useCallback)(
|
|
9099
9179
|
(evt, selected2) => {
|
|
9100
9180
|
selectedRef.current = selected2;
|
|
9101
9181
|
if (!isMultiSelect) {
|
|
@@ -9129,7 +9209,7 @@ var useCombobox = ({
|
|
|
9129
9209
|
});
|
|
9130
9210
|
setHighlightedIndexRef.current = setHighlightedIndex;
|
|
9131
9211
|
const { onClick: listHandlersOnClick } = listHookListHandlers;
|
|
9132
|
-
const handleListClick = (0,
|
|
9212
|
+
const handleListClick = (0, import_react51.useCallback)(
|
|
9133
9213
|
(evt) => {
|
|
9134
9214
|
var _a3;
|
|
9135
9215
|
(_a3 = document.getElementById(`${id}-input`)) == null ? void 0 : _a3.focus();
|
|
@@ -9137,7 +9217,7 @@ var useCombobox = ({
|
|
|
9137
9217
|
},
|
|
9138
9218
|
[id, listHandlersOnClick]
|
|
9139
9219
|
);
|
|
9140
|
-
const handleInputChange = (0,
|
|
9220
|
+
const handleInputChange = (0, import_react51.useCallback)(
|
|
9141
9221
|
(evt) => {
|
|
9142
9222
|
const newValue = evt.target.value;
|
|
9143
9223
|
setValue(newValue);
|
|
@@ -9150,7 +9230,7 @@ var useCombobox = ({
|
|
|
9150
9230
|
},
|
|
9151
9231
|
[setFilterPattern, setIsOpen, setValue]
|
|
9152
9232
|
);
|
|
9153
|
-
const handleInputKeyDown = (0,
|
|
9233
|
+
const handleInputKeyDown = (0, import_react51.useCallback)(
|
|
9154
9234
|
(e) => {
|
|
9155
9235
|
var _a3, _b;
|
|
9156
9236
|
if (e.key === "Enter" && value !== void 0 && value !== "" && allowEnterCommitsText) {
|
|
@@ -9174,7 +9254,7 @@ var useCombobox = ({
|
|
|
9174
9254
|
);
|
|
9175
9255
|
const { onFocus: inputOnFocus = onFocus } = InputProps4;
|
|
9176
9256
|
const { onFocus: listOnFocus } = listControlProps;
|
|
9177
|
-
const handleInputFocus = (0,
|
|
9257
|
+
const handleInputFocus = (0, import_react51.useCallback)(
|
|
9178
9258
|
(evt) => {
|
|
9179
9259
|
setDisableAriaActiveDescendant(false);
|
|
9180
9260
|
listOnFocus == null ? void 0 : listOnFocus(evt);
|
|
@@ -9182,7 +9262,7 @@ var useCombobox = ({
|
|
|
9182
9262
|
},
|
|
9183
9263
|
[inputOnFocus, listOnFocus]
|
|
9184
9264
|
);
|
|
9185
|
-
const listFocused = (0,
|
|
9265
|
+
const listFocused = (0, import_react51.useCallback)(
|
|
9186
9266
|
(evt) => {
|
|
9187
9267
|
const element = evt.relatedTarget;
|
|
9188
9268
|
return (element == null ? void 0 : element.id) === `${id}-list`;
|
|
@@ -9191,7 +9271,7 @@ var useCombobox = ({
|
|
|
9191
9271
|
);
|
|
9192
9272
|
const { onBlur: inputOnBlur = onBlur } = InputProps4;
|
|
9193
9273
|
const { onBlur: listOnBlur } = listControlProps;
|
|
9194
|
-
const handleInputBlur = (0,
|
|
9274
|
+
const handleInputBlur = (0, import_react51.useCallback)(
|
|
9195
9275
|
(evt) => {
|
|
9196
9276
|
if (listFocused(evt)) {
|
|
9197
9277
|
} else {
|
|
@@ -9203,7 +9283,7 @@ var useCombobox = ({
|
|
|
9203
9283
|
[listFocused, listOnBlur, inputOnBlur]
|
|
9204
9284
|
);
|
|
9205
9285
|
const { onSelect: inputOnSelect } = InputProps4;
|
|
9206
|
-
const handleInputSelect = (0,
|
|
9286
|
+
const handleInputSelect = (0, import_react51.useCallback)(
|
|
9207
9287
|
(event) => {
|
|
9208
9288
|
if (ignoreSelectOnFocus.current) {
|
|
9209
9289
|
ignoreSelectOnFocus.current = false;
|
|
@@ -9213,7 +9293,7 @@ var useCombobox = ({
|
|
|
9213
9293
|
},
|
|
9214
9294
|
[inputOnSelect]
|
|
9215
9295
|
);
|
|
9216
|
-
(0,
|
|
9296
|
+
(0, import_vuu_utils16.useLayoutEffectSkipFirst)(() => {
|
|
9217
9297
|
if (hasSelection(selected)) {
|
|
9218
9298
|
highlightSelectedItem(selected);
|
|
9219
9299
|
} else {
|
|
@@ -9263,8 +9343,8 @@ var useCombobox = ({
|
|
|
9263
9343
|
};
|
|
9264
9344
|
|
|
9265
9345
|
// src/combo-box/ComboBox.tsx
|
|
9266
|
-
var
|
|
9267
|
-
var ComboBox = (0,
|
|
9346
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
9347
|
+
var ComboBox = (0, import_react52.forwardRef)(function Combobox({
|
|
9268
9348
|
InputProps: InputPropsProp,
|
|
9269
9349
|
ListProps: ListProps3,
|
|
9270
9350
|
PopupProps,
|
|
@@ -9303,7 +9383,7 @@ var ComboBox = (0, import_react51.forwardRef)(function Combobox({
|
|
|
9303
9383
|
width = 180,
|
|
9304
9384
|
...props
|
|
9305
9385
|
}, forwardedRef) {
|
|
9306
|
-
const id = (0,
|
|
9386
|
+
const id = (0, import_vuu_utils17.useId)(idProp);
|
|
9307
9387
|
const isMultiSelect = isMultiSelection(selectionStrategy);
|
|
9308
9388
|
const valueFromSelected = (item) => {
|
|
9309
9389
|
var _a2;
|
|
@@ -9367,14 +9447,14 @@ var ComboBox = (0, import_react51.forwardRef)(function Combobox({
|
|
|
9367
9447
|
selectionStrategy,
|
|
9368
9448
|
value: initialValue
|
|
9369
9449
|
});
|
|
9370
|
-
const handleDropdownIconClick = (0,
|
|
9450
|
+
const handleDropdownIconClick = (0, import_react52.useCallback)(() => {
|
|
9371
9451
|
if (isOpen) {
|
|
9372
9452
|
onOpenChange(false, "toggle");
|
|
9373
9453
|
} else {
|
|
9374
9454
|
onOpenChange(true);
|
|
9375
9455
|
}
|
|
9376
9456
|
}, [isOpen, onOpenChange]);
|
|
9377
|
-
const endAdornment = endAdornmentProp === null ? null : /* @__PURE__ */ (0,
|
|
9457
|
+
const endAdornment = endAdornmentProp === null ? null : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
9378
9458
|
ChevronIcon,
|
|
9379
9459
|
{
|
|
9380
9460
|
direction: isOpen ? "up" : "down",
|
|
@@ -9382,7 +9462,7 @@ var ComboBox = (0, import_react51.forwardRef)(function Combobox({
|
|
|
9382
9462
|
role: "button"
|
|
9383
9463
|
}
|
|
9384
9464
|
);
|
|
9385
|
-
return /* @__PURE__ */ (0,
|
|
9465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CollectionProvider, { collectionHook, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
9386
9466
|
DropdownBase,
|
|
9387
9467
|
{
|
|
9388
9468
|
...props,
|
|
@@ -9394,8 +9474,8 @@ var ComboBox = (0, import_react51.forwardRef)(function Combobox({
|
|
|
9394
9474
|
ref: forwardedRef,
|
|
9395
9475
|
width,
|
|
9396
9476
|
children: [
|
|
9397
|
-
/* @__PURE__ */ (0,
|
|
9398
|
-
|
|
9477
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
9478
|
+
import_core23.Input,
|
|
9399
9479
|
{
|
|
9400
9480
|
...InputProps4,
|
|
9401
9481
|
disabled,
|
|
@@ -9403,7 +9483,7 @@ var ComboBox = (0, import_react51.forwardRef)(function Combobox({
|
|
|
9403
9483
|
endAdornment
|
|
9404
9484
|
}
|
|
9405
9485
|
),
|
|
9406
|
-
/* @__PURE__ */ (0,
|
|
9486
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
9407
9487
|
List,
|
|
9408
9488
|
{
|
|
9409
9489
|
...ListProps3,
|
|
@@ -9426,11 +9506,11 @@ var ComboBox = (0, import_react51.forwardRef)(function Combobox({
|
|
|
9426
9506
|
});
|
|
9427
9507
|
|
|
9428
9508
|
// src/cycle-state-button/CycleStateButton.tsx
|
|
9429
|
-
var
|
|
9430
|
-
var
|
|
9431
|
-
var
|
|
9432
|
-
var
|
|
9433
|
-
var
|
|
9509
|
+
var import_core24 = require("@salt-ds/core");
|
|
9510
|
+
var import_clsx19 = __toESM(require("clsx"));
|
|
9511
|
+
var import_react53 = require("react");
|
|
9512
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
9513
|
+
var classBase11 = "vuuCycleStateButton";
|
|
9434
9514
|
var getNextValue = (value, valueList) => {
|
|
9435
9515
|
const index = valueList.indexOf(value.toUpperCase());
|
|
9436
9516
|
if (index === valueList.length - 1) {
|
|
@@ -9439,14 +9519,14 @@ var getNextValue = (value, valueList) => {
|
|
|
9439
9519
|
return valueList[index + 1];
|
|
9440
9520
|
}
|
|
9441
9521
|
};
|
|
9442
|
-
var CycleStateButton = (0,
|
|
9522
|
+
var CycleStateButton = (0, import_react53.forwardRef)(function CycleStateButton2({
|
|
9443
9523
|
className,
|
|
9444
9524
|
onCommit,
|
|
9445
9525
|
value = "",
|
|
9446
9526
|
values,
|
|
9447
9527
|
...buttonProps
|
|
9448
9528
|
}, forwardedRef) {
|
|
9449
|
-
const handleClick = (0,
|
|
9529
|
+
const handleClick = (0, import_react53.useCallback)(
|
|
9450
9530
|
(evt) => {
|
|
9451
9531
|
const nextValue = getNextValue(value, values);
|
|
9452
9532
|
onCommit(evt, nextValue).then((response) => {
|
|
@@ -9457,14 +9537,14 @@ var CycleStateButton = (0, import_react52.forwardRef)(function CycleStateButton2
|
|
|
9457
9537
|
},
|
|
9458
9538
|
[onCommit, value, values]
|
|
9459
9539
|
);
|
|
9460
|
-
return /* @__PURE__ */ (0,
|
|
9461
|
-
|
|
9540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
9541
|
+
import_core24.Button,
|
|
9462
9542
|
{
|
|
9463
9543
|
...buttonProps,
|
|
9464
|
-
className: (0,
|
|
9465
|
-
|
|
9544
|
+
className: (0, import_clsx19.default)(
|
|
9545
|
+
classBase11,
|
|
9466
9546
|
className,
|
|
9467
|
-
`${
|
|
9547
|
+
`${classBase11}-${value.toLowerCase()}`
|
|
9468
9548
|
),
|
|
9469
9549
|
onClick: handleClick,
|
|
9470
9550
|
ref: forwardedRef,
|
|
@@ -9473,96 +9553,404 @@ var CycleStateButton = (0, import_react52.forwardRef)(function CycleStateButton2
|
|
|
9473
9553
|
);
|
|
9474
9554
|
});
|
|
9475
9555
|
|
|
9476
|
-
// src/date-
|
|
9556
|
+
// src/date-input/DateInput.tsx
|
|
9557
|
+
var import_vuu_utils18 = require("@vuu-ui/vuu-utils");
|
|
9558
|
+
var import_clsx21 = require("clsx");
|
|
9477
9559
|
var import_react57 = require("react");
|
|
9478
|
-
var import_clsx20 = require("clsx");
|
|
9479
9560
|
|
|
9480
|
-
// src/date-
|
|
9481
|
-
var
|
|
9482
|
-
var
|
|
9483
|
-
var
|
|
9484
|
-
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
9485
|
-
var baseClass2 = "vuuDatePickerInput";
|
|
9486
|
-
var DatePickerInput = (props) => {
|
|
9487
|
-
var _a2;
|
|
9488
|
-
const { value, onChange, className } = props;
|
|
9489
|
-
const onInputChange = (0, import_react53.useCallback)(
|
|
9490
|
-
(e) => {
|
|
9491
|
-
const v = e.target.value;
|
|
9492
|
-
if (v === "")
|
|
9493
|
-
return;
|
|
9494
|
-
else
|
|
9495
|
-
onChange((0, import_vuu_utils17.toCalendarDate)(new Date(v)));
|
|
9496
|
-
},
|
|
9497
|
-
[onChange]
|
|
9498
|
-
);
|
|
9499
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
9500
|
-
"input",
|
|
9501
|
-
{
|
|
9502
|
-
className: (0, import_clsx18.clsx)("saltInput-input", baseClass2, className),
|
|
9503
|
-
type: "date",
|
|
9504
|
-
value: (_a2 = value == null ? void 0 : value.toString()) != null ? _a2 : "",
|
|
9505
|
-
onChange: onInputChange,
|
|
9506
|
-
"aria-label": "date-input",
|
|
9507
|
-
max: "9999-12-31"
|
|
9508
|
-
}
|
|
9509
|
-
);
|
|
9510
|
-
};
|
|
9561
|
+
// src/date-popup/DatePopup.tsx
|
|
9562
|
+
var import_core25 = require("@salt-ds/core");
|
|
9563
|
+
var import_clsx20 = __toESM(require("clsx"));
|
|
9564
|
+
var import_react55 = require("react");
|
|
9511
9565
|
|
|
9512
|
-
// src/date-
|
|
9513
|
-
var import_core24 = require("@salt-ds/core");
|
|
9514
|
-
var import_icons3 = require("@salt-ds/icons");
|
|
9566
|
+
// src/date-popup/useDatePopup.ts
|
|
9515
9567
|
var import_react54 = require("react");
|
|
9516
|
-
var
|
|
9517
|
-
var
|
|
9518
|
-
|
|
9519
|
-
|
|
9520
|
-
|
|
9521
|
-
|
|
9522
|
-
|
|
9523
|
-
|
|
9524
|
-
|
|
9525
|
-
|
|
9526
|
-
|
|
9527
|
-
|
|
9528
|
-
|
|
9529
|
-
|
|
9568
|
+
var SELECTED_DAY = ".saltCalendarDay-selected:not(.saltCalendarDay-outOfRange)";
|
|
9569
|
+
var useDatePopup = ({
|
|
9570
|
+
onChange,
|
|
9571
|
+
onPopupClose,
|
|
9572
|
+
onPopupOpen,
|
|
9573
|
+
selectedDate
|
|
9574
|
+
}) => {
|
|
9575
|
+
const [date, setDate] = (0, import_react54.useState)(selectedDate);
|
|
9576
|
+
const [, forceUpdate] = (0, import_react54.useState)({});
|
|
9577
|
+
const [isOpen, setIsOpen] = (0, import_react54.useState)(false);
|
|
9578
|
+
const triggererRef = (0, import_react54.useRef)(null);
|
|
9579
|
+
const calendarRef = (0, import_react54.useRef)(null);
|
|
9580
|
+
const visibleMonthRef = (0, import_react54.useRef)(selectedDate);
|
|
9581
|
+
const setVisibleMonth = (0, import_react54.useMemo)(() => {
|
|
9582
|
+
const setValue = (v) => {
|
|
9583
|
+
if (v.toString() !== visibleMonthRef.current.toString()) {
|
|
9584
|
+
visibleMonthRef.current = v;
|
|
9585
|
+
forceUpdate({});
|
|
9586
|
+
}
|
|
9587
|
+
};
|
|
9588
|
+
setValue(selectedDate);
|
|
9589
|
+
return setValue;
|
|
9590
|
+
}, [selectedDate]);
|
|
9591
|
+
const handleOpenChange = (0, import_react54.useCallback)(
|
|
9592
|
+
(open, reason) => {
|
|
9593
|
+
var _a2;
|
|
9594
|
+
setIsOpen(open);
|
|
9595
|
+
if (open) {
|
|
9596
|
+
onPopupOpen == null ? void 0 : onPopupOpen();
|
|
9597
|
+
requestAnimationFrame(() => {
|
|
9598
|
+
var _a3;
|
|
9599
|
+
const el = (_a3 = calendarRef.current) == null ? void 0 : _a3.querySelector(
|
|
9600
|
+
SELECTED_DAY
|
|
9601
|
+
);
|
|
9602
|
+
el == null ? void 0 : el.focus();
|
|
9603
|
+
});
|
|
9604
|
+
} else {
|
|
9605
|
+
if (reason !== "Tab") {
|
|
9606
|
+
(_a2 = triggererRef.current) == null ? void 0 : _a2.focus();
|
|
9607
|
+
}
|
|
9608
|
+
onPopupClose == null ? void 0 : onPopupClose(reason);
|
|
9609
|
+
}
|
|
9610
|
+
},
|
|
9611
|
+
[onPopupClose, onPopupOpen]
|
|
9530
9612
|
);
|
|
9531
|
-
|
|
9532
|
-
|
|
9533
|
-
|
|
9534
|
-
|
|
9535
|
-
|
|
9536
|
-
|
|
9537
|
-
|
|
9538
|
-
|
|
9539
|
-
|
|
9613
|
+
const handleDateSelection = (0, import_react54.useCallback)(
|
|
9614
|
+
(e, date2) => {
|
|
9615
|
+
setDate(date2);
|
|
9616
|
+
console.log(date2.toString());
|
|
9617
|
+
visibleMonthRef.current = date2;
|
|
9618
|
+
handleOpenChange(false, "select");
|
|
9619
|
+
onChange(date2);
|
|
9620
|
+
},
|
|
9621
|
+
[handleOpenChange, onChange]
|
|
9540
9622
|
);
|
|
9541
|
-
const
|
|
9542
|
-
(e) => {
|
|
9543
|
-
|
|
9544
|
-
onBlur == null ? void 0 : onBlur();
|
|
9545
|
-
}
|
|
9623
|
+
const handleVisibleMonthChange = (0, import_react54.useCallback)(
|
|
9624
|
+
(e, date2) => {
|
|
9625
|
+
setVisibleMonth(date2);
|
|
9546
9626
|
},
|
|
9547
|
-
[
|
|
9627
|
+
[setVisibleMonth]
|
|
9548
9628
|
);
|
|
9549
9629
|
return {
|
|
9550
|
-
|
|
9551
|
-
|
|
9552
|
-
|
|
9630
|
+
calendarRef,
|
|
9631
|
+
date,
|
|
9632
|
+
handleOpenChange,
|
|
9633
|
+
isOpen,
|
|
9634
|
+
onSelectedDateChange: handleDateSelection,
|
|
9635
|
+
onVisibleMonthChange: handleVisibleMonthChange,
|
|
9636
|
+
triggererRef,
|
|
9637
|
+
visibleMonth: visibleMonthRef.current
|
|
9553
9638
|
};
|
|
9554
|
-
}
|
|
9639
|
+
};
|
|
9555
9640
|
|
|
9556
|
-
// src/date-
|
|
9641
|
+
// src/date-popup/DatePopup.tsx
|
|
9642
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
9643
|
+
var classBase12 = "vuuDatePopup";
|
|
9644
|
+
var tz = $14e0f24ef4ac5c92$export$aa8b41735afcabd2();
|
|
9645
|
+
var today = $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3(tz);
|
|
9646
|
+
var DatePopup = (0, import_react55.forwardRef)(
|
|
9647
|
+
function DatePopup2({
|
|
9648
|
+
selectedDate,
|
|
9649
|
+
onChange,
|
|
9650
|
+
onPopupClose,
|
|
9651
|
+
onPopupOpen,
|
|
9652
|
+
selectionVariant,
|
|
9653
|
+
"data-embedded": dataEmbedded,
|
|
9654
|
+
...htmlAttributes
|
|
9655
|
+
}, forwardedRef) {
|
|
9656
|
+
const {
|
|
9657
|
+
calendarRef,
|
|
9658
|
+
date,
|
|
9659
|
+
isOpen,
|
|
9660
|
+
onSelectedDateChange,
|
|
9661
|
+
onVisibleMonthChange,
|
|
9662
|
+
handleOpenChange,
|
|
9663
|
+
triggererRef,
|
|
9664
|
+
visibleMonth
|
|
9665
|
+
} = useDatePopup({
|
|
9666
|
+
onChange,
|
|
9667
|
+
onPopupClose,
|
|
9668
|
+
onPopupOpen,
|
|
9669
|
+
selectedDate: selectedDate || today,
|
|
9670
|
+
selectionVariant
|
|
9671
|
+
});
|
|
9672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
9673
|
+
DropdownBase,
|
|
9674
|
+
{
|
|
9675
|
+
...htmlAttributes,
|
|
9676
|
+
className: classBase12,
|
|
9677
|
+
isOpen,
|
|
9678
|
+
placement: "below",
|
|
9679
|
+
onOpenChange: handleOpenChange,
|
|
9680
|
+
children: [
|
|
9681
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
9682
|
+
IconButton,
|
|
9683
|
+
{
|
|
9684
|
+
"data-embedded": dataEmbedded,
|
|
9685
|
+
icon: "date",
|
|
9686
|
+
ref: (0, import_core25.useForkRef)(forwardedRef, triggererRef),
|
|
9687
|
+
variant: "secondary",
|
|
9688
|
+
className: (0, import_clsx20.default)({ "saltButton-active": isOpen })
|
|
9689
|
+
}
|
|
9690
|
+
),
|
|
9691
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
9692
|
+
Calendar,
|
|
9693
|
+
{
|
|
9694
|
+
visibleMonth,
|
|
9695
|
+
ref: calendarRef,
|
|
9696
|
+
selectedDate: date,
|
|
9697
|
+
selectionVariant: "default",
|
|
9698
|
+
onSelectedDateChange,
|
|
9699
|
+
onVisibleMonthChange,
|
|
9700
|
+
className: `${classBase12}-calendar`
|
|
9701
|
+
}
|
|
9702
|
+
)
|
|
9703
|
+
]
|
|
9704
|
+
}
|
|
9705
|
+
);
|
|
9706
|
+
}
|
|
9707
|
+
);
|
|
9708
|
+
|
|
9709
|
+
// src/date-input/useDatePicker.ts
|
|
9557
9710
|
var import_react56 = require("react");
|
|
9711
|
+
function useDatePicker({ onBlur }) {
|
|
9712
|
+
const handleOnBlur = (0, import_react56.useCallback)(
|
|
9713
|
+
(e) => {
|
|
9714
|
+
if (!e.currentTarget.contains(e.relatedTarget)) {
|
|
9715
|
+
onBlur == null ? void 0 : onBlur();
|
|
9716
|
+
}
|
|
9717
|
+
},
|
|
9718
|
+
[onBlur]
|
|
9719
|
+
);
|
|
9720
|
+
return {
|
|
9721
|
+
handleOnBlur
|
|
9722
|
+
};
|
|
9723
|
+
}
|
|
9724
|
+
|
|
9725
|
+
// src/date-input/DateInput.tsx
|
|
9726
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
9727
|
+
var classBase13 = "vuuDateInput";
|
|
9728
|
+
var DateInput = ({
|
|
9729
|
+
selectedDate,
|
|
9730
|
+
onChange,
|
|
9731
|
+
onBlur,
|
|
9732
|
+
className,
|
|
9733
|
+
...htmlAttributes
|
|
9734
|
+
}) => {
|
|
9735
|
+
var _a2;
|
|
9736
|
+
const { handleOnBlur } = useDatePicker({ onBlur });
|
|
9737
|
+
const popupRef = (0, import_react57.useRef)(null);
|
|
9738
|
+
const onInputChange = (0, import_react57.useCallback)(
|
|
9739
|
+
(e) => {
|
|
9740
|
+
const v = e.target.value;
|
|
9741
|
+
if (v === "")
|
|
9742
|
+
return;
|
|
9743
|
+
else
|
|
9744
|
+
onChange((0, import_vuu_utils18.toCalendarDate)(new Date(v)));
|
|
9745
|
+
},
|
|
9746
|
+
[onChange]
|
|
9747
|
+
);
|
|
9748
|
+
const onKeyDown = (0, import_react57.useCallback)((e) => {
|
|
9749
|
+
if (e.key === "Tab" && !e.shiftKey) {
|
|
9750
|
+
console.log({ button: popupRef.current });
|
|
9751
|
+
requestAnimationFrame(() => {
|
|
9752
|
+
var _a3;
|
|
9753
|
+
(_a3 = popupRef.current) == null ? void 0 : _a3.focus();
|
|
9754
|
+
});
|
|
9755
|
+
}
|
|
9756
|
+
}, []);
|
|
9757
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
9758
|
+
"div",
|
|
9759
|
+
{
|
|
9760
|
+
...htmlAttributes,
|
|
9761
|
+
className: (0, import_clsx21.clsx)(classBase13, className),
|
|
9762
|
+
onBlur: handleOnBlur,
|
|
9763
|
+
children: [
|
|
9764
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
9765
|
+
"input",
|
|
9766
|
+
{
|
|
9767
|
+
"aria-label": "date-input",
|
|
9768
|
+
className: (0, import_clsx21.clsx)("saltInput-input", classBase13, className),
|
|
9769
|
+
type: "date",
|
|
9770
|
+
value: (_a2 = selectedDate == null ? void 0 : selectedDate.toString()) != null ? _a2 : "",
|
|
9771
|
+
onChange: onInputChange,
|
|
9772
|
+
onKeyDown,
|
|
9773
|
+
max: "9999-12-31"
|
|
9774
|
+
}
|
|
9775
|
+
),
|
|
9776
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
9777
|
+
DatePopup,
|
|
9778
|
+
{
|
|
9779
|
+
"data-embedded": true,
|
|
9780
|
+
onBlur,
|
|
9781
|
+
onChange,
|
|
9782
|
+
ref: popupRef,
|
|
9783
|
+
selectedDate,
|
|
9784
|
+
selectionVariant: "default"
|
|
9785
|
+
}
|
|
9786
|
+
)
|
|
9787
|
+
]
|
|
9788
|
+
}
|
|
9789
|
+
);
|
|
9790
|
+
};
|
|
9791
|
+
|
|
9792
|
+
// src/date-input/DateRangeInput.tsx
|
|
9793
|
+
var import_vuu_utils19 = require("@vuu-ui/vuu-utils");
|
|
9794
|
+
var import_clsx22 = __toESM(require("clsx"));
|
|
9795
|
+
var import_react58 = require("react");
|
|
9796
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
9797
|
+
var classBase14 = "vuuDateInput";
|
|
9798
|
+
var DateRangeInput = ({
|
|
9799
|
+
selectedDateRange,
|
|
9800
|
+
onChange,
|
|
9801
|
+
className,
|
|
9802
|
+
onBlur
|
|
9803
|
+
}) => {
|
|
9804
|
+
var _a2, _b, _c, _d;
|
|
9805
|
+
const { handleOnBlur } = useDatePicker({ onBlur });
|
|
9806
|
+
const getHandleInputChange = (0, import_react58.useCallback)(
|
|
9807
|
+
(k) => (e) => {
|
|
9808
|
+
const v = e.target.value;
|
|
9809
|
+
onChange({ ...selectedDateRange, [k]: (0, import_vuu_utils19.toCalendarDate)(new Date(v)) });
|
|
9810
|
+
},
|
|
9811
|
+
[selectedDateRange, onChange]
|
|
9812
|
+
);
|
|
9813
|
+
const handleDateInputChange = (0, import_react58.useCallback)(
|
|
9814
|
+
(dateRange) => {
|
|
9815
|
+
console.log("date range change", {
|
|
9816
|
+
dateRange
|
|
9817
|
+
});
|
|
9818
|
+
},
|
|
9819
|
+
[]
|
|
9820
|
+
);
|
|
9821
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
9822
|
+
"div",
|
|
9823
|
+
{
|
|
9824
|
+
className: (0, import_clsx22.default)("saltInput saltInput-primary", classBase14, className),
|
|
9825
|
+
onBlur: handleOnBlur,
|
|
9826
|
+
children: [
|
|
9827
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
9828
|
+
"input",
|
|
9829
|
+
{
|
|
9830
|
+
className: (0, import_clsx22.default)("saltInput-input", classBase14, className),
|
|
9831
|
+
type: "date",
|
|
9832
|
+
value: (_b = (_a2 = selectedDateRange == null ? void 0 : selectedDateRange["startDate"]) == null ? void 0 : _a2.toString()) != null ? _b : "",
|
|
9833
|
+
onChange: getHandleInputChange("startDate"),
|
|
9834
|
+
"aria-label": "date-input",
|
|
9835
|
+
max: "9999-12-31"
|
|
9836
|
+
}
|
|
9837
|
+
),
|
|
9838
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: "\u2014" }),
|
|
9839
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
9840
|
+
"input",
|
|
9841
|
+
{
|
|
9842
|
+
className: (0, import_clsx22.default)("saltInput-input", classBase14, className),
|
|
9843
|
+
type: "date",
|
|
9844
|
+
value: (_d = (_c = selectedDateRange == null ? void 0 : selectedDateRange["endDate"]) == null ? void 0 : _c.toString()) != null ? _d : "",
|
|
9845
|
+
onChange: getHandleInputChange("endDate"),
|
|
9846
|
+
"aria-label": "date-input",
|
|
9847
|
+
max: "9999-12-31"
|
|
9848
|
+
}
|
|
9849
|
+
),
|
|
9850
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
9851
|
+
DatePopup,
|
|
9852
|
+
{
|
|
9853
|
+
onBlur,
|
|
9854
|
+
onChange: handleDateInputChange,
|
|
9855
|
+
selectedDate: selectedDateRange == null ? void 0 : selectedDateRange["startDate"],
|
|
9856
|
+
selectionVariant: "range"
|
|
9857
|
+
}
|
|
9858
|
+
)
|
|
9859
|
+
]
|
|
9860
|
+
}
|
|
9861
|
+
);
|
|
9862
|
+
};
|
|
9863
|
+
|
|
9864
|
+
// src/date-picker/DatePicker.tsx
|
|
9865
|
+
var import_react63 = require("react");
|
|
9866
|
+
var import_clsx25 = require("clsx");
|
|
9867
|
+
|
|
9868
|
+
// src/date-picker/input/DatePickerInput.tsx
|
|
9869
|
+
var import_react59 = require("react");
|
|
9870
|
+
var import_vuu_utils20 = require("@vuu-ui/vuu-utils");
|
|
9871
|
+
var import_clsx23 = require("clsx");
|
|
9872
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
9873
|
+
var baseClass2 = "vuuDatePickerInput";
|
|
9874
|
+
var DatePickerInput = (props) => {
|
|
9875
|
+
var _a2;
|
|
9876
|
+
const { value, onChange, className } = props;
|
|
9877
|
+
const onInputChange = (0, import_react59.useCallback)(
|
|
9878
|
+
(e) => {
|
|
9879
|
+
const v = e.target.value;
|
|
9880
|
+
if (v === "")
|
|
9881
|
+
return;
|
|
9882
|
+
else
|
|
9883
|
+
onChange((0, import_vuu_utils20.toCalendarDate)(new Date(v)));
|
|
9884
|
+
},
|
|
9885
|
+
[onChange]
|
|
9886
|
+
);
|
|
9887
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
9888
|
+
"input",
|
|
9889
|
+
{
|
|
9890
|
+
className: (0, import_clsx23.clsx)("saltInput-input", baseClass2, className),
|
|
9891
|
+
type: "date",
|
|
9892
|
+
value: (_a2 = value == null ? void 0 : value.toString()) != null ? _a2 : "",
|
|
9893
|
+
onChange: onInputChange,
|
|
9894
|
+
"aria-label": "date-input",
|
|
9895
|
+
max: "9999-12-31"
|
|
9896
|
+
}
|
|
9897
|
+
);
|
|
9898
|
+
};
|
|
9899
|
+
|
|
9900
|
+
// src/date-picker/internal/CalendarIconButton.tsx
|
|
9901
|
+
var import_core26 = require("@salt-ds/core");
|
|
9902
|
+
var import_icons2 = require("@salt-ds/icons");
|
|
9903
|
+
var import_react60 = require("react");
|
|
9904
|
+
var import_clsx24 = __toESM(require("clsx"));
|
|
9905
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
9906
|
+
var baseClass3 = "vuuDatePicker-calendarIconButton";
|
|
9907
|
+
var CalendarIconButton = (0, import_react60.forwardRef)(function CalendarIconButton2({ className, ...rest }, ref) {
|
|
9908
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
9909
|
+
import_core26.Button,
|
|
9910
|
+
{
|
|
9911
|
+
className: (0, import_clsx24.default)(baseClass3, className),
|
|
9912
|
+
variant: "secondary",
|
|
9913
|
+
"aria-label": "calendar-icon-button",
|
|
9914
|
+
ref,
|
|
9915
|
+
...rest,
|
|
9916
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_icons2.CalendarIcon, {})
|
|
9917
|
+
}
|
|
9918
|
+
);
|
|
9919
|
+
});
|
|
9920
|
+
|
|
9921
|
+
// src/date-picker/useBaseDatePicker.ts
|
|
9922
|
+
var import_react61 = require("react");
|
|
9923
|
+
function useBaseDatePicker(props) {
|
|
9924
|
+
var _a2;
|
|
9925
|
+
const { onBlur } = props;
|
|
9926
|
+
const [visibleMonth, setVisibleMonth] = (0, import_react61.useState)(
|
|
9927
|
+
props.variant === "default" ? props.selectedDate : (_a2 = props.selectedDate) == null ? void 0 : _a2.startDate
|
|
9928
|
+
);
|
|
9929
|
+
const handleOnBlur = (0, import_react61.useCallback)(
|
|
9930
|
+
(e) => {
|
|
9931
|
+
if (!e.currentTarget.contains(e.relatedTarget)) {
|
|
9932
|
+
onBlur == null ? void 0 : onBlur();
|
|
9933
|
+
}
|
|
9934
|
+
},
|
|
9935
|
+
[onBlur]
|
|
9936
|
+
);
|
|
9937
|
+
return {
|
|
9938
|
+
handleOnBlur,
|
|
9939
|
+
visibleMonth,
|
|
9940
|
+
handleVisibleMonthChange: setVisibleMonth
|
|
9941
|
+
};
|
|
9942
|
+
}
|
|
9943
|
+
|
|
9944
|
+
// src/date-picker/useBaseDatePickerDropdown.ts
|
|
9945
|
+
var import_react62 = require("react");
|
|
9558
9946
|
function useBaseDatePickerDropdown({
|
|
9559
9947
|
onVisibleMonthChange,
|
|
9560
9948
|
onSelectedDateChange,
|
|
9561
9949
|
shouldCloseOnSelectionChange
|
|
9562
9950
|
}) {
|
|
9563
|
-
const [isOpen, setIsOpen] = (0,
|
|
9564
|
-
const triggererRef = (0,
|
|
9565
|
-
const handleDateSelection = (0,
|
|
9951
|
+
const [isOpen, setIsOpen] = (0, import_react62.useState)(false);
|
|
9952
|
+
const triggererRef = (0, import_react62.useRef)(null);
|
|
9953
|
+
const handleDateSelection = (0, import_react62.useCallback)(
|
|
9566
9954
|
(_, d) => {
|
|
9567
9955
|
var _a2;
|
|
9568
9956
|
onSelectedDateChange(d);
|
|
@@ -9572,7 +9960,7 @@ function useBaseDatePickerDropdown({
|
|
|
9572
9960
|
},
|
|
9573
9961
|
[onSelectedDateChange, shouldCloseOnSelectionChange]
|
|
9574
9962
|
);
|
|
9575
|
-
const handleVisibleMonthChange = (0,
|
|
9963
|
+
const handleVisibleMonthChange = (0, import_react62.useCallback)(
|
|
9576
9964
|
(_, d) => {
|
|
9577
9965
|
var _a2;
|
|
9578
9966
|
onVisibleMonthChange(d);
|
|
@@ -9590,26 +9978,26 @@ function useBaseDatePickerDropdown({
|
|
|
9590
9978
|
}
|
|
9591
9979
|
|
|
9592
9980
|
// src/date-picker/DatePicker.tsx
|
|
9593
|
-
var
|
|
9981
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
9594
9982
|
var baseClass4 = "vuuDatePicker";
|
|
9595
9983
|
var DatePicker = (props) => {
|
|
9596
9984
|
const { selectedDate, onSelectedDateChange, onBlur, className } = props;
|
|
9597
9985
|
const { visibleMonth, handleVisibleMonthChange, handleOnBlur } = useBaseDatePicker({ variant: "default", selectedDate, onBlur });
|
|
9598
|
-
const handleInputChange = (0,
|
|
9986
|
+
const handleInputChange = (0, import_react63.useCallback)(
|
|
9599
9987
|
(d) => {
|
|
9600
9988
|
onSelectedDateChange(d);
|
|
9601
9989
|
handleVisibleMonthChange(d);
|
|
9602
9990
|
},
|
|
9603
9991
|
[onSelectedDateChange, handleVisibleMonthChange]
|
|
9604
9992
|
);
|
|
9605
|
-
return /* @__PURE__ */ (0,
|
|
9993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
9606
9994
|
"div",
|
|
9607
9995
|
{
|
|
9608
|
-
className: (0,
|
|
9996
|
+
className: (0, import_clsx25.clsx)("saltInput saltInput-primary", baseClass4, className),
|
|
9609
9997
|
onBlur: handleOnBlur,
|
|
9610
9998
|
children: [
|
|
9611
|
-
/* @__PURE__ */ (0,
|
|
9612
|
-
/* @__PURE__ */ (0,
|
|
9999
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DatePickerInput, { value: selectedDate, onChange: handleInputChange }),
|
|
10000
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
9613
10001
|
DatePickerDropdown,
|
|
9614
10002
|
{
|
|
9615
10003
|
visibleMonth,
|
|
@@ -9629,7 +10017,7 @@ var DatePickerDropdown = (props) => {
|
|
|
9629
10017
|
className,
|
|
9630
10018
|
...rest
|
|
9631
10019
|
} = props;
|
|
9632
|
-
const shouldCloseOnSelectionChange = (0,
|
|
10020
|
+
const shouldCloseOnSelectionChange = (0, import_react63.useCallback)(
|
|
9633
10021
|
() => !!closeOnSelection,
|
|
9634
10022
|
[closeOnSelection]
|
|
9635
10023
|
);
|
|
@@ -9644,8 +10032,8 @@ var DatePickerDropdown = (props) => {
|
|
|
9644
10032
|
onSelectedDateChange,
|
|
9645
10033
|
shouldCloseOnSelectionChange
|
|
9646
10034
|
});
|
|
9647
|
-
const defaultSelectedDate = (0,
|
|
9648
|
-
return /* @__PURE__ */ (0,
|
|
10035
|
+
const defaultSelectedDate = (0, import_react63.useMemo)(() => $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3($14e0f24ef4ac5c92$export$aa8b41735afcabd2()), []);
|
|
10036
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
9649
10037
|
DropdownBase,
|
|
9650
10038
|
{
|
|
9651
10039
|
placement: "below",
|
|
@@ -9653,8 +10041,8 @@ var DatePickerDropdown = (props) => {
|
|
|
9653
10041
|
onOpenChange: handleOpenChange,
|
|
9654
10042
|
className,
|
|
9655
10043
|
children: [
|
|
9656
|
-
/* @__PURE__ */ (0,
|
|
9657
|
-
/* @__PURE__ */ (0,
|
|
10044
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CalendarIconButton, { ref: triggererRef }),
|
|
10045
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
9658
10046
|
Calendar,
|
|
9659
10047
|
{
|
|
9660
10048
|
selectionVariant: "default",
|
|
@@ -9671,32 +10059,32 @@ var DatePickerDropdown = (props) => {
|
|
|
9671
10059
|
};
|
|
9672
10060
|
|
|
9673
10061
|
// src/date-picker/DateRangePicker.tsx
|
|
9674
|
-
var
|
|
9675
|
-
var
|
|
10062
|
+
var import_react65 = require("react");
|
|
10063
|
+
var import_clsx27 = require("clsx");
|
|
9676
10064
|
|
|
9677
10065
|
// src/date-picker/input/DateRangePickerInput.tsx
|
|
9678
|
-
var
|
|
9679
|
-
var
|
|
9680
|
-
var
|
|
10066
|
+
var import_react64 = require("react");
|
|
10067
|
+
var import_clsx26 = require("clsx");
|
|
10068
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
9681
10069
|
var baseClass5 = "vuuDateRangePickerInput";
|
|
9682
10070
|
var DateRangePickerInput = (props) => {
|
|
9683
10071
|
const { value, onChange, className } = props;
|
|
9684
|
-
const getHandleInputChange = (0,
|
|
10072
|
+
const getHandleInputChange = (0, import_react64.useCallback)(
|
|
9685
10073
|
(k) => (d) => {
|
|
9686
10074
|
onChange({ ...value, [k]: d });
|
|
9687
10075
|
},
|
|
9688
10076
|
[value, onChange]
|
|
9689
10077
|
);
|
|
9690
|
-
return /* @__PURE__ */ (0,
|
|
9691
|
-
/* @__PURE__ */ (0,
|
|
10078
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: (0, import_clsx26.clsx)(baseClass5, className), children: [
|
|
10079
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
9692
10080
|
DatePickerInput,
|
|
9693
10081
|
{
|
|
9694
10082
|
value: value == null ? void 0 : value["startDate"],
|
|
9695
10083
|
onChange: getHandleInputChange("startDate")
|
|
9696
10084
|
}
|
|
9697
10085
|
),
|
|
9698
|
-
/* @__PURE__ */ (0,
|
|
9699
|
-
/* @__PURE__ */ (0,
|
|
10086
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: "\u2014" }),
|
|
10087
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
9700
10088
|
DatePickerInput,
|
|
9701
10089
|
{
|
|
9702
10090
|
value: value == null ? void 0 : value["endDate"],
|
|
@@ -9707,12 +10095,12 @@ var DateRangePickerInput = (props) => {
|
|
|
9707
10095
|
};
|
|
9708
10096
|
|
|
9709
10097
|
// src/date-picker/DateRangePicker.tsx
|
|
9710
|
-
var
|
|
10098
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
9711
10099
|
var baseClass6 = "vuuDatePicker";
|
|
9712
10100
|
var DateRangePicker = (props) => {
|
|
9713
10101
|
const { selectedDate, onSelectedDateChange, className, onBlur } = props;
|
|
9714
10102
|
const { visibleMonth, handleVisibleMonthChange, handleOnBlur } = useBaseDatePicker({ variant: "range", selectedDate, onBlur });
|
|
9715
|
-
const handleInputChange = (0,
|
|
10103
|
+
const handleInputChange = (0, import_react65.useCallback)(
|
|
9716
10104
|
(r) => {
|
|
9717
10105
|
var _a2;
|
|
9718
10106
|
onSelectedDateChange(r);
|
|
@@ -9720,14 +10108,14 @@ var DateRangePicker = (props) => {
|
|
|
9720
10108
|
},
|
|
9721
10109
|
[onSelectedDateChange, handleVisibleMonthChange]
|
|
9722
10110
|
);
|
|
9723
|
-
return /* @__PURE__ */ (0,
|
|
10111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
9724
10112
|
"div",
|
|
9725
10113
|
{
|
|
9726
|
-
className: (0,
|
|
10114
|
+
className: (0, import_clsx27.clsx)("saltInput saltInput-primary", baseClass6, className),
|
|
9727
10115
|
onBlur: handleOnBlur,
|
|
9728
10116
|
children: [
|
|
9729
|
-
/* @__PURE__ */ (0,
|
|
9730
|
-
/* @__PURE__ */ (0,
|
|
10117
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DateRangePickerInput, { value: selectedDate, onChange: handleInputChange }),
|
|
10118
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
9731
10119
|
DateRangePickerDropdown,
|
|
9732
10120
|
{
|
|
9733
10121
|
...props,
|
|
@@ -9747,7 +10135,7 @@ var DateRangePickerDropdown = (props) => {
|
|
|
9747
10135
|
className,
|
|
9748
10136
|
...rest
|
|
9749
10137
|
} = props;
|
|
9750
|
-
const shouldCloseOnSelectionChange = (0,
|
|
10138
|
+
const shouldCloseOnSelectionChange = (0, import_react65.useCallback)(
|
|
9751
10139
|
(r) => !!(closeOnSelection && r.endDate),
|
|
9752
10140
|
[closeOnSelection]
|
|
9753
10141
|
);
|
|
@@ -9762,11 +10150,11 @@ var DateRangePickerDropdown = (props) => {
|
|
|
9762
10150
|
onSelectedDateChange,
|
|
9763
10151
|
shouldCloseOnSelectionChange
|
|
9764
10152
|
});
|
|
9765
|
-
const defaultSelectedDate = (0,
|
|
10153
|
+
const defaultSelectedDate = (0, import_react65.useMemo)(
|
|
9766
10154
|
() => ({ startDate: $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3($14e0f24ef4ac5c92$export$aa8b41735afcabd2()) }),
|
|
9767
10155
|
[]
|
|
9768
10156
|
);
|
|
9769
|
-
return /* @__PURE__ */ (0,
|
|
10157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
9770
10158
|
DropdownBase,
|
|
9771
10159
|
{
|
|
9772
10160
|
placement: "below",
|
|
@@ -9774,8 +10162,8 @@ var DateRangePickerDropdown = (props) => {
|
|
|
9774
10162
|
className,
|
|
9775
10163
|
onOpenChange: handleOpenChange,
|
|
9776
10164
|
children: [
|
|
9777
|
-
/* @__PURE__ */ (0,
|
|
9778
|
-
/* @__PURE__ */ (0,
|
|
10165
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CalendarIconButton, { ref: triggererRef }),
|
|
10166
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
9779
10167
|
Calendar,
|
|
9780
10168
|
{
|
|
9781
10169
|
selectionVariant: "range",
|
|
@@ -9792,12 +10180,12 @@ var DateRangePickerDropdown = (props) => {
|
|
|
9792
10180
|
};
|
|
9793
10181
|
|
|
9794
10182
|
// src/editable/editable-utils.ts
|
|
9795
|
-
var
|
|
10183
|
+
var import_vuu_utils21 = require("@vuu-ui/vuu-utils");
|
|
9796
10184
|
var buildValidationChecker = (rules) => (value) => applyRules(rules, value);
|
|
9797
10185
|
function applyRules(rules, value) {
|
|
9798
10186
|
let result = void 0;
|
|
9799
10187
|
for (const rule of rules) {
|
|
9800
|
-
const editRuleValidator = (0,
|
|
10188
|
+
const editRuleValidator = (0, import_vuu_utils21.getEditRuleValidator)(rule.name);
|
|
9801
10189
|
if (editRuleValidator) {
|
|
9802
10190
|
const ruleResult = editRuleValidator(rule, value);
|
|
9803
10191
|
switch (ruleResult) {
|
|
@@ -9825,9 +10213,9 @@ function applyRules(rules, value) {
|
|
|
9825
10213
|
}
|
|
9826
10214
|
|
|
9827
10215
|
// src/editable/useEditableText.ts
|
|
9828
|
-
var
|
|
9829
|
-
var
|
|
9830
|
-
var
|
|
10216
|
+
var import_vuu_utils22 = require("@vuu-ui/vuu-utils");
|
|
10217
|
+
var import_vuu_utils23 = require("@vuu-ui/vuu-utils");
|
|
10218
|
+
var import_react66 = require("react");
|
|
9831
10219
|
var WarnCommit = () => {
|
|
9832
10220
|
console.warn(
|
|
9833
10221
|
"onCommit handler has not been provided to InputCell cell renderer"
|
|
@@ -9840,15 +10228,15 @@ var useEditableText = ({
|
|
|
9840
10228
|
onCommit,
|
|
9841
10229
|
type
|
|
9842
10230
|
}) => {
|
|
9843
|
-
const [message, setMessage] = (0,
|
|
9844
|
-
const [value, setValue] = (0,
|
|
9845
|
-
const initialValueRef = (0,
|
|
9846
|
-
const isDirtyRef = (0,
|
|
9847
|
-
const hasCommittedRef = (0,
|
|
9848
|
-
(0,
|
|
10231
|
+
const [message, setMessage] = (0, import_react66.useState)();
|
|
10232
|
+
const [value, setValue] = (0, import_react66.useState)(initialValue);
|
|
10233
|
+
const initialValueRef = (0, import_react66.useRef)(initialValue);
|
|
10234
|
+
const isDirtyRef = (0, import_react66.useRef)(false);
|
|
10235
|
+
const hasCommittedRef = (0, import_react66.useRef)(false);
|
|
10236
|
+
(0, import_vuu_utils22.useLayoutEffectSkipFirst)(() => {
|
|
9849
10237
|
setValue(initialValue);
|
|
9850
10238
|
}, [initialValue]);
|
|
9851
|
-
const commit = (0,
|
|
10239
|
+
const commit = (0, import_react66.useCallback)(
|
|
9852
10240
|
(target) => {
|
|
9853
10241
|
if (isDirtyRef.current) {
|
|
9854
10242
|
hasCommittedRef.current = true;
|
|
@@ -9861,20 +10249,20 @@ var useEditableText = ({
|
|
|
9861
10249
|
onCommit(value).then((response) => {
|
|
9862
10250
|
if (response === true) {
|
|
9863
10251
|
isDirtyRef.current = false;
|
|
9864
|
-
(0,
|
|
10252
|
+
(0, import_vuu_utils23.dispatchCustomEvent)(target, "vuu-commit");
|
|
9865
10253
|
} else {
|
|
9866
10254
|
setMessage(response);
|
|
9867
10255
|
}
|
|
9868
10256
|
});
|
|
9869
10257
|
}
|
|
9870
10258
|
} else {
|
|
9871
|
-
(0,
|
|
10259
|
+
(0, import_vuu_utils23.dispatchCustomEvent)(target, "vuu-commit");
|
|
9872
10260
|
hasCommittedRef.current = false;
|
|
9873
10261
|
}
|
|
9874
10262
|
},
|
|
9875
10263
|
[clientSideEditValidationCheck, onCommit, value]
|
|
9876
10264
|
);
|
|
9877
|
-
const handleKeyDown = (0,
|
|
10265
|
+
const handleKeyDown = (0, import_react66.useCallback)(
|
|
9878
10266
|
(evt) => {
|
|
9879
10267
|
if (evt.key === "Enter") {
|
|
9880
10268
|
commit(evt.target);
|
|
@@ -9890,7 +10278,7 @@ var useEditableText = ({
|
|
|
9890
10278
|
},
|
|
9891
10279
|
[commit]
|
|
9892
10280
|
);
|
|
9893
|
-
const handleBlur = (0,
|
|
10281
|
+
const handleBlur = (0, import_react66.useCallback)(
|
|
9894
10282
|
(evt) => {
|
|
9895
10283
|
if (isDirtyRef.current) {
|
|
9896
10284
|
commit(evt.target);
|
|
@@ -9898,7 +10286,7 @@ var useEditableText = ({
|
|
|
9898
10286
|
},
|
|
9899
10287
|
[commit]
|
|
9900
10288
|
);
|
|
9901
|
-
const handleChange = (0,
|
|
10289
|
+
const handleChange = (0, import_react66.useCallback)(
|
|
9902
10290
|
(evt) => {
|
|
9903
10291
|
let typedValue = evt.target.value;
|
|
9904
10292
|
if (type === "number" && !isNaN(parseFloat(typedValue))) {
|
|
@@ -9927,12 +10315,12 @@ var useEditableText = ({
|
|
|
9927
10315
|
};
|
|
9928
10316
|
|
|
9929
10317
|
// src/editable-label/EditableLabel.tsx
|
|
9930
|
-
var
|
|
9931
|
-
var
|
|
9932
|
-
var
|
|
9933
|
-
var
|
|
9934
|
-
var
|
|
9935
|
-
var EditableLabel = (0,
|
|
10318
|
+
var import_clsx28 = __toESM(require("clsx"));
|
|
10319
|
+
var import_react67 = require("react");
|
|
10320
|
+
var import_core27 = require("@salt-ds/core");
|
|
10321
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
10322
|
+
var classBase15 = "vuuEditableLabel";
|
|
10323
|
+
var EditableLabel = (0, import_react67.forwardRef)(function EditableLabel2({
|
|
9936
10324
|
className: classNameProp,
|
|
9937
10325
|
defaultEditing,
|
|
9938
10326
|
defaultValue,
|
|
@@ -9943,28 +10331,28 @@ var EditableLabel = (0, import_react61.forwardRef)(function EditableLabel2({
|
|
|
9943
10331
|
value: valueProp,
|
|
9944
10332
|
...restProps
|
|
9945
10333
|
}, forwardedRef) {
|
|
9946
|
-
const inputRef = (0,
|
|
9947
|
-
const editingRef = (0,
|
|
9948
|
-
const [value, setValue] = (0,
|
|
10334
|
+
const inputRef = (0, import_react67.useRef)(null);
|
|
10335
|
+
const editingRef = (0, import_react67.useRef)(false);
|
|
10336
|
+
const [value, setValue] = (0, import_core27.useControlled)({
|
|
9949
10337
|
controlled: valueProp,
|
|
9950
10338
|
default: defaultValue != null ? defaultValue : "",
|
|
9951
10339
|
name: "EditableLabel",
|
|
9952
10340
|
state: "value"
|
|
9953
10341
|
});
|
|
9954
|
-
const [editing, _setEditing] = (0,
|
|
10342
|
+
const [editing, _setEditing] = (0, import_core27.useControlled)({
|
|
9955
10343
|
controlled: editingProp,
|
|
9956
10344
|
default: defaultEditing != null ? defaultEditing : false,
|
|
9957
10345
|
name: "EditableLabel",
|
|
9958
10346
|
state: "editing"
|
|
9959
10347
|
});
|
|
9960
|
-
const setEditing = (0,
|
|
10348
|
+
const setEditing = (0, import_react67.useCallback)(
|
|
9961
10349
|
(value2) => {
|
|
9962
10350
|
_setEditing(editingRef.current = value2);
|
|
9963
10351
|
},
|
|
9964
10352
|
[_setEditing]
|
|
9965
10353
|
);
|
|
9966
|
-
const initialValue = (0,
|
|
9967
|
-
(0,
|
|
10354
|
+
const initialValue = (0, import_react67.useRef)(value);
|
|
10355
|
+
(0, import_react67.useLayoutEffect)(() => {
|
|
9968
10356
|
if (editing) {
|
|
9969
10357
|
if (inputRef.current !== null) {
|
|
9970
10358
|
inputRef.current.select();
|
|
@@ -9972,7 +10360,7 @@ var EditableLabel = (0, import_react61.forwardRef)(function EditableLabel2({
|
|
|
9972
10360
|
}
|
|
9973
10361
|
}
|
|
9974
10362
|
}, [editing, inputRef]);
|
|
9975
|
-
const enterEditMode = (0,
|
|
10363
|
+
const enterEditMode = (0, import_react67.useCallback)(() => {
|
|
9976
10364
|
setEditing(true);
|
|
9977
10365
|
onEnterEditMode && onEnterEditMode();
|
|
9978
10366
|
}, [onEnterEditMode, setEditing]);
|
|
@@ -10014,10 +10402,10 @@ var EditableLabel = (0, import_react61.forwardRef)(function EditableLabel2({
|
|
|
10014
10402
|
exitEditMode({ cancelEdit: true });
|
|
10015
10403
|
}
|
|
10016
10404
|
};
|
|
10017
|
-
const className = (0,
|
|
10018
|
-
[`${
|
|
10405
|
+
const className = (0, import_clsx28.default)(classBase15, classNameProp, {
|
|
10406
|
+
[`${classBase15}-editing`]: editing
|
|
10019
10407
|
});
|
|
10020
|
-
return /* @__PURE__ */ (0,
|
|
10408
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
10021
10409
|
"div",
|
|
10022
10410
|
{
|
|
10023
10411
|
...restProps,
|
|
@@ -10025,10 +10413,10 @@ var EditableLabel = (0, import_react61.forwardRef)(function EditableLabel2({
|
|
|
10025
10413
|
onDoubleClick: handleDoubleClick,
|
|
10026
10414
|
"data-text": value,
|
|
10027
10415
|
ref: forwardedRef,
|
|
10028
|
-
children: editing ? /* @__PURE__ */ (0,
|
|
10029
|
-
|
|
10416
|
+
children: editing ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
10417
|
+
import_core27.Input,
|
|
10030
10418
|
{
|
|
10031
|
-
inputProps: { className: `${
|
|
10419
|
+
inputProps: { className: `${classBase15}-input`, spellCheck: false },
|
|
10032
10420
|
value,
|
|
10033
10421
|
onBlur: handleBlur,
|
|
10034
10422
|
onChange: handleChange,
|
|
@@ -10038,27 +10426,27 @@ var EditableLabel = (0, import_react61.forwardRef)(function EditableLabel2({
|
|
|
10038
10426
|
textAlign: "left",
|
|
10039
10427
|
variant: "secondary"
|
|
10040
10428
|
}
|
|
10041
|
-
) : /* @__PURE__ */ (0,
|
|
10429
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: `${classBase15}-label`, children: value })
|
|
10042
10430
|
}
|
|
10043
10431
|
);
|
|
10044
10432
|
});
|
|
10045
10433
|
|
|
10046
10434
|
// src/expando-input/ExpandoInput.tsx
|
|
10047
|
-
var
|
|
10048
|
-
var
|
|
10435
|
+
var import_clsx30 = __toESM(require("clsx"));
|
|
10436
|
+
var import_react69 = require("react");
|
|
10049
10437
|
|
|
10050
10438
|
// src/vuu-input/VuuInput.tsx
|
|
10051
10439
|
var import_vuu_popups4 = require("@vuu-ui/vuu-popups");
|
|
10052
|
-
var
|
|
10053
|
-
var
|
|
10054
|
-
var
|
|
10055
|
-
var
|
|
10056
|
-
var
|
|
10057
|
-
var
|
|
10440
|
+
var import_vuu_utils24 = require("@vuu-ui/vuu-utils");
|
|
10441
|
+
var import_core28 = require("@salt-ds/core");
|
|
10442
|
+
var import_clsx29 = __toESM(require("clsx"));
|
|
10443
|
+
var import_react68 = require("react");
|
|
10444
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
10445
|
+
var classBase16 = "vuuInput";
|
|
10058
10446
|
var constantInputProps = {
|
|
10059
10447
|
autoComplete: "off"
|
|
10060
10448
|
};
|
|
10061
|
-
var VuuInput = (0,
|
|
10449
|
+
var VuuInput = (0, import_react68.forwardRef)(function VuuInput2({
|
|
10062
10450
|
className,
|
|
10063
10451
|
errorMessage,
|
|
10064
10452
|
id: idProp,
|
|
@@ -10067,16 +10455,16 @@ var VuuInput = (0, import_react62.forwardRef)(function VuuInput2({
|
|
|
10067
10455
|
type,
|
|
10068
10456
|
...props
|
|
10069
10457
|
}, forwardedRef) {
|
|
10070
|
-
const id = (0,
|
|
10458
|
+
const id = (0, import_vuu_utils24.useId)(idProp);
|
|
10071
10459
|
const { anchorProps, tooltipProps } = (0, import_vuu_popups4.useTooltip)({
|
|
10072
10460
|
id,
|
|
10073
10461
|
tooltipContent: errorMessage
|
|
10074
10462
|
});
|
|
10075
|
-
const commitValue = (0,
|
|
10463
|
+
const commitValue = (0, import_react68.useCallback)(
|
|
10076
10464
|
(evt, value) => {
|
|
10077
10465
|
if (type === "number") {
|
|
10078
10466
|
const numericValue = parseFloat(value);
|
|
10079
|
-
if ((0,
|
|
10467
|
+
if ((0, import_vuu_utils24.isValidNumber)(numericValue)) {
|
|
10080
10468
|
onCommit(evt, numericValue);
|
|
10081
10469
|
} else {
|
|
10082
10470
|
throw Error("Invalid value");
|
|
@@ -10089,7 +10477,7 @@ var VuuInput = (0, import_react62.forwardRef)(function VuuInput2({
|
|
|
10089
10477
|
},
|
|
10090
10478
|
[onCommit, type]
|
|
10091
10479
|
);
|
|
10092
|
-
const handleKeyDown = (0,
|
|
10480
|
+
const handleKeyDown = (0, import_react68.useCallback)(
|
|
10093
10481
|
(evt) => {
|
|
10094
10482
|
if (evt.key === "Enter") {
|
|
10095
10483
|
evt.preventDefault();
|
|
@@ -10101,24 +10489,24 @@ var VuuInput = (0, import_react62.forwardRef)(function VuuInput2({
|
|
|
10101
10489
|
},
|
|
10102
10490
|
[commitValue, onKeyDown]
|
|
10103
10491
|
);
|
|
10104
|
-
const handleBlur = (0,
|
|
10492
|
+
const handleBlur = (0, import_react68.useCallback)(
|
|
10105
10493
|
(evt) => {
|
|
10106
10494
|
const { value } = evt.target;
|
|
10107
10495
|
commitValue(evt, value);
|
|
10108
10496
|
},
|
|
10109
10497
|
[commitValue]
|
|
10110
10498
|
);
|
|
10111
|
-
const endAdornment = errorMessage ? /* @__PURE__ */ (0,
|
|
10499
|
+
const endAdornment = errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
10112
10500
|
"span",
|
|
10113
10501
|
{
|
|
10114
10502
|
...anchorProps,
|
|
10115
|
-
className: `${
|
|
10503
|
+
className: `${classBase16}-errorIcon`,
|
|
10116
10504
|
"data-icon": "error"
|
|
10117
10505
|
}
|
|
10118
10506
|
) : void 0;
|
|
10119
|
-
return /* @__PURE__ */ (0,
|
|
10120
|
-
/* @__PURE__ */ (0,
|
|
10121
|
-
|
|
10507
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
10508
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
10509
|
+
import_core28.Input,
|
|
10122
10510
|
{
|
|
10123
10511
|
...props,
|
|
10124
10512
|
endAdornment,
|
|
@@ -10127,23 +10515,23 @@ var VuuInput = (0, import_react62.forwardRef)(function VuuInput2({
|
|
|
10127
10515
|
...constantInputProps,
|
|
10128
10516
|
...props.inputProps
|
|
10129
10517
|
},
|
|
10130
|
-
className: (0,
|
|
10131
|
-
[`${
|
|
10518
|
+
className: (0, import_clsx29.default)(classBase16, className, {
|
|
10519
|
+
[`${classBase16}-errror`]: errorMessage
|
|
10132
10520
|
}),
|
|
10133
10521
|
onBlur: handleBlur,
|
|
10134
10522
|
ref: forwardedRef,
|
|
10135
10523
|
onKeyDown: handleKeyDown
|
|
10136
10524
|
}
|
|
10137
10525
|
),
|
|
10138
|
-
tooltipProps ? /* @__PURE__ */ (0,
|
|
10526
|
+
tooltipProps ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_vuu_popups4.Tooltip, { ...tooltipProps, status: "error" }) : null
|
|
10139
10527
|
] });
|
|
10140
10528
|
});
|
|
10141
10529
|
|
|
10142
10530
|
// src/expando-input/ExpandoInput.tsx
|
|
10143
|
-
var
|
|
10144
|
-
var
|
|
10531
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
10532
|
+
var classBase17 = "vuuExpandoInput";
|
|
10145
10533
|
var noop = () => void 0;
|
|
10146
|
-
var ExpandoInput = (0,
|
|
10534
|
+
var ExpandoInput = (0, import_react69.forwardRef)(function ExpandoInput2({
|
|
10147
10535
|
className: classNameProp,
|
|
10148
10536
|
errorMessage,
|
|
10149
10537
|
value,
|
|
@@ -10151,19 +10539,19 @@ var ExpandoInput = (0, import_react63.forwardRef)(function ExpandoInput2({
|
|
|
10151
10539
|
onCommit = noop,
|
|
10152
10540
|
...props
|
|
10153
10541
|
}, forwardedRef) {
|
|
10154
|
-
return /* @__PURE__ */ (0,
|
|
10542
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
10155
10543
|
"div",
|
|
10156
10544
|
{
|
|
10157
|
-
className: (0,
|
|
10158
|
-
[`${
|
|
10545
|
+
className: (0, import_clsx30.default)(classBase17, classNameProp, {
|
|
10546
|
+
[`${classBase17}-error`]: errorMessage
|
|
10159
10547
|
}),
|
|
10160
10548
|
"data-text": value,
|
|
10161
|
-
children: /* @__PURE__ */ (0,
|
|
10549
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
10162
10550
|
VuuInput,
|
|
10163
10551
|
{
|
|
10164
10552
|
...props,
|
|
10165
10553
|
errorMessage,
|
|
10166
|
-
inputProps: { ...inputProps, className: `${
|
|
10554
|
+
inputProps: { ...inputProps, className: `${classBase17}-input` },
|
|
10167
10555
|
onCommit,
|
|
10168
10556
|
ref: forwardedRef,
|
|
10169
10557
|
style: { padding: 0 },
|
|
@@ -10176,53 +10564,18 @@ var ExpandoInput = (0, import_react63.forwardRef)(function ExpandoInput2({
|
|
|
10176
10564
|
);
|
|
10177
10565
|
});
|
|
10178
10566
|
|
|
10179
|
-
// src/icon-button/Icon.tsx
|
|
10180
|
-
var import_clsx26 = __toESM(require("clsx"));
|
|
10181
|
-
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
10182
|
-
var classBase13 = "vuuIcon";
|
|
10183
|
-
var Icon = ({
|
|
10184
|
-
className,
|
|
10185
|
-
name,
|
|
10186
|
-
size,
|
|
10187
|
-
style: styleProp,
|
|
10188
|
-
...htmlAttributes
|
|
10189
|
-
}) => {
|
|
10190
|
-
const style = typeof size === "number" ? { ...styleProp, "--vuu-icon-size": `${size}px` } : styleProp;
|
|
10191
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
10192
|
-
"span",
|
|
10193
|
-
{
|
|
10194
|
-
...htmlAttributes,
|
|
10195
|
-
className: (0, import_clsx26.default)(classBase13, className),
|
|
10196
|
-
"data-icon": name,
|
|
10197
|
-
style
|
|
10198
|
-
}
|
|
10199
|
-
);
|
|
10200
|
-
};
|
|
10201
|
-
|
|
10202
|
-
// src/icon-button/IconButton.tsx
|
|
10203
|
-
var import_clsx27 = __toESM(require("clsx"));
|
|
10204
|
-
var import_core27 = require("@salt-ds/core");
|
|
10205
|
-
var import_react64 = require("react");
|
|
10206
|
-
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
10207
|
-
var classBase14 = "vuuIconButton";
|
|
10208
|
-
var IconButton = (0, import_react64.forwardRef)(
|
|
10209
|
-
function IconButton2({ className, icon, ...buttonProps }, ref) {
|
|
10210
|
-
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_core27.Button, { ...buttonProps, className: (0, import_clsx27.default)(classBase14, className), ref, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Icon, { name: icon }) });
|
|
10211
|
-
}
|
|
10212
|
-
);
|
|
10213
|
-
|
|
10214
10567
|
// src/inputs/Checkbox.tsx
|
|
10215
|
-
var
|
|
10568
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
10216
10569
|
var Checkbox = (props) => {
|
|
10217
10570
|
const { onToggle, checked, label } = props;
|
|
10218
|
-
return /* @__PURE__ */ (0,
|
|
10571
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
10219
10572
|
"div",
|
|
10220
10573
|
{
|
|
10221
10574
|
className: "vuuCheckbox",
|
|
10222
10575
|
onClick: onToggle,
|
|
10223
10576
|
onKeyUp: (e) => e.key === " " && onToggle(),
|
|
10224
10577
|
children: [
|
|
10225
|
-
/* @__PURE__ */ (0,
|
|
10578
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CheckboxIcon, { tabIndex: 0, checked }),
|
|
10226
10579
|
label
|
|
10227
10580
|
]
|
|
10228
10581
|
}
|
|
@@ -10230,13 +10583,13 @@ var Checkbox = (props) => {
|
|
|
10230
10583
|
};
|
|
10231
10584
|
|
|
10232
10585
|
// src/inputs/RadioButton.tsx
|
|
10233
|
-
var
|
|
10586
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
10234
10587
|
var RadioButton = (props) => {
|
|
10235
10588
|
const { onClick, checked, label, groupName } = props;
|
|
10236
|
-
return /* @__PURE__ */ (0,
|
|
10237
|
-
/* @__PURE__ */ (0,
|
|
10238
|
-
/* @__PURE__ */ (0,
|
|
10239
|
-
/* @__PURE__ */ (0,
|
|
10589
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "vuuRadioButton", onClick, children: [
|
|
10590
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "radio", children: [
|
|
10591
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("input", { type: "radio", name: groupName }),
|
|
10592
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(RadioIcon, { checked })
|
|
10240
10593
|
] }),
|
|
10241
10594
|
label
|
|
10242
10595
|
] });
|
|
@@ -10244,14 +10597,14 @@ var RadioButton = (props) => {
|
|
|
10244
10597
|
|
|
10245
10598
|
// src/instrument-picker/InstrumentPicker.tsx
|
|
10246
10599
|
var import_vuu_table2 = require("@vuu-ui/vuu-table");
|
|
10247
|
-
var
|
|
10248
|
-
var
|
|
10249
|
-
var
|
|
10600
|
+
var import_vuu_utils26 = require("@vuu-ui/vuu-utils");
|
|
10601
|
+
var import_core29 = require("@salt-ds/core");
|
|
10602
|
+
var import_react71 = require("react");
|
|
10250
10603
|
|
|
10251
10604
|
// src/instrument-picker/SearchCell.tsx
|
|
10252
|
-
var
|
|
10253
|
-
var
|
|
10254
|
-
var
|
|
10605
|
+
var import_vuu_utils25 = require("@vuu-ui/vuu-utils");
|
|
10606
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
10607
|
+
var classBase18 = "vuuSearchCell";
|
|
10255
10608
|
var SearchCell = ({
|
|
10256
10609
|
column,
|
|
10257
10610
|
columnMap,
|
|
@@ -10259,52 +10612,48 @@ var SearchCell = ({
|
|
|
10259
10612
|
}) => {
|
|
10260
10613
|
const key = columnMap[column.name];
|
|
10261
10614
|
const value = row[key];
|
|
10262
|
-
return /* @__PURE__ */ (0,
|
|
10263
|
-
/* @__PURE__ */ (0,
|
|
10615
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: classBase18, tabIndex: -1, children: [
|
|
10616
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { "data-icon": "draggable" }),
|
|
10264
10617
|
value
|
|
10265
10618
|
] });
|
|
10266
10619
|
};
|
|
10267
|
-
(0,
|
|
10620
|
+
(0, import_vuu_utils25.registerComponent)("search-cell", SearchCell, "cell-renderer", {
|
|
10268
10621
|
serverDataType: "private"
|
|
10269
10622
|
});
|
|
10270
10623
|
|
|
10271
10624
|
// src/instrument-picker/useInstrumentPicker.ts
|
|
10272
10625
|
var import_vuu_table = require("@vuu-ui/vuu-table");
|
|
10273
|
-
var
|
|
10274
|
-
var defaultItemToString = (
|
|
10275
|
-
return columns.map(({ name }) => row[columnMap[name]]).join(" ");
|
|
10276
|
-
};
|
|
10626
|
+
var import_react70 = require("react");
|
|
10627
|
+
var defaultItemToString = (row) => Object.values(row.data).join(" ");
|
|
10277
10628
|
var useInstrumentPicker = ({
|
|
10278
|
-
columnMap,
|
|
10279
|
-
columns,
|
|
10280
10629
|
dataSource,
|
|
10281
10630
|
defaultIsOpen,
|
|
10282
10631
|
isOpen: isOpenProp,
|
|
10283
|
-
itemToString: itemToString2 = defaultItemToString
|
|
10632
|
+
itemToString: itemToString2 = defaultItemToString,
|
|
10284
10633
|
onOpenChange,
|
|
10285
10634
|
onSelect,
|
|
10286
10635
|
searchColumns
|
|
10287
10636
|
}) => {
|
|
10288
|
-
const [value, setValue] = (0,
|
|
10637
|
+
const [value, setValue] = (0, import_react70.useState)("");
|
|
10289
10638
|
const [isOpen, setIsOpen] = useControlled({
|
|
10290
10639
|
controlled: isOpenProp,
|
|
10291
10640
|
default: defaultIsOpen != null ? defaultIsOpen : false,
|
|
10292
10641
|
name: "useDropdownList"
|
|
10293
10642
|
});
|
|
10294
10643
|
const { highlightedIndexRef, onKeyDown, tableRef } = (0, import_vuu_table.useControlledTableNavigation)(-1, dataSource.size);
|
|
10295
|
-
const baseFilterPattern = (0,
|
|
10644
|
+
const baseFilterPattern = (0, import_react70.useMemo)(
|
|
10296
10645
|
// TODO make this contains once server supports it
|
|
10297
10646
|
() => searchColumns.map((col) => `${col} starts "__VALUE__"`).join(" or "),
|
|
10298
10647
|
[searchColumns]
|
|
10299
10648
|
);
|
|
10300
|
-
const handleOpenChange = (0,
|
|
10649
|
+
const handleOpenChange = (0, import_react70.useCallback)(
|
|
10301
10650
|
(open, closeReason) => {
|
|
10302
10651
|
setIsOpen(open);
|
|
10303
10652
|
onOpenChange == null ? void 0 : onOpenChange(open, closeReason);
|
|
10304
10653
|
},
|
|
10305
10654
|
[onOpenChange, setIsOpen]
|
|
10306
10655
|
);
|
|
10307
|
-
const handleInputChange = (0,
|
|
10656
|
+
const handleInputChange = (0, import_react70.useCallback)(
|
|
10308
10657
|
(evt) => {
|
|
10309
10658
|
const { value: value2 } = evt.target;
|
|
10310
10659
|
setValue(value2);
|
|
@@ -10322,11 +10671,11 @@ var useInstrumentPicker = ({
|
|
|
10322
10671
|
},
|
|
10323
10672
|
[baseFilterPattern, dataSource, setIsOpen]
|
|
10324
10673
|
);
|
|
10325
|
-
const handleSelectRow = (0,
|
|
10674
|
+
const handleSelectRow = (0, import_react70.useCallback)(
|
|
10326
10675
|
(row) => {
|
|
10327
|
-
const value2 = itemToString2(row);
|
|
10676
|
+
const value2 = row === null ? "" : itemToString2(row);
|
|
10328
10677
|
setValue(value2);
|
|
10329
|
-
onSelect(row);
|
|
10678
|
+
onSelect == null ? void 0 : onSelect(row);
|
|
10330
10679
|
handleOpenChange == null ? void 0 : handleOpenChange(false, "select");
|
|
10331
10680
|
},
|
|
10332
10681
|
[handleOpenChange, itemToString2, onSelect]
|
|
@@ -10353,12 +10702,12 @@ var useInstrumentPicker = ({
|
|
|
10353
10702
|
};
|
|
10354
10703
|
|
|
10355
10704
|
// src/instrument-picker/InstrumentPicker.tsx
|
|
10356
|
-
var
|
|
10357
|
-
var
|
|
10705
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
10706
|
+
var classBase19 = "vuuInstrumentPicker";
|
|
10358
10707
|
if (typeof SearchCell !== "function") {
|
|
10359
10708
|
console.warn("Instrument Picker: SearchCell module not loaded ");
|
|
10360
10709
|
}
|
|
10361
|
-
var InstrumentPicker = (0,
|
|
10710
|
+
var InstrumentPicker = (0, import_react71.forwardRef)(function InstrumentPicker2({
|
|
10362
10711
|
TableProps: { dataSource, ...TableProps3 },
|
|
10363
10712
|
className,
|
|
10364
10713
|
columnMap,
|
|
@@ -10372,7 +10721,7 @@ var InstrumentPicker = (0, import_react66.forwardRef)(function InstrumentPicker2
|
|
|
10372
10721
|
width,
|
|
10373
10722
|
...htmlAttributes
|
|
10374
10723
|
}, forwardedRef) {
|
|
10375
|
-
const id = (0,
|
|
10724
|
+
const id = (0, import_vuu_utils26.useId)(idProp);
|
|
10376
10725
|
const {
|
|
10377
10726
|
highlightedIndex,
|
|
10378
10727
|
inputProps,
|
|
@@ -10390,7 +10739,7 @@ var InstrumentPicker = (0, import_react66.forwardRef)(function InstrumentPicker2
|
|
|
10390
10739
|
onSelect,
|
|
10391
10740
|
searchColumns
|
|
10392
10741
|
});
|
|
10393
|
-
const endAdornment = (0,
|
|
10742
|
+
const endAdornment = (0, import_react71.useMemo)(() => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { "data-icon": "chevron-down" }), []);
|
|
10394
10743
|
const tableProps = {
|
|
10395
10744
|
...TableProps3,
|
|
10396
10745
|
config: {
|
|
@@ -10398,7 +10747,7 @@ var InstrumentPicker = (0, import_react66.forwardRef)(function InstrumentPicker2
|
|
|
10398
10747
|
zebraStripes: false
|
|
10399
10748
|
}
|
|
10400
10749
|
};
|
|
10401
|
-
return /* @__PURE__ */ (0,
|
|
10750
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
10402
10751
|
DropdownBase,
|
|
10403
10752
|
{
|
|
10404
10753
|
...htmlAttributes,
|
|
@@ -10411,8 +10760,8 @@ var InstrumentPicker = (0, import_react66.forwardRef)(function InstrumentPicker2
|
|
|
10411
10760
|
ref: forwardedRef,
|
|
10412
10761
|
width,
|
|
10413
10762
|
children: [
|
|
10414
|
-
/* @__PURE__ */ (0,
|
|
10415
|
-
|
|
10763
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
10764
|
+
import_core29.Input,
|
|
10416
10765
|
{
|
|
10417
10766
|
...inputProps,
|
|
10418
10767
|
disabled,
|
|
@@ -10420,14 +10769,14 @@ var InstrumentPicker = (0, import_react66.forwardRef)(function InstrumentPicker2
|
|
|
10420
10769
|
value
|
|
10421
10770
|
}
|
|
10422
10771
|
),
|
|
10423
|
-
/* @__PURE__ */ (0,
|
|
10772
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
10424
10773
|
import_vuu_table2.Table,
|
|
10425
10774
|
{
|
|
10426
10775
|
rowHeight: 25,
|
|
10427
10776
|
renderBufferSize: 100,
|
|
10428
10777
|
...tableProps,
|
|
10429
10778
|
...tableHandlers,
|
|
10430
|
-
className: `${
|
|
10779
|
+
className: `${classBase19}-list`,
|
|
10431
10780
|
height: 200,
|
|
10432
10781
|
highlightedIndex,
|
|
10433
10782
|
dataSource,
|
|
@@ -10444,14 +10793,14 @@ var InstrumentPicker = (0, import_react66.forwardRef)(function InstrumentPicker2
|
|
|
10444
10793
|
// src/instrument-search/InstrumentSearch.tsx
|
|
10445
10794
|
var import_vuu_layout = require("@vuu-ui/vuu-layout");
|
|
10446
10795
|
var import_vuu_table3 = require("@vuu-ui/vuu-table");
|
|
10447
|
-
var
|
|
10448
|
-
var
|
|
10449
|
-
var
|
|
10796
|
+
var import_core30 = require("@salt-ds/core");
|
|
10797
|
+
var import_clsx31 = __toESM(require("clsx"));
|
|
10798
|
+
var import_react73 = require("react");
|
|
10450
10799
|
|
|
10451
10800
|
// src/instrument-search/SearchCell.tsx
|
|
10452
|
-
var
|
|
10453
|
-
var
|
|
10454
|
-
var
|
|
10801
|
+
var import_vuu_utils27 = require("@vuu-ui/vuu-utils");
|
|
10802
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
10803
|
+
var classBase20 = "vuuSearchCell";
|
|
10455
10804
|
var SearchCell2 = ({
|
|
10456
10805
|
column,
|
|
10457
10806
|
columnMap,
|
|
@@ -10459,28 +10808,28 @@ var SearchCell2 = ({
|
|
|
10459
10808
|
}) => {
|
|
10460
10809
|
const key = columnMap[column.name];
|
|
10461
10810
|
const value = row[key];
|
|
10462
|
-
return /* @__PURE__ */ (0,
|
|
10463
|
-
/* @__PURE__ */ (0,
|
|
10811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: classBase20, tabIndex: -1, children: [
|
|
10812
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { "data-icon": "draggable" }),
|
|
10464
10813
|
value
|
|
10465
10814
|
] });
|
|
10466
10815
|
};
|
|
10467
|
-
(0,
|
|
10816
|
+
(0, import_vuu_utils27.registerComponent)("search-cell", SearchCell2, "cell-renderer", {
|
|
10468
10817
|
serverDataType: "private"
|
|
10469
10818
|
});
|
|
10470
10819
|
|
|
10471
10820
|
// src/instrument-search/useInstrumentSearch.ts
|
|
10472
|
-
var
|
|
10821
|
+
var import_react72 = require("react");
|
|
10473
10822
|
var useInstrumentSearch = ({
|
|
10474
10823
|
dataSource,
|
|
10475
10824
|
searchColumns = ["description"]
|
|
10476
10825
|
}) => {
|
|
10477
|
-
const [searchState, setSearchState] = (0,
|
|
10478
|
-
const baseFilterPattern = (0,
|
|
10826
|
+
const [searchState, setSearchState] = (0, import_react72.useState)({ searchText: "", filter: "" });
|
|
10827
|
+
const baseFilterPattern = (0, import_react72.useMemo)(
|
|
10479
10828
|
// TODO make this contains once server supports it
|
|
10480
10829
|
() => searchColumns.map((col) => `${col} starts "__VALUE__"`).join(" or "),
|
|
10481
10830
|
[searchColumns]
|
|
10482
10831
|
);
|
|
10483
|
-
const handleChange = (0,
|
|
10832
|
+
const handleChange = (0, import_react72.useCallback)(
|
|
10484
10833
|
(evt) => {
|
|
10485
10834
|
const { value } = evt.target;
|
|
10486
10835
|
const filter = baseFilterPattern.replaceAll("__VALUE__", value);
|
|
@@ -10504,8 +10853,8 @@ var useInstrumentSearch = ({
|
|
|
10504
10853
|
};
|
|
10505
10854
|
|
|
10506
10855
|
// src/instrument-search/InstrumentSearch.tsx
|
|
10507
|
-
var
|
|
10508
|
-
var
|
|
10856
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
10857
|
+
var classBase21 = "vuuInstrumentSearch";
|
|
10509
10858
|
if (typeof SearchCell2 !== "function") {
|
|
10510
10859
|
console.warn("Instrument Search: SearchCell module not loaded ");
|
|
10511
10860
|
}
|
|
@@ -10525,7 +10874,7 @@ var defaultTableConfig = {
|
|
|
10525
10874
|
],
|
|
10526
10875
|
rowSeparators: true
|
|
10527
10876
|
};
|
|
10528
|
-
var searchIcon = /* @__PURE__ */ (0,
|
|
10877
|
+
var searchIcon = /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { "data-icon": "search" });
|
|
10529
10878
|
var InstrumentSearch = ({
|
|
10530
10879
|
TableProps: TableProps3,
|
|
10531
10880
|
autoFocus = false,
|
|
@@ -10541,15 +10890,15 @@ var InstrumentSearch = ({
|
|
|
10541
10890
|
searchColumns
|
|
10542
10891
|
});
|
|
10543
10892
|
const { highlightedIndexRef, onHighlight, onKeyDown, tableRef } = (0, import_vuu_table3.useControlledTableNavigation)(-1, (_a2 = dataSource == null ? void 0 : dataSource.size) != null ? _a2 : 0);
|
|
10544
|
-
const searchCallbackRef = (0,
|
|
10893
|
+
const searchCallbackRef = (0, import_react73.useCallback)((el) => {
|
|
10545
10894
|
setTimeout(() => {
|
|
10546
10895
|
var _a3;
|
|
10547
10896
|
(_a3 = el == null ? void 0 : el.querySelector("input")) == null ? void 0 : _a3.focus();
|
|
10548
10897
|
}, 100);
|
|
10549
10898
|
}, []);
|
|
10550
|
-
return /* @__PURE__ */ (0,
|
|
10551
|
-
/* @__PURE__ */ (0,
|
|
10552
|
-
|
|
10899
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { ...htmlAttributes, className: (0, import_clsx31.default)(classBase21, className), children: [
|
|
10900
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: `${classBase21}-inputField`, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
10901
|
+
import_core30.Input,
|
|
10553
10902
|
{
|
|
10554
10903
|
inputProps: { onKeyDown },
|
|
10555
10904
|
endAdornment: searchIcon,
|
|
@@ -10559,7 +10908,7 @@ var InstrumentSearch = ({
|
|
|
10559
10908
|
onChange
|
|
10560
10909
|
}
|
|
10561
10910
|
) }),
|
|
10562
|
-
dataSource ? /* @__PURE__ */ (0,
|
|
10911
|
+
dataSource ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
10563
10912
|
import_vuu_table3.Table,
|
|
10564
10913
|
{
|
|
10565
10914
|
disableFocus: true,
|
|
@@ -10569,7 +10918,7 @@ var InstrumentSearch = ({
|
|
|
10569
10918
|
highlightedIndex: highlightedIndexRef.current,
|
|
10570
10919
|
renderBufferSize: 100,
|
|
10571
10920
|
...TableProps3,
|
|
10572
|
-
className: `${
|
|
10921
|
+
className: `${classBase21}-list`,
|
|
10573
10922
|
dataSource,
|
|
10574
10923
|
navigationStyle: "row",
|
|
10575
10924
|
onHighlight,
|
|
@@ -10583,12 +10932,12 @@ var _a;
|
|
|
10583
10932
|
(_a = import_vuu_layout.registerComponent) == null ? void 0 : _a("InstrumentSearch", InstrumentSearch, "view");
|
|
10584
10933
|
|
|
10585
10934
|
// src/price-ticker/PriceTicker.tsx
|
|
10586
|
-
var
|
|
10587
|
-
var
|
|
10588
|
-
var
|
|
10589
|
-
var
|
|
10590
|
-
var
|
|
10591
|
-
var getValueFormatter = (decimals) => (0,
|
|
10935
|
+
var import_vuu_utils28 = require("@vuu-ui/vuu-utils");
|
|
10936
|
+
var import_react74 = require("react");
|
|
10937
|
+
var import_clsx32 = __toESM(require("clsx"));
|
|
10938
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
10939
|
+
var classBase22 = "vuuPriceTicker";
|
|
10940
|
+
var getValueFormatter = (decimals) => (0, import_vuu_utils28.numericFormatter)({
|
|
10592
10941
|
type: {
|
|
10593
10942
|
name: "number",
|
|
10594
10943
|
formatting: {
|
|
@@ -10598,7 +10947,7 @@ var getValueFormatter = (decimals) => (0, import_vuu_utils25.numericFormatter)({
|
|
|
10598
10947
|
}
|
|
10599
10948
|
});
|
|
10600
10949
|
var INITIAL_VALUE = [void 0, void 0];
|
|
10601
|
-
var PriceTicker = (0,
|
|
10950
|
+
var PriceTicker = (0, import_react74.memo)(
|
|
10602
10951
|
({
|
|
10603
10952
|
className,
|
|
10604
10953
|
decimals = 2,
|
|
@@ -10606,14 +10955,14 @@ var PriceTicker = (0, import_react69.memo)(
|
|
|
10606
10955
|
showArrow,
|
|
10607
10956
|
...htmlAttributes
|
|
10608
10957
|
}) => {
|
|
10609
|
-
const ref = (0,
|
|
10958
|
+
const ref = (0, import_react74.useRef)(INITIAL_VALUE);
|
|
10610
10959
|
const [prevValue, prevDirection] = ref.current;
|
|
10611
|
-
const formatNumber = (0,
|
|
10612
|
-
const direction = (0,
|
|
10960
|
+
const formatNumber = (0, import_react74.useMemo)(() => getValueFormatter(decimals), [decimals]);
|
|
10961
|
+
const direction = (0, import_vuu_utils28.isValidNumber)(prevValue) ? (0, import_vuu_utils28.getMovingValueDirection)(price, prevDirection, prevValue, decimals) : "";
|
|
10613
10962
|
ref.current = [price, direction];
|
|
10614
|
-
return /* @__PURE__ */ (0,
|
|
10963
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { ...htmlAttributes, className: (0, import_clsx32.default)(classBase22, className, direction), children: [
|
|
10615
10964
|
formatNumber(price),
|
|
10616
|
-
showArrow ? /* @__PURE__ */ (0,
|
|
10965
|
+
showArrow ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { "data-icon": "price-arrow" }) : null
|
|
10617
10966
|
] });
|
|
10618
10967
|
}
|
|
10619
10968
|
);
|
|
@@ -10621,21 +10970,27 @@ PriceTicker.displayName = "PriceTicker";
|
|
|
10621
10970
|
|
|
10622
10971
|
// src/split-button/SplitButton.tsx
|
|
10623
10972
|
var import_vuu_popups5 = require("@vuu-ui/vuu-popups");
|
|
10624
|
-
var
|
|
10973
|
+
var import_core31 = require("@salt-ds/core");
|
|
10974
|
+
var import_react76 = require("react");
|
|
10625
10975
|
|
|
10626
10976
|
// src/split-button/useSplitButton.ts
|
|
10627
|
-
var
|
|
10628
|
-
var
|
|
10977
|
+
var import_vuu_utils29 = require("@vuu-ui/vuu-utils");
|
|
10978
|
+
var import_react75 = require("react");
|
|
10979
|
+
var focusTargetIsEditableLabel = (target) => {
|
|
10980
|
+
if (target.tagName === "INPUT") {
|
|
10981
|
+
return true;
|
|
10982
|
+
}
|
|
10983
|
+
return false;
|
|
10984
|
+
};
|
|
10629
10985
|
var useSplitButton = ({
|
|
10630
10986
|
ButtonProps: ButtonPropsProp,
|
|
10631
10987
|
PopupMenuProps: PopupMenuProps3,
|
|
10632
|
-
classBase:
|
|
10633
|
-
onClick
|
|
10634
|
-
segmented
|
|
10988
|
+
classBase: classBase30,
|
|
10989
|
+
onClick
|
|
10635
10990
|
}) => {
|
|
10636
|
-
const buttonRef = (0,
|
|
10637
|
-
const rootRef = (0,
|
|
10638
|
-
const onMenuClose = (0,
|
|
10991
|
+
const buttonRef = (0, import_react75.useRef)(null);
|
|
10992
|
+
const rootRef = (0, import_react75.useRef)(null);
|
|
10993
|
+
const onMenuClose = (0, import_react75.useCallback)((reason) => {
|
|
10639
10994
|
var _a2;
|
|
10640
10995
|
if ((reason == null ? void 0 : reason.type) !== "tab-away") {
|
|
10641
10996
|
const buttonMain = (_a2 = rootRef.current) == null ? void 0 : _a2.querySelector(
|
|
@@ -10647,17 +11002,23 @@ var useSplitButton = ({
|
|
|
10647
11002
|
const menuProps = {
|
|
10648
11003
|
...PopupMenuProps3,
|
|
10649
11004
|
anchorElement: rootRef,
|
|
10650
|
-
menuClassName: `${
|
|
11005
|
+
menuClassName: `${classBase30}-menu`,
|
|
10651
11006
|
onMenuClose,
|
|
10652
11007
|
popupPlacement: "below-full-width"
|
|
10653
11008
|
};
|
|
10654
|
-
const handleRootFocus = (0,
|
|
11009
|
+
const handleRootFocus = (0, import_react75.useCallback)((evt) => {
|
|
10655
11010
|
const { current: splitButton } = rootRef;
|
|
10656
11011
|
if (!(splitButton == null ? void 0 : splitButton.classList.contains("vuuFocusVisible"))) {
|
|
10657
11012
|
splitButton == null ? void 0 : splitButton.classList.add("vuuFocusVisible");
|
|
11013
|
+
if (!focusTargetIsEditableLabel(evt.target)) {
|
|
11014
|
+
requestAnimationFrame(() => {
|
|
11015
|
+
var _a2;
|
|
11016
|
+
(_a2 = buttonRef.current) == null ? void 0 : _a2.focus();
|
|
11017
|
+
});
|
|
11018
|
+
}
|
|
10658
11019
|
}
|
|
10659
11020
|
}, []);
|
|
10660
|
-
const handleRootBlur = (0,
|
|
11021
|
+
const handleRootBlur = (0, import_react75.useCallback)((evt) => {
|
|
10661
11022
|
const { current: splitButton } = rootRef;
|
|
10662
11023
|
const target = evt.relatedTarget;
|
|
10663
11024
|
if (!(splitButton == null ? void 0 : splitButton.contains(target))) {
|
|
@@ -10666,29 +11027,23 @@ var useSplitButton = ({
|
|
|
10666
11027
|
}
|
|
10667
11028
|
}
|
|
10668
11029
|
}, []);
|
|
10669
|
-
const handleButtonKeyDown = (0,
|
|
11030
|
+
const handleButtonKeyDown = (0, import_react75.useCallback)(
|
|
10670
11031
|
(evt) => {
|
|
10671
11032
|
var _a2;
|
|
10672
11033
|
if (evt.key === "ArrowDown") {
|
|
10673
11034
|
const popupTrigger = (_a2 = rootRef.current) == null ? void 0 : _a2.querySelector(
|
|
10674
|
-
`.${
|
|
11035
|
+
`.${classBase30}-trigger`
|
|
10675
11036
|
);
|
|
10676
11037
|
if (popupTrigger) {
|
|
10677
|
-
(0,
|
|
11038
|
+
(0, import_vuu_utils29.dispatchMouseEvent)(popupTrigger, "click");
|
|
10678
11039
|
}
|
|
10679
11040
|
}
|
|
10680
11041
|
},
|
|
10681
|
-
[
|
|
10682
|
-
);
|
|
10683
|
-
const handleClick = (0, import_react70.useCallback)(
|
|
10684
|
-
(evt) => {
|
|
10685
|
-
onClick == null ? void 0 : onClick(evt);
|
|
10686
|
-
},
|
|
10687
|
-
[onClick]
|
|
11042
|
+
[classBase30]
|
|
10688
11043
|
);
|
|
10689
11044
|
const ButtonProps6 = {
|
|
10690
11045
|
...ButtonPropsProp,
|
|
10691
|
-
onClick
|
|
11046
|
+
onClick,
|
|
10692
11047
|
onKeyDown: handleButtonKeyDown
|
|
10693
11048
|
};
|
|
10694
11049
|
return {
|
|
@@ -10696,81 +11051,101 @@ var useSplitButton = ({
|
|
|
10696
11051
|
PopupMenuProps: menuProps,
|
|
10697
11052
|
buttonRef,
|
|
10698
11053
|
rootRef,
|
|
10699
|
-
onClick: segmented ? void 0 : handleClick,
|
|
10700
11054
|
onBlur: handleRootBlur,
|
|
10701
11055
|
onFocus: handleRootFocus
|
|
10702
11056
|
};
|
|
10703
11057
|
};
|
|
10704
11058
|
|
|
10705
11059
|
// src/split-button/SplitButton.tsx
|
|
10706
|
-
var
|
|
10707
|
-
var
|
|
10708
|
-
var
|
|
10709
|
-
var SplitButton = (
|
|
10710
|
-
|
|
10711
|
-
PopupMenuProps: PopupMenuPropsProp,
|
|
10712
|
-
buttonText,
|
|
10713
|
-
disabled = false,
|
|
10714
|
-
onClick,
|
|
10715
|
-
segmented = false,
|
|
10716
|
-
variant = "primary",
|
|
10717
|
-
...htmlAttributes
|
|
10718
|
-
}) => {
|
|
10719
|
-
var _a2;
|
|
10720
|
-
const { ButtonProps: ButtonProps6, buttonRef, rootRef, PopupMenuProps: PopupMenuProps3, ...rootProps } = useSplitButton({
|
|
11060
|
+
var import_clsx33 = __toESM(require("clsx"));
|
|
11061
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
11062
|
+
var classBase23 = "vuuSplitButton";
|
|
11063
|
+
var SplitButton = (0, import_react76.forwardRef)(
|
|
11064
|
+
function SplitButton2({
|
|
10721
11065
|
ButtonProps: ButtonPropsProp,
|
|
10722
11066
|
PopupMenuProps: PopupMenuPropsProp,
|
|
10723
|
-
|
|
11067
|
+
children,
|
|
11068
|
+
className,
|
|
11069
|
+
disabled = false,
|
|
10724
11070
|
onClick,
|
|
10725
|
-
segmented
|
|
10726
|
-
|
|
10727
|
-
|
|
10728
|
-
|
|
11071
|
+
segmented = false,
|
|
11072
|
+
variant = "primary",
|
|
11073
|
+
...htmlAttributes
|
|
11074
|
+
}, forwardedRef) {
|
|
11075
|
+
var _a2;
|
|
11076
|
+
const { ButtonProps: ButtonProps6, buttonRef, rootRef, PopupMenuProps: PopupMenuProps3, ...rootProps } = useSplitButton({
|
|
11077
|
+
ButtonProps: ButtonPropsProp,
|
|
11078
|
+
PopupMenuProps: PopupMenuPropsProp,
|
|
11079
|
+
classBase: classBase23,
|
|
11080
|
+
onClick,
|
|
11081
|
+
segmented
|
|
11082
|
+
});
|
|
11083
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
11084
|
+
"div",
|
|
11085
|
+
{
|
|
11086
|
+
...htmlAttributes,
|
|
11087
|
+
...rootProps,
|
|
11088
|
+
className: (0, import_clsx33.default)(classBase23, `${classBase23}-${variant}`, className, {
|
|
11089
|
+
[`${classBase23}-disabled`]: disabled,
|
|
11090
|
+
[`${classBase23}-segmented`]: segmented
|
|
11091
|
+
}),
|
|
11092
|
+
ref: (0, import_core31.useForkRef)(forwardedRef, rootRef),
|
|
11093
|
+
"data-showcase-center": true,
|
|
11094
|
+
tabIndex: -1,
|
|
11095
|
+
children: [
|
|
11096
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
11097
|
+
import_core31.Button,
|
|
11098
|
+
{
|
|
11099
|
+
...ButtonProps6,
|
|
11100
|
+
className: `${classBase23}-main`,
|
|
11101
|
+
disabled,
|
|
11102
|
+
ref: buttonRef,
|
|
11103
|
+
variant,
|
|
11104
|
+
children
|
|
11105
|
+
}
|
|
11106
|
+
),
|
|
11107
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
11108
|
+
import_vuu_popups5.PopupMenu,
|
|
11109
|
+
{
|
|
11110
|
+
...PopupMenuProps3,
|
|
11111
|
+
className: `${classBase23}-trigger`,
|
|
11112
|
+
disabled,
|
|
11113
|
+
icon: (_a2 = PopupMenuProps3 == null ? void 0 : PopupMenuProps3.icon) != null ? _a2 : "chevron-down",
|
|
11114
|
+
tabIndex: segmented ? 0 : -1,
|
|
11115
|
+
variant
|
|
11116
|
+
}
|
|
11117
|
+
)
|
|
11118
|
+
]
|
|
11119
|
+
}
|
|
11120
|
+
);
|
|
11121
|
+
}
|
|
11122
|
+
);
|
|
11123
|
+
|
|
11124
|
+
// src/split-button/SplitStateButton.tsx
|
|
11125
|
+
var import_clsx34 = __toESM(require("clsx"));
|
|
11126
|
+
var import_react77 = require("react");
|
|
11127
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
11128
|
+
var classBase24 = "vuuSplitStateButton";
|
|
11129
|
+
var SplitStateButton = (0, import_react77.forwardRef)(function SplitStateButton2({ className, selected, ...splitButtonProps }, forwardedRef) {
|
|
11130
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
11131
|
+
SplitButton,
|
|
10729
11132
|
{
|
|
10730
|
-
...
|
|
10731
|
-
|
|
10732
|
-
className: (0,
|
|
10733
|
-
|
|
10734
|
-
[`${classBase20}-segmented`]: segmented
|
|
10735
|
-
}),
|
|
10736
|
-
ref: rootRef,
|
|
10737
|
-
"data-showcase-center": true,
|
|
10738
|
-
children: [
|
|
10739
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10740
|
-
import_core30.Button,
|
|
10741
|
-
{
|
|
10742
|
-
...ButtonProps6,
|
|
10743
|
-
className: `${classBase20}-main`,
|
|
10744
|
-
disabled,
|
|
10745
|
-
ref: buttonRef,
|
|
10746
|
-
variant,
|
|
10747
|
-
children: buttonText
|
|
10748
|
-
}
|
|
10749
|
-
),
|
|
10750
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10751
|
-
import_vuu_popups5.PopupMenu,
|
|
10752
|
-
{
|
|
10753
|
-
...PopupMenuProps3,
|
|
10754
|
-
className: `${classBase20}-trigger`,
|
|
10755
|
-
disabled,
|
|
10756
|
-
icon: (_a2 = PopupMenuProps3 == null ? void 0 : PopupMenuProps3.icon) != null ? _a2 : "chevron-down",
|
|
10757
|
-
tabIndex: segmented ? 0 : -1,
|
|
10758
|
-
variant
|
|
10759
|
-
}
|
|
10760
|
-
)
|
|
10761
|
-
]
|
|
11133
|
+
...splitButtonProps,
|
|
11134
|
+
"aria-checked": selected,
|
|
11135
|
+
className: (0, import_clsx34.default)(classBase24, className),
|
|
11136
|
+
ref: forwardedRef
|
|
10762
11137
|
}
|
|
10763
11138
|
);
|
|
10764
|
-
};
|
|
11139
|
+
});
|
|
10765
11140
|
|
|
10766
11141
|
// src/tabstrip/Tabstrip.tsx
|
|
10767
|
-
var
|
|
10768
|
-
var
|
|
10769
|
-
var
|
|
11142
|
+
var import_vuu_utils35 = require("@vuu-ui/vuu-utils");
|
|
11143
|
+
var import_clsx35 = __toESM(require("clsx"));
|
|
11144
|
+
var import_react82 = __toESM(require("react"));
|
|
10770
11145
|
|
|
10771
11146
|
// src/tabstrip/useTabstrip.ts
|
|
10772
|
-
var
|
|
10773
|
-
var
|
|
11147
|
+
var import_vuu_utils34 = require("@vuu-ui/vuu-utils");
|
|
11148
|
+
var import_react81 = require("react");
|
|
10774
11149
|
|
|
10775
11150
|
// src/tabstrip/TabMenuOptions.ts
|
|
10776
11151
|
var isTabMenuOptions = (options) => typeof options === "object" && options !== null && "tabIndex" in options && typeof options.tabIndex === "number";
|
|
@@ -10788,13 +11163,13 @@ var renameCommand = (options) => ({
|
|
|
10788
11163
|
});
|
|
10789
11164
|
|
|
10790
11165
|
// src/tabstrip/tabstrip-dom-utils.ts
|
|
10791
|
-
var
|
|
11166
|
+
var import_vuu_utils30 = require("@vuu-ui/vuu-utils");
|
|
10792
11167
|
var getIndexOfItem = (container, query) => {
|
|
10793
11168
|
if (container) {
|
|
10794
11169
|
const targetTab = container.querySelector(
|
|
10795
11170
|
`[data-index]:has(${query})`
|
|
10796
11171
|
);
|
|
10797
|
-
return (0,
|
|
11172
|
+
return (0, import_vuu_utils30.getElementDataIndex)(targetTab);
|
|
10798
11173
|
}
|
|
10799
11174
|
return -1;
|
|
10800
11175
|
};
|
|
@@ -10802,23 +11177,23 @@ var getIndexOfSelectedTab = (container) => getIndexOfItem(container, '[aria-sele
|
|
|
10802
11177
|
var getIndexOfEditedItem = (container) => getIndexOfItem(container, ".vuuEditableLabel-editing");
|
|
10803
11178
|
|
|
10804
11179
|
// src/tabstrip/useAnimatedSelectionThumb.ts
|
|
10805
|
-
var
|
|
10806
|
-
var
|
|
11180
|
+
var import_vuu_utils31 = require("@vuu-ui/vuu-utils");
|
|
11181
|
+
var import_react78 = require("react");
|
|
10807
11182
|
var useAnimatedSelectionThumb = (containerRef, activeTabIndex, orientation = "horizontal") => {
|
|
10808
|
-
const animationSuspendedRef = (0,
|
|
10809
|
-
const suspendAnimation = (0,
|
|
11183
|
+
const animationSuspendedRef = (0, import_react78.useRef)(false);
|
|
11184
|
+
const suspendAnimation = (0, import_react78.useCallback)(() => {
|
|
10810
11185
|
animationSuspendedRef.current = true;
|
|
10811
11186
|
}, []);
|
|
10812
|
-
const resumeAnimation = (0,
|
|
11187
|
+
const resumeAnimation = (0, import_react78.useCallback)(() => {
|
|
10813
11188
|
animationSuspendedRef.current = false;
|
|
10814
11189
|
}, []);
|
|
10815
|
-
const onTransitionEnd = (0,
|
|
11190
|
+
const onTransitionEnd = (0, import_react78.useCallback)(() => {
|
|
10816
11191
|
var _a2, _b;
|
|
10817
11192
|
(_a2 = containerRef.current) == null ? void 0 : _a2.style.setProperty("--tab-thumb-transition", "none");
|
|
10818
11193
|
(_b = containerRef.current) == null ? void 0 : _b.removeEventListener("transitionend", onTransitionEnd);
|
|
10819
11194
|
}, [containerRef]);
|
|
10820
|
-
const lastSelectedRef = (0,
|
|
10821
|
-
return (0,
|
|
11195
|
+
const lastSelectedRef = (0, import_react78.useRef)(-1);
|
|
11196
|
+
return (0, import_react78.useMemo)(() => {
|
|
10822
11197
|
var _a2, _b;
|
|
10823
11198
|
let offset = 0;
|
|
10824
11199
|
let size = 0;
|
|
@@ -10827,11 +11202,11 @@ var useAnimatedSelectionThumb = (containerRef, activeTabIndex, orientation = "ho
|
|
|
10827
11202
|
const newSelected = (_b = containerRef.current) == null ? void 0 : _b.querySelector(
|
|
10828
11203
|
`[data-index="${activeTabIndex}"] .vuuTab`
|
|
10829
11204
|
);
|
|
10830
|
-
const { positionProp, sizeProp } =
|
|
11205
|
+
const { positionProp, sizeProp } = import_vuu_utils31.MEASURES[orientation];
|
|
10831
11206
|
if (oldSelected && newSelected && !animationSuspendedRef.current) {
|
|
10832
11207
|
const { [positionProp]: oldPosition, [sizeProp]: oldSize } = oldSelected.getBoundingClientRect();
|
|
10833
11208
|
const { [positionProp]: newPosition } = newSelected.getBoundingClientRect();
|
|
10834
|
-
if ((0,
|
|
11209
|
+
if ((0, import_vuu_utils31.isValidNumber)(oldPosition) && (0, import_vuu_utils31.isValidNumber)(newPosition) && (0, import_vuu_utils31.isValidNumber)(oldSize)) {
|
|
10835
11210
|
offset = oldPosition - newPosition;
|
|
10836
11211
|
size = oldSize;
|
|
10837
11212
|
const speed = orientation === "horizontal" ? 1100 : 700;
|
|
@@ -10886,26 +11261,26 @@ var useAnimatedSelectionThumb = (containerRef, activeTabIndex, orientation = "ho
|
|
|
10886
11261
|
};
|
|
10887
11262
|
|
|
10888
11263
|
// src/tabstrip/useKeyboardNavigation.ts
|
|
10889
|
-
var
|
|
10890
|
-
var
|
|
10891
|
-
var
|
|
10892
|
-
var
|
|
11264
|
+
var import_core32 = require("@salt-ds/core");
|
|
11265
|
+
var import_vuu_utils32 = require("@vuu-ui/vuu-utils");
|
|
11266
|
+
var import_react79 = require("react");
|
|
11267
|
+
var import_vuu_utils33 = require("@vuu-ui/vuu-utils");
|
|
10893
11268
|
var navigation = {
|
|
10894
11269
|
horizontal: {
|
|
10895
|
-
[
|
|
10896
|
-
[
|
|
10897
|
-
[
|
|
10898
|
-
[
|
|
11270
|
+
[import_vuu_utils33.Home]: "start",
|
|
11271
|
+
[import_vuu_utils33.End]: "end",
|
|
11272
|
+
[import_vuu_utils33.ArrowLeft]: "bwd",
|
|
11273
|
+
[import_vuu_utils33.ArrowRight]: "fwd"
|
|
10899
11274
|
},
|
|
10900
11275
|
vertical: {
|
|
10901
|
-
[
|
|
10902
|
-
[
|
|
10903
|
-
[
|
|
10904
|
-
[
|
|
11276
|
+
[import_vuu_utils33.Home]: "start",
|
|
11277
|
+
[import_vuu_utils33.End]: "end",
|
|
11278
|
+
[import_vuu_utils33.ArrowUp]: "bwd",
|
|
11279
|
+
[import_vuu_utils33.ArrowDown]: "fwd"
|
|
10905
11280
|
}
|
|
10906
11281
|
};
|
|
10907
11282
|
var isNavigationKey2 = (key, orientation = "horizontal") => navigation[orientation][key] !== void 0;
|
|
10908
|
-
var isMenuActivationKey = (key) => key ===
|
|
11283
|
+
var isMenuActivationKey = (key) => key === import_vuu_utils33.ArrowDown;
|
|
10909
11284
|
function nextItemIdx2(count, direction, idx) {
|
|
10910
11285
|
if (direction === "start") {
|
|
10911
11286
|
return 0;
|
|
@@ -10938,23 +11313,23 @@ var useKeyboardNavigation2 = ({
|
|
|
10938
11313
|
selectedIndex: selectedTabIndex = 0
|
|
10939
11314
|
}) => {
|
|
10940
11315
|
const manualActivation = keyBoardActivation === "manual";
|
|
10941
|
-
const mouseClickPending = (0,
|
|
10942
|
-
const focusedRef = (0,
|
|
10943
|
-
const [hasFocus, setHasFocus] = (0,
|
|
10944
|
-
const [, forceRefresh] = (0,
|
|
10945
|
-
const [highlightedIdx, _setHighlightedIdx] = (0,
|
|
11316
|
+
const mouseClickPending = (0, import_react79.useRef)(false);
|
|
11317
|
+
const focusedRef = (0, import_react79.useRef)(-1);
|
|
11318
|
+
const [hasFocus, setHasFocus] = (0, import_react79.useState)(false);
|
|
11319
|
+
const [, forceRefresh] = (0, import_react79.useState)({});
|
|
11320
|
+
const [highlightedIdx, _setHighlightedIdx] = (0, import_core32.useControlled)({
|
|
10946
11321
|
controlled: highlightedIdxProp,
|
|
10947
11322
|
default: defaultHighlightedIdx,
|
|
10948
11323
|
name: "UseKeyboardNavigation"
|
|
10949
11324
|
});
|
|
10950
|
-
const setHighlightedIdx = (0,
|
|
11325
|
+
const setHighlightedIdx = (0, import_react79.useCallback)(
|
|
10951
11326
|
(value) => {
|
|
10952
11327
|
_setHighlightedIdx(focusedRef.current = value);
|
|
10953
11328
|
},
|
|
10954
11329
|
[_setHighlightedIdx]
|
|
10955
11330
|
);
|
|
10956
|
-
const keyboardNavigation = (0,
|
|
10957
|
-
const focusTab = (0,
|
|
11331
|
+
const keyboardNavigation = (0, import_react79.useRef)(false);
|
|
11332
|
+
const focusTab = (0, import_react79.useCallback)(
|
|
10958
11333
|
(tabIndex, immediateFocus = false, withKeyboard, delay = 70) => {
|
|
10959
11334
|
setHighlightedIdx(tabIndex);
|
|
10960
11335
|
if (withKeyboard === true && !keyboardNavigation.current) {
|
|
@@ -10963,7 +11338,7 @@ var useKeyboardNavigation2 = ({
|
|
|
10963
11338
|
const setFocus = () => {
|
|
10964
11339
|
const element = getElementByPosition(containerRef.current, tabIndex);
|
|
10965
11340
|
if (element) {
|
|
10966
|
-
const focussableElement = (0,
|
|
11341
|
+
const focussableElement = (0, import_vuu_utils32.getFocusableElement)(element);
|
|
10967
11342
|
focussableElement == null ? void 0 : focussableElement.focus();
|
|
10968
11343
|
}
|
|
10969
11344
|
};
|
|
@@ -10994,14 +11369,14 @@ var useKeyboardNavigation2 = ({
|
|
|
10994
11369
|
}
|
|
10995
11370
|
}
|
|
10996
11371
|
};
|
|
10997
|
-
const getIndexCount = (0,
|
|
11372
|
+
const getIndexCount = (0, import_react79.useCallback)(
|
|
10998
11373
|
() => {
|
|
10999
11374
|
var _a2, _b;
|
|
11000
11375
|
return (_b = (_a2 = containerRef.current) == null ? void 0 : _a2.querySelectorAll(`[data-index]`).length) != null ? _b : 0;
|
|
11001
11376
|
},
|
|
11002
11377
|
[containerRef]
|
|
11003
11378
|
);
|
|
11004
|
-
const nextFocusableItemIdx = (0,
|
|
11379
|
+
const nextFocusableItemIdx = (0, import_react79.useCallback)(
|
|
11005
11380
|
(direction = "fwd", idx) => {
|
|
11006
11381
|
const indexCount = getIndexCount();
|
|
11007
11382
|
const index = typeof idx === "number" ? idx : indexCount;
|
|
@@ -11021,7 +11396,7 @@ var useKeyboardNavigation2 = ({
|
|
|
11021
11396
|
},
|
|
11022
11397
|
[containerRef, getIndexCount]
|
|
11023
11398
|
);
|
|
11024
|
-
const navigateChildItems = (0,
|
|
11399
|
+
const navigateChildItems = (0, import_react79.useCallback)(
|
|
11025
11400
|
(e, forceFocusVisible = false) => {
|
|
11026
11401
|
const direction = navigation[orientation][e.key];
|
|
11027
11402
|
const nextIdx = nextFocusableItemIdx(direction, highlightedIdx);
|
|
@@ -11043,22 +11418,22 @@ var useKeyboardNavigation2 = ({
|
|
|
11043
11418
|
orientation
|
|
11044
11419
|
]
|
|
11045
11420
|
);
|
|
11046
|
-
const highlightedTabHasMenu = (0,
|
|
11421
|
+
const highlightedTabHasMenu = (0, import_react79.useCallback)(() => {
|
|
11047
11422
|
const el = getElementByPosition(containerRef.current, highlightedIdx);
|
|
11048
11423
|
if (el) {
|
|
11049
11424
|
return el.querySelector(".vuuPopupMenu") != null;
|
|
11050
11425
|
}
|
|
11051
11426
|
return false;
|
|
11052
11427
|
}, [containerRef, highlightedIdx]);
|
|
11053
|
-
const activateTabMenu = (0,
|
|
11428
|
+
const activateTabMenu = (0, import_react79.useCallback)(() => {
|
|
11054
11429
|
const el = getElementByPosition(containerRef.current, highlightedIdx);
|
|
11055
11430
|
const menuEl = el == null ? void 0 : el.querySelector(".vuuPopupMenu");
|
|
11056
11431
|
if (menuEl) {
|
|
11057
|
-
(0,
|
|
11432
|
+
(0, import_vuu_utils32.dispatchMouseEvent)(menuEl, "click");
|
|
11058
11433
|
}
|
|
11059
11434
|
return false;
|
|
11060
11435
|
}, [containerRef, highlightedIdx]);
|
|
11061
|
-
const handleKeyDown = (0,
|
|
11436
|
+
const handleKeyDown = (0, import_react79.useCallback)(
|
|
11062
11437
|
(e) => {
|
|
11063
11438
|
if (getIndexCount() > 0 && isNavigationKey2(e.key, orientation)) {
|
|
11064
11439
|
e.preventDefault();
|
|
@@ -11083,7 +11458,7 @@ var useKeyboardNavigation2 = ({
|
|
|
11083
11458
|
const handleItemClick = (_, tabIndex) => {
|
|
11084
11459
|
setHighlightedIdx(tabIndex);
|
|
11085
11460
|
};
|
|
11086
|
-
const handleFocus = (0,
|
|
11461
|
+
const handleFocus = (0, import_react79.useCallback)(() => {
|
|
11087
11462
|
if (!hasFocus) {
|
|
11088
11463
|
setHasFocus(true);
|
|
11089
11464
|
if (!mouseClickPending.current) {
|
|
@@ -11093,7 +11468,7 @@ var useKeyboardNavigation2 = ({
|
|
|
11093
11468
|
}
|
|
11094
11469
|
}
|
|
11095
11470
|
}, [hasFocus]);
|
|
11096
|
-
const handleContainerMouseDown = (0,
|
|
11471
|
+
const handleContainerMouseDown = (0, import_react79.useCallback)(() => {
|
|
11097
11472
|
if (!hasFocus) {
|
|
11098
11473
|
mouseClickPending.current = true;
|
|
11099
11474
|
}
|
|
@@ -11130,8 +11505,8 @@ var useKeyboardNavigation2 = ({
|
|
|
11130
11505
|
};
|
|
11131
11506
|
|
|
11132
11507
|
// src/tabstrip/useSelection.ts
|
|
11133
|
-
var
|
|
11134
|
-
var
|
|
11508
|
+
var import_core33 = require("@salt-ds/core");
|
|
11509
|
+
var import_react80 = require("react");
|
|
11135
11510
|
var defaultSelectionKeys2 = ["Enter", " "];
|
|
11136
11511
|
var isTabElement = (el) => el && el.matches('[class*="vuuTab "]');
|
|
11137
11512
|
var useSelection2 = ({
|
|
@@ -11140,24 +11515,24 @@ var useSelection2 = ({
|
|
|
11140
11515
|
onSelectionChange,
|
|
11141
11516
|
selected: selectedProp
|
|
11142
11517
|
}) => {
|
|
11143
|
-
const [selected, setSelected, isControlled] = (0,
|
|
11518
|
+
const [selected, setSelected, isControlled] = (0, import_core33.useControlled)({
|
|
11144
11519
|
controlled: selectedProp,
|
|
11145
11520
|
default: defaultSelected != null ? defaultSelected : 0,
|
|
11146
11521
|
name: "Tabstrip",
|
|
11147
11522
|
state: "value"
|
|
11148
11523
|
});
|
|
11149
|
-
const isSelectionEvent = (0,
|
|
11524
|
+
const isSelectionEvent = (0, import_react80.useCallback)(
|
|
11150
11525
|
(evt) => defaultSelectionKeys2.includes(evt.key),
|
|
11151
11526
|
[]
|
|
11152
11527
|
);
|
|
11153
|
-
const selectItem = (0,
|
|
11528
|
+
const selectItem = (0, import_react80.useCallback)(
|
|
11154
11529
|
(tabIndex) => {
|
|
11155
11530
|
setSelected(tabIndex);
|
|
11156
11531
|
onSelectionChange == null ? void 0 : onSelectionChange(tabIndex);
|
|
11157
11532
|
},
|
|
11158
11533
|
[onSelectionChange, setSelected]
|
|
11159
11534
|
);
|
|
11160
|
-
const handleKeyDown = (0,
|
|
11535
|
+
const handleKeyDown = (0, import_react80.useCallback)(
|
|
11161
11536
|
(e) => {
|
|
11162
11537
|
const targetElement = e.target;
|
|
11163
11538
|
if (isSelectionEvent(e) && highlightedIdx !== selected && isTabElement(targetElement)) {
|
|
@@ -11168,7 +11543,7 @@ var useSelection2 = ({
|
|
|
11168
11543
|
},
|
|
11169
11544
|
[isSelectionEvent, highlightedIdx, selected, selectItem]
|
|
11170
11545
|
);
|
|
11171
|
-
const onClick = (0,
|
|
11546
|
+
const onClick = (0, import_react80.useCallback)(
|
|
11172
11547
|
(e, tabIndex) => {
|
|
11173
11548
|
if (tabIndex !== selected) {
|
|
11174
11549
|
selectItem(tabIndex);
|
|
@@ -11208,7 +11583,7 @@ var useTabstrip = ({
|
|
|
11208
11583
|
orientation,
|
|
11209
11584
|
keyBoardActivation
|
|
11210
11585
|
}) => {
|
|
11211
|
-
const lastSelection = (0,
|
|
11586
|
+
const lastSelection = (0, import_react81.useRef)(activeTabIndexProp);
|
|
11212
11587
|
const {
|
|
11213
11588
|
focusTab: keyboardHookFocusTab,
|
|
11214
11589
|
highlightedIdx,
|
|
@@ -11238,7 +11613,7 @@ var useTabstrip = ({
|
|
|
11238
11613
|
animateSelectionThumb ? selectionHookSelected : -1,
|
|
11239
11614
|
orientation
|
|
11240
11615
|
);
|
|
11241
|
-
const handleDrop = (0,
|
|
11616
|
+
const handleDrop = (0, import_react81.useCallback)(
|
|
11242
11617
|
({ fromIndex, toIndex }) => {
|
|
11243
11618
|
const { current: selected } = lastSelection;
|
|
11244
11619
|
console.log(
|
|
@@ -11280,7 +11655,7 @@ var useTabstrip = ({
|
|
|
11280
11655
|
orientation: "horizontal",
|
|
11281
11656
|
itemQuery: ".vuuOverflowContainer-item"
|
|
11282
11657
|
});
|
|
11283
|
-
const handleExitEditMode = (0,
|
|
11658
|
+
const handleExitEditMode = (0, import_react81.useCallback)(
|
|
11284
11659
|
(originalValue, editedValue, allowDeactivation, tabIndex) => {
|
|
11285
11660
|
console.log(
|
|
11286
11661
|
`handleExitEditMode ${originalValue} ${editedValue} ${allowDeactivation} ${tabIndex}`
|
|
@@ -11292,7 +11667,7 @@ var useTabstrip = ({
|
|
|
11292
11667
|
},
|
|
11293
11668
|
[keyboardHookFocusTab, onExitEditMode]
|
|
11294
11669
|
);
|
|
11295
|
-
const handleClick = (0,
|
|
11670
|
+
const handleClick = (0, import_react81.useCallback)(
|
|
11296
11671
|
(evt, tabIndex) => {
|
|
11297
11672
|
keyboardHookHandleClick(evt, tabIndex);
|
|
11298
11673
|
selectionHookHandleClick(evt, tabIndex);
|
|
@@ -11300,7 +11675,7 @@ var useTabstrip = ({
|
|
|
11300
11675
|
// [dragDropHook.isDragging, keyboardHook, selectionHook]
|
|
11301
11676
|
[keyboardHookHandleClick, selectionHookHandleClick]
|
|
11302
11677
|
);
|
|
11303
|
-
const getEditableLabel = (0,
|
|
11678
|
+
const getEditableLabel = (0, import_react81.useCallback)(
|
|
11304
11679
|
(tabIndex = highlightedIdx) => {
|
|
11305
11680
|
const targetEl = getElementWithIndex(containerRef.current, tabIndex);
|
|
11306
11681
|
if (targetEl) {
|
|
@@ -11309,7 +11684,7 @@ var useTabstrip = ({
|
|
|
11309
11684
|
},
|
|
11310
11685
|
[containerRef, highlightedIdx]
|
|
11311
11686
|
);
|
|
11312
|
-
const tabInEditMode = (0,
|
|
11687
|
+
const tabInEditMode = (0, import_react81.useCallback)(
|
|
11313
11688
|
(tabIndex = highlightedIdx) => {
|
|
11314
11689
|
const editableLabel = getEditableLabel(tabIndex);
|
|
11315
11690
|
if (editableLabel) {
|
|
@@ -11319,16 +11694,16 @@ var useTabstrip = ({
|
|
|
11319
11694
|
},
|
|
11320
11695
|
[getEditableLabel, highlightedIdx]
|
|
11321
11696
|
);
|
|
11322
|
-
const editTab = (0,
|
|
11697
|
+
const editTab = (0, import_react81.useCallback)(
|
|
11323
11698
|
(tabIndex = highlightedIdx) => {
|
|
11324
11699
|
const editableLabelEl = getEditableLabel(tabIndex);
|
|
11325
11700
|
if (editableLabelEl) {
|
|
11326
|
-
(0,
|
|
11701
|
+
(0, import_vuu_utils34.dispatchMouseEvent)(editableLabelEl, "dblclick");
|
|
11327
11702
|
}
|
|
11328
11703
|
},
|
|
11329
11704
|
[getEditableLabel, highlightedIdx]
|
|
11330
11705
|
);
|
|
11331
|
-
const handleKeyDown = (0,
|
|
11706
|
+
const handleKeyDown = (0, import_react81.useCallback)(
|
|
11332
11707
|
(evt) => {
|
|
11333
11708
|
keyboardHookHandleKeyDown(evt);
|
|
11334
11709
|
if (!evt.defaultPrevented) {
|
|
@@ -11340,7 +11715,7 @@ var useTabstrip = ({
|
|
|
11340
11715
|
},
|
|
11341
11716
|
[editTab, keyboardHookHandleKeyDown, selectionHookHandleKeyDown]
|
|
11342
11717
|
);
|
|
11343
|
-
const handleCloseTabFromMenu = (0,
|
|
11718
|
+
const handleCloseTabFromMenu = (0, import_react81.useCallback)(
|
|
11344
11719
|
(tabIndex) => {
|
|
11345
11720
|
const selectedTabIndex = getIndexOfSelectedTab(containerRef.current);
|
|
11346
11721
|
const newActiveTabIndex = selectedTabIndex > tabIndex ? selectedTabIndex - 1 : selectedTabIndex === tabIndex ? 0 : selectedTabIndex;
|
|
@@ -11353,14 +11728,14 @@ var useTabstrip = ({
|
|
|
11353
11728
|
},
|
|
11354
11729
|
[containerRef, onCloseTab, resumeAnimation, suspendAnimation]
|
|
11355
11730
|
);
|
|
11356
|
-
const handleRenameTabFromMenu = (0,
|
|
11731
|
+
const handleRenameTabFromMenu = (0, import_react81.useCallback)(
|
|
11357
11732
|
(tabIndex) => {
|
|
11358
11733
|
editTab(tabIndex);
|
|
11359
11734
|
return true;
|
|
11360
11735
|
},
|
|
11361
11736
|
[editTab]
|
|
11362
11737
|
);
|
|
11363
|
-
const handleTabMenuAction = (0,
|
|
11738
|
+
const handleTabMenuAction = (0, import_react81.useCallback)(
|
|
11364
11739
|
(action) => {
|
|
11365
11740
|
if (isTabMenuOptions(action.options)) {
|
|
11366
11741
|
switch (action.menuId) {
|
|
@@ -11376,7 +11751,7 @@ var useTabstrip = ({
|
|
|
11376
11751
|
},
|
|
11377
11752
|
[handleCloseTabFromMenu, handleRenameTabFromMenu]
|
|
11378
11753
|
);
|
|
11379
|
-
const handleTabMenuClose = (0,
|
|
11754
|
+
const handleTabMenuClose = (0, import_react81.useCallback)(() => {
|
|
11380
11755
|
if (!tabInEditMode()) {
|
|
11381
11756
|
keyboardHookFocusTab(highlightedIdx);
|
|
11382
11757
|
} else {
|
|
@@ -11388,7 +11763,7 @@ var useTabstrip = ({
|
|
|
11388
11763
|
keyboardHookSetHighlightedIndex,
|
|
11389
11764
|
tabInEditMode
|
|
11390
11765
|
]);
|
|
11391
|
-
const onSwitchWrappedItemIntoView = (0,
|
|
11766
|
+
const onSwitchWrappedItemIntoView = (0, import_react81.useCallback)(
|
|
11392
11767
|
(item) => {
|
|
11393
11768
|
const index = parseInt(item.index);
|
|
11394
11769
|
if (!isNaN(index)) {
|
|
@@ -11401,7 +11776,7 @@ var useTabstrip = ({
|
|
|
11401
11776
|
onFocus: keyboardHook.onFocus,
|
|
11402
11777
|
onKeyDown: handleKeyDown
|
|
11403
11778
|
};
|
|
11404
|
-
const handleAddTabClick = (0,
|
|
11779
|
+
const handleAddTabClick = (0, import_react81.useCallback)(() => {
|
|
11405
11780
|
onAddTab == null ? void 0 : onAddTab();
|
|
11406
11781
|
requestAnimationFrame(() => {
|
|
11407
11782
|
const selectedTabIndex = getIndexOfSelectedTab(containerRef.current);
|
|
@@ -11434,9 +11809,9 @@ var useTabstrip = ({
|
|
|
11434
11809
|
};
|
|
11435
11810
|
|
|
11436
11811
|
// src/tabstrip/Tabstrip.tsx
|
|
11437
|
-
var
|
|
11438
|
-
var
|
|
11439
|
-
var
|
|
11812
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
11813
|
+
var import_react83 = require("react");
|
|
11814
|
+
var classBase25 = "vuuTabstrip";
|
|
11440
11815
|
var Tabstrip = ({
|
|
11441
11816
|
activeTabIndex: activeTabIndexProp,
|
|
11442
11817
|
allowAddTab,
|
|
@@ -11458,9 +11833,10 @@ var Tabstrip = ({
|
|
|
11458
11833
|
showTabMenuButton,
|
|
11459
11834
|
style: styleProp,
|
|
11460
11835
|
tabClassName,
|
|
11836
|
+
variant = "secondary",
|
|
11461
11837
|
...htmlAttributes
|
|
11462
11838
|
}) => {
|
|
11463
|
-
const rootRef = (0,
|
|
11839
|
+
const rootRef = (0, import_react82.useRef)(null);
|
|
11464
11840
|
const {
|
|
11465
11841
|
activeTabIndex,
|
|
11466
11842
|
focusVisible,
|
|
@@ -11482,14 +11858,14 @@ var Tabstrip = ({
|
|
|
11482
11858
|
onMoveTab,
|
|
11483
11859
|
orientation
|
|
11484
11860
|
});
|
|
11485
|
-
const id = (0,
|
|
11486
|
-
const className = (0,
|
|
11861
|
+
const id = (0, import_vuu_utils35.useId)(idProp);
|
|
11862
|
+
const className = (0, import_clsx35.default)(classBase25, classNameProp);
|
|
11487
11863
|
const style = styleProp || containerStyle ? {
|
|
11488
11864
|
...styleProp,
|
|
11489
11865
|
...containerStyle
|
|
11490
11866
|
} : void 0;
|
|
11491
|
-
const tabs = (0,
|
|
11492
|
-
() => (0,
|
|
11867
|
+
const tabs = (0, import_react82.useMemo)(
|
|
11868
|
+
() => (0, import_vuu_utils35.asReactElements)(children).map((child, index) => {
|
|
11493
11869
|
const {
|
|
11494
11870
|
id: tabId = `${id}-tab-${index}`,
|
|
11495
11871
|
className: className2,
|
|
@@ -11499,10 +11875,10 @@ var Tabstrip = ({
|
|
|
11499
11875
|
showMenuButton = showTabMenuButton
|
|
11500
11876
|
} = child.props;
|
|
11501
11877
|
const selected = index === activeTabIndex;
|
|
11502
|
-
return
|
|
11878
|
+
return import_react82.default.cloneElement(child, {
|
|
11503
11879
|
...tabProps,
|
|
11504
11880
|
...tabstripHook.navigationProps,
|
|
11505
|
-
className: (0,
|
|
11881
|
+
className: (0, import_clsx35.default)(className2, tabClassName),
|
|
11506
11882
|
closeable,
|
|
11507
11883
|
"data-overflow-priority": selected ? "1" : void 0,
|
|
11508
11884
|
dragging: draggedItemIndex === index,
|
|
@@ -11511,18 +11887,19 @@ var Tabstrip = ({
|
|
|
11511
11887
|
id: tabId,
|
|
11512
11888
|
index,
|
|
11513
11889
|
key: index,
|
|
11514
|
-
location: (0,
|
|
11890
|
+
location: (0, import_clsx35.default)(location, tabLocation),
|
|
11515
11891
|
selected,
|
|
11516
11892
|
showMenuButton,
|
|
11517
11893
|
tabIndex: selected ? 0 : -1
|
|
11518
11894
|
});
|
|
11519
11895
|
}).concat(
|
|
11520
|
-
allowAddTab ? /* @__PURE__ */ (0,
|
|
11896
|
+
allowAddTab ? /* @__PURE__ */ (0, import_react83.createElement)(
|
|
11521
11897
|
IconButton,
|
|
11522
11898
|
{
|
|
11523
11899
|
...tabstripHook.navigationProps,
|
|
11524
11900
|
"aria-label": "Create Tab",
|
|
11525
|
-
className: `${
|
|
11901
|
+
className: `${classBase25}-addTabButton`,
|
|
11902
|
+
"data-embedded": true,
|
|
11526
11903
|
icon: "add",
|
|
11527
11904
|
"data-overflow-priority": "1",
|
|
11528
11905
|
key: "addButton",
|
|
@@ -11549,14 +11926,13 @@ var Tabstrip = ({
|
|
|
11549
11926
|
location
|
|
11550
11927
|
]
|
|
11551
11928
|
);
|
|
11552
|
-
return /* @__PURE__ */ (0,
|
|
11553
|
-
/* @__PURE__ */ (0,
|
|
11929
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
11930
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
11554
11931
|
OverflowContainer,
|
|
11555
11932
|
{
|
|
11556
11933
|
...htmlAttributes,
|
|
11557
11934
|
...tabstripHook.containerProps,
|
|
11558
|
-
className,
|
|
11559
|
-
height: 29,
|
|
11935
|
+
className: (0, import_clsx35.default)(className, `${classBase25}-${variant}`),
|
|
11560
11936
|
id,
|
|
11561
11937
|
orientation,
|
|
11562
11938
|
overflowIcon: "more-horiz",
|
|
@@ -11571,16 +11947,16 @@ var Tabstrip = ({
|
|
|
11571
11947
|
};
|
|
11572
11948
|
|
|
11573
11949
|
// src/tabstrip/Tab.tsx
|
|
11574
|
-
var
|
|
11575
|
-
var
|
|
11576
|
-
var
|
|
11950
|
+
var import_core34 = require("@salt-ds/core");
|
|
11951
|
+
var import_clsx37 = __toESM(require("clsx"));
|
|
11952
|
+
var import_react85 = require("react");
|
|
11577
11953
|
|
|
11578
11954
|
// src/tabstrip/TabMenu.tsx
|
|
11579
11955
|
var import_vuu_popups6 = require("@vuu-ui/vuu-popups");
|
|
11580
|
-
var
|
|
11581
|
-
var
|
|
11582
|
-
var
|
|
11583
|
-
var
|
|
11956
|
+
var import_react84 = require("react");
|
|
11957
|
+
var import_clsx36 = __toESM(require("clsx"));
|
|
11958
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
11959
|
+
var classBase26 = "vuuTabMenu";
|
|
11584
11960
|
var TabMenu = ({
|
|
11585
11961
|
allowClose,
|
|
11586
11962
|
allowRename,
|
|
@@ -11591,7 +11967,7 @@ var TabMenu = ({
|
|
|
11591
11967
|
onMenuClose,
|
|
11592
11968
|
index
|
|
11593
11969
|
}) => {
|
|
11594
|
-
const [menuBuilder, menuOptions] = (0,
|
|
11970
|
+
const [menuBuilder, menuOptions] = (0, import_react84.useMemo)(
|
|
11595
11971
|
() => [
|
|
11596
11972
|
(_location, options) => {
|
|
11597
11973
|
const menuItems = [];
|
|
@@ -11617,26 +11993,27 @@ var TabMenu = ({
|
|
|
11617
11993
|
index
|
|
11618
11994
|
]
|
|
11619
11995
|
);
|
|
11620
|
-
return /* @__PURE__ */ (0,
|
|
11996
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
11621
11997
|
import_vuu_popups6.PopupMenu,
|
|
11622
11998
|
{
|
|
11623
|
-
|
|
11999
|
+
"aria-label": "context menu",
|
|
12000
|
+
className: classBase26,
|
|
12001
|
+
"data-embedded": true,
|
|
11624
12002
|
menuBuilder,
|
|
11625
12003
|
menuActionHandler: onMenuAction,
|
|
11626
|
-
menuLocation: (0,
|
|
12004
|
+
menuLocation: (0, import_clsx36.default)("tab", location),
|
|
11627
12005
|
menuOptions,
|
|
11628
12006
|
onMenuClose,
|
|
11629
|
-
tabIndex: -1
|
|
11630
|
-
"aria-label": "context menu"
|
|
12007
|
+
tabIndex: -1
|
|
11631
12008
|
}
|
|
11632
12009
|
);
|
|
11633
12010
|
};
|
|
11634
12011
|
|
|
11635
12012
|
// src/tabstrip/Tab.tsx
|
|
11636
|
-
var
|
|
11637
|
-
var
|
|
12013
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
12014
|
+
var classBase27 = "vuuTab";
|
|
11638
12015
|
var noop2 = () => void 0;
|
|
11639
|
-
var Tab = (0,
|
|
12016
|
+
var Tab = (0, import_react85.forwardRef)(function Tab2({
|
|
11640
12017
|
ariaControls,
|
|
11641
12018
|
children,
|
|
11642
12019
|
className,
|
|
@@ -11665,10 +12042,10 @@ var Tab = (0, import_react78.forwardRef)(function Tab2({
|
|
|
11665
12042
|
if (showMenuButton && typeof onMenuAction !== "function") {
|
|
11666
12043
|
throw Error("Tab onMenuAction must be provided if showMenuButton is set");
|
|
11667
12044
|
}
|
|
11668
|
-
const rootRef = (0,
|
|
11669
|
-
const editableRef = (0,
|
|
11670
|
-
const setForkRef = (0,
|
|
11671
|
-
const handleClick = (0,
|
|
12045
|
+
const rootRef = (0, import_react85.useRef)(null);
|
|
12046
|
+
const editableRef = (0, import_react85.useRef)(null);
|
|
12047
|
+
const setForkRef = (0, import_core34.useForkRef)(ref, rootRef);
|
|
12048
|
+
const handleClick = (0, import_react85.useCallback)(
|
|
11672
12049
|
(e) => {
|
|
11673
12050
|
if (!editing) {
|
|
11674
12051
|
e.preventDefault();
|
|
@@ -11693,7 +12070,7 @@ var Tab = (0, import_react78.forwardRef)(function Tab2({
|
|
|
11693
12070
|
};
|
|
11694
12071
|
const getLabel = () => {
|
|
11695
12072
|
if (editable) {
|
|
11696
|
-
return /* @__PURE__ */ (0,
|
|
12073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
11697
12074
|
EditableLabel,
|
|
11698
12075
|
{
|
|
11699
12076
|
editing,
|
|
@@ -11718,18 +12095,18 @@ var Tab = (0, import_react78.forwardRef)(function Tab2({
|
|
|
11718
12095
|
}
|
|
11719
12096
|
onFocusProp == null ? void 0 : onFocusProp(evt);
|
|
11720
12097
|
};
|
|
11721
|
-
return /* @__PURE__ */ (0,
|
|
12098
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
11722
12099
|
"div",
|
|
11723
12100
|
{
|
|
11724
12101
|
...props,
|
|
11725
12102
|
"aria-controls": ariaControls,
|
|
11726
12103
|
"aria-selected": selected,
|
|
11727
|
-
className: (0,
|
|
11728
|
-
[`${
|
|
12104
|
+
className: (0, import_clsx37.default)(classBase27, className, {
|
|
12105
|
+
[`${classBase27}-closeable`]: closeable,
|
|
11729
12106
|
"vuuDraggable-dragAway": dragging,
|
|
11730
|
-
[`${
|
|
11731
|
-
[`${
|
|
11732
|
-
[`${
|
|
12107
|
+
[`${classBase27}-editing`]: editing,
|
|
12108
|
+
[`${classBase27}-selected`]: selected || void 0,
|
|
12109
|
+
[`${classBase27}-vertical`]: orientation === "vertical",
|
|
11733
12110
|
[`vuuFocusVisible`]: focusVisible
|
|
11734
12111
|
}),
|
|
11735
12112
|
onClick: handleClick,
|
|
@@ -11739,15 +12116,15 @@ var Tab = (0, import_react78.forwardRef)(function Tab2({
|
|
|
11739
12116
|
role: "tab",
|
|
11740
12117
|
tabIndex,
|
|
11741
12118
|
children: [
|
|
11742
|
-
/* @__PURE__ */ (0,
|
|
12119
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: `${classBase27}-main`, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
11743
12120
|
"span",
|
|
11744
12121
|
{
|
|
11745
|
-
className: `${
|
|
12122
|
+
className: `${classBase27}-text`,
|
|
11746
12123
|
"data-text": editable ? void 0 : label,
|
|
11747
12124
|
children: children != null ? children : getLabel()
|
|
11748
12125
|
}
|
|
11749
12126
|
) }),
|
|
11750
|
-
showMenuButton ? /* @__PURE__ */ (0,
|
|
12127
|
+
showMenuButton ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
11751
12128
|
TabMenu,
|
|
11752
12129
|
{
|
|
11753
12130
|
allowClose: closeable,
|
|
@@ -11766,28 +12143,28 @@ var Tab = (0, import_react78.forwardRef)(function Tab2({
|
|
|
11766
12143
|
});
|
|
11767
12144
|
|
|
11768
12145
|
// src/toolbar/Toolbar.tsx
|
|
11769
|
-
var
|
|
11770
|
-
var
|
|
11771
|
-
var
|
|
12146
|
+
var import_vuu_utils41 = require("@vuu-ui/vuu-utils");
|
|
12147
|
+
var import_clsx38 = __toESM(require("clsx"));
|
|
12148
|
+
var import_react89 = __toESM(require("react"));
|
|
11772
12149
|
|
|
11773
12150
|
// src/toolbar/useToolbar.ts
|
|
11774
|
-
var
|
|
11775
|
-
var
|
|
12151
|
+
var import_vuu_utils40 = require("@vuu-ui/vuu-utils");
|
|
12152
|
+
var import_react88 = require("react");
|
|
11776
12153
|
|
|
11777
12154
|
// src/toolbar/useKeyboardNavigation.ts
|
|
11778
|
-
var
|
|
11779
|
-
var
|
|
11780
|
-
var
|
|
11781
|
-
var
|
|
12155
|
+
var import_core35 = require("@salt-ds/core");
|
|
12156
|
+
var import_vuu_utils37 = require("@vuu-ui/vuu-utils");
|
|
12157
|
+
var import_react86 = require("react");
|
|
12158
|
+
var import_vuu_utils38 = require("@vuu-ui/vuu-utils");
|
|
11782
12159
|
|
|
11783
12160
|
// src/toolbar/toolbar-dom-utils.ts
|
|
11784
|
-
var
|
|
12161
|
+
var import_vuu_utils36 = require("@vuu-ui/vuu-utils");
|
|
11785
12162
|
var getIndexOfItem2 = (container, query) => {
|
|
11786
12163
|
if (container) {
|
|
11787
12164
|
const targetTab = container.querySelector(
|
|
11788
12165
|
`[data-index]:has(${query})`
|
|
11789
12166
|
);
|
|
11790
|
-
return (0,
|
|
12167
|
+
return (0, import_vuu_utils36.getElementDataIndex)(targetTab);
|
|
11791
12168
|
}
|
|
11792
12169
|
return -1;
|
|
11793
12170
|
};
|
|
@@ -11796,16 +12173,16 @@ var getIndexOfEditedItem2 = (container) => getIndexOfItem2(container, ".vuuEdita
|
|
|
11796
12173
|
// src/toolbar/useKeyboardNavigation.ts
|
|
11797
12174
|
var navigation2 = {
|
|
11798
12175
|
horizontal: {
|
|
11799
|
-
[
|
|
11800
|
-
[
|
|
11801
|
-
[
|
|
11802
|
-
[
|
|
12176
|
+
[import_vuu_utils38.Home]: "start",
|
|
12177
|
+
[import_vuu_utils38.End]: "end",
|
|
12178
|
+
[import_vuu_utils38.ArrowLeft]: "bwd",
|
|
12179
|
+
[import_vuu_utils38.ArrowRight]: "fwd"
|
|
11803
12180
|
},
|
|
11804
12181
|
vertical: {
|
|
11805
|
-
[
|
|
11806
|
-
[
|
|
11807
|
-
[
|
|
11808
|
-
[
|
|
12182
|
+
[import_vuu_utils38.Home]: "start",
|
|
12183
|
+
[import_vuu_utils38.End]: "end",
|
|
12184
|
+
[import_vuu_utils38.ArrowUp]: "bwd",
|
|
12185
|
+
[import_vuu_utils38.ArrowDown]: "fwd"
|
|
11809
12186
|
}
|
|
11810
12187
|
};
|
|
11811
12188
|
var isOverflowIndicator = (el) => el !== null && el.dataset.index === "overflow";
|
|
@@ -11824,7 +12201,7 @@ var itemIsNotFocusable = (container, direction, indexCount, nextIdx, hasOverflow
|
|
|
11824
12201
|
}
|
|
11825
12202
|
};
|
|
11826
12203
|
var isNavigationKey3 = (key, orientation = "horizontal") => navigation2[orientation][key] !== void 0;
|
|
11827
|
-
var isMenuActivationKey2 = (key) => key ===
|
|
12204
|
+
var isMenuActivationKey2 = (key) => key === import_vuu_utils38.ArrowDown;
|
|
11828
12205
|
function nextItemIdx3(count, direction, idx) {
|
|
11829
12206
|
if (direction === "start") {
|
|
11830
12207
|
return 0;
|
|
@@ -11876,22 +12253,22 @@ var useKeyboardNavigation3 = ({
|
|
|
11876
12253
|
onNavigateOutOfBounds,
|
|
11877
12254
|
orientation
|
|
11878
12255
|
}) => {
|
|
11879
|
-
const mouseClickPending = (0,
|
|
11880
|
-
const focusedRef = (0,
|
|
11881
|
-
const [hasFocus, setHasFocus] = (0,
|
|
11882
|
-
const [highlightedIdx, _setHighlightedIdx] = (0,
|
|
12256
|
+
const mouseClickPending = (0, import_react86.useRef)(false);
|
|
12257
|
+
const focusedRef = (0, import_react86.useRef)(-1);
|
|
12258
|
+
const [hasFocus, setHasFocus] = (0, import_react86.useState)(false);
|
|
12259
|
+
const [highlightedIdx, _setHighlightedIdx] = (0, import_core35.useControlled)({
|
|
11883
12260
|
controlled: highlightedIdxProp,
|
|
11884
12261
|
default: defaultHighlightedIdx,
|
|
11885
12262
|
name: "UseKeyboardNavigation"
|
|
11886
12263
|
});
|
|
11887
|
-
const setHighlightedIdx = (0,
|
|
12264
|
+
const setHighlightedIdx = (0, import_react86.useCallback)(
|
|
11888
12265
|
(value) => {
|
|
11889
12266
|
_setHighlightedIdx(focusedRef.current = value);
|
|
11890
12267
|
},
|
|
11891
12268
|
[_setHighlightedIdx]
|
|
11892
12269
|
);
|
|
11893
|
-
const keyboardNavigation = (0,
|
|
11894
|
-
const focusItem = (0,
|
|
12270
|
+
const keyboardNavigation = (0, import_react86.useRef)(false);
|
|
12271
|
+
const focusItem = (0, import_react86.useCallback)(
|
|
11895
12272
|
(itemIndex, immediateFocus = false, withKeyboard, delay = 70) => {
|
|
11896
12273
|
console.log(`focus item ${itemIndex}`);
|
|
11897
12274
|
setHighlightedIdx(itemIndex);
|
|
@@ -11905,7 +12282,7 @@ var useKeyboardNavigation3 = ({
|
|
|
11905
12282
|
true
|
|
11906
12283
|
);
|
|
11907
12284
|
if (element) {
|
|
11908
|
-
const focussableElement = (0,
|
|
12285
|
+
const focussableElement = (0, import_vuu_utils37.getFocusableElement)(element);
|
|
11909
12286
|
focussableElement == null ? void 0 : focussableElement.focus();
|
|
11910
12287
|
}
|
|
11911
12288
|
};
|
|
@@ -11920,7 +12297,7 @@ var useKeyboardNavigation3 = ({
|
|
|
11920
12297
|
const onFocus = (e) => {
|
|
11921
12298
|
if (focusedRef.current === -1) {
|
|
11922
12299
|
if (e.target.tabIndex === 0) {
|
|
11923
|
-
const index = (0,
|
|
12300
|
+
const index = (0, import_vuu_utils37.getElementDataIndex)((0, import_vuu_utils37.getClosest)(e.target, "index"));
|
|
11924
12301
|
setHighlightedIdx(index);
|
|
11925
12302
|
} else if (e.target.tabIndex === -1) {
|
|
11926
12303
|
} else {
|
|
@@ -11933,14 +12310,14 @@ var useKeyboardNavigation3 = ({
|
|
|
11933
12310
|
}
|
|
11934
12311
|
}
|
|
11935
12312
|
};
|
|
11936
|
-
const getIndexCount = (0,
|
|
12313
|
+
const getIndexCount = (0, import_react86.useCallback)(
|
|
11937
12314
|
() => {
|
|
11938
12315
|
var _a2, _b;
|
|
11939
12316
|
return (_b = (_a2 = containerRef.current) == null ? void 0 : _a2.querySelectorAll(`[data-index]`).length) != null ? _b : 0;
|
|
11940
12317
|
},
|
|
11941
12318
|
[containerRef]
|
|
11942
12319
|
);
|
|
11943
|
-
const nextFocusableItemIdx = (0,
|
|
12320
|
+
const nextFocusableItemIdx = (0, import_react86.useCallback)(
|
|
11944
12321
|
(direction = "fwd", idx) => {
|
|
11945
12322
|
var _a2;
|
|
11946
12323
|
const indexCount = getIndexCount();
|
|
@@ -11968,7 +12345,7 @@ var useKeyboardNavigation3 = ({
|
|
|
11968
12345
|
},
|
|
11969
12346
|
[containerRef, getIndexCount]
|
|
11970
12347
|
);
|
|
11971
|
-
const navigateChildItems = (0,
|
|
12348
|
+
const navigateChildItems = (0, import_react86.useCallback)(
|
|
11972
12349
|
(e) => {
|
|
11973
12350
|
const direction = navigation2[orientation][e.key];
|
|
11974
12351
|
const nextIdx = nextFocusableItemIdx(direction, highlightedIdx);
|
|
@@ -11988,29 +12365,29 @@ var useKeyboardNavigation3 = ({
|
|
|
11988
12365
|
onNavigateOutOfBounds
|
|
11989
12366
|
]
|
|
11990
12367
|
);
|
|
11991
|
-
const highlightedItemHasMenu = (0,
|
|
12368
|
+
const highlightedItemHasMenu = (0, import_react86.useCallback)(() => {
|
|
11992
12369
|
const el = getElementByPosition2(containerRef.current, highlightedIdx);
|
|
11993
12370
|
if (el) {
|
|
11994
12371
|
return el.querySelector(".vuuPopupMenu") != null;
|
|
11995
12372
|
}
|
|
11996
12373
|
return false;
|
|
11997
12374
|
}, [containerRef, highlightedIdx]);
|
|
11998
|
-
const highlightedItemInEditState = (0,
|
|
12375
|
+
const highlightedItemInEditState = (0, import_react86.useCallback)(() => {
|
|
11999
12376
|
const el = getElementByPosition2(containerRef.current, highlightedIdx);
|
|
12000
12377
|
if (el) {
|
|
12001
12378
|
return el.querySelector(".vuuEditableLabel-input") != null;
|
|
12002
12379
|
}
|
|
12003
12380
|
return false;
|
|
12004
12381
|
}, [containerRef, highlightedIdx]);
|
|
12005
|
-
const activateItemMenu = (0,
|
|
12382
|
+
const activateItemMenu = (0, import_react86.useCallback)(() => {
|
|
12006
12383
|
const el = getElementByPosition2(containerRef.current, highlightedIdx);
|
|
12007
12384
|
const menuEl = el == null ? void 0 : el.querySelector(".vuuPopupMenu");
|
|
12008
12385
|
if (menuEl) {
|
|
12009
|
-
(0,
|
|
12386
|
+
(0, import_vuu_utils37.dispatchMouseEvent)(menuEl, "click");
|
|
12010
12387
|
}
|
|
12011
12388
|
return false;
|
|
12012
12389
|
}, [containerRef, highlightedIdx]);
|
|
12013
|
-
const handleKeyDown = (0,
|
|
12390
|
+
const handleKeyDown = (0, import_react86.useCallback)(
|
|
12014
12391
|
(e) => {
|
|
12015
12392
|
if (getIndexCount() > 0 && isNavigationKey3(e.key, orientation)) {
|
|
12016
12393
|
e.preventDefault();
|
|
@@ -12036,7 +12413,7 @@ var useKeyboardNavigation3 = ({
|
|
|
12036
12413
|
const handleItemClick = (_, itemIndex) => {
|
|
12037
12414
|
setHighlightedIdx(itemIndex);
|
|
12038
12415
|
};
|
|
12039
|
-
const handleFocus = (0,
|
|
12416
|
+
const handleFocus = (0, import_react86.useCallback)(() => {
|
|
12040
12417
|
if (!hasFocus) {
|
|
12041
12418
|
setHasFocus(true);
|
|
12042
12419
|
if (!mouseClickPending.current) {
|
|
@@ -12046,13 +12423,13 @@ var useKeyboardNavigation3 = ({
|
|
|
12046
12423
|
}
|
|
12047
12424
|
}
|
|
12048
12425
|
}, [hasFocus]);
|
|
12049
|
-
const handleContainerMouseDown = (0,
|
|
12426
|
+
const handleContainerMouseDown = (0, import_react86.useCallback)(() => {
|
|
12050
12427
|
if (!hasFocus) {
|
|
12051
12428
|
mouseClickPending.current = true;
|
|
12052
12429
|
}
|
|
12053
12430
|
keyboardNavigation.current = false;
|
|
12054
12431
|
}, [hasFocus]);
|
|
12055
|
-
const handleOverflowMenuClose = (0,
|
|
12432
|
+
const handleOverflowMenuClose = (0, import_react86.useCallback)(
|
|
12056
12433
|
(closeReason) => {
|
|
12057
12434
|
if ((closeReason == null ? void 0 : closeReason.type) === "escape") {
|
|
12058
12435
|
const index = getIndexOfOverflowItem(containerRef.current);
|
|
@@ -12096,8 +12473,8 @@ var useKeyboardNavigation3 = ({
|
|
|
12096
12473
|
};
|
|
12097
12474
|
|
|
12098
12475
|
// src/toolbar/useSelection.ts
|
|
12099
|
-
var
|
|
12100
|
-
var
|
|
12476
|
+
var import_vuu_utils39 = require("@vuu-ui/vuu-utils");
|
|
12477
|
+
var import_react87 = require("react");
|
|
12101
12478
|
var defaultSelectionKeys3 = ["Enter", " "];
|
|
12102
12479
|
var NO_SELECTION_HANDLERS = {};
|
|
12103
12480
|
var useSelection3 = ({
|
|
@@ -12113,11 +12490,11 @@ var useSelection3 = ({
|
|
|
12113
12490
|
name: "useSelection",
|
|
12114
12491
|
state: "selected"
|
|
12115
12492
|
});
|
|
12116
|
-
const isSelectionEvent = (0,
|
|
12493
|
+
const isSelectionEvent = (0, import_react87.useCallback)(
|
|
12117
12494
|
(evt) => defaultSelectionKeys3.includes(evt.key),
|
|
12118
12495
|
[]
|
|
12119
12496
|
);
|
|
12120
|
-
const selectItem = (0,
|
|
12497
|
+
const selectItem = (0, import_react87.useCallback)(
|
|
12121
12498
|
(itemIndex, specialKey = false) => {
|
|
12122
12499
|
const newSelected = allowMultipleSelection(selectionStrategy, specialKey) ? selected.concat(itemIndex) : [itemIndex];
|
|
12123
12500
|
setSelected(newSelected);
|
|
@@ -12125,7 +12502,7 @@ var useSelection3 = ({
|
|
|
12125
12502
|
},
|
|
12126
12503
|
[onSelectionChange, selected, selectionStrategy, setSelected]
|
|
12127
12504
|
);
|
|
12128
|
-
const deselectItem = (0,
|
|
12505
|
+
const deselectItem = (0, import_react87.useCallback)(
|
|
12129
12506
|
(itemIndex, specialKey = false) => {
|
|
12130
12507
|
const newSelected = selectionStrategy === "deselectable" || selectionStrategy === "multiple-special-key" && !specialKey ? [] : selected.filter((index) => index !== itemIndex);
|
|
12131
12508
|
setSelected(newSelected);
|
|
@@ -12133,9 +12510,9 @@ var useSelection3 = ({
|
|
|
12133
12510
|
},
|
|
12134
12511
|
[onSelectionChange, selected, selectionStrategy, setSelected]
|
|
12135
12512
|
);
|
|
12136
|
-
const handleKeyDown = (0,
|
|
12513
|
+
const handleKeyDown = (0, import_react87.useCallback)(
|
|
12137
12514
|
(e) => {
|
|
12138
|
-
if (isSelectionEvent(e) && (0,
|
|
12515
|
+
if (isSelectionEvent(e) && (0, import_vuu_utils39.isSelectableElement)(e.target)) {
|
|
12139
12516
|
if (!selected.includes(highlightedIdx)) {
|
|
12140
12517
|
e.stopPropagation();
|
|
12141
12518
|
e.preventDefault();
|
|
@@ -12156,10 +12533,10 @@ var useSelection3 = ({
|
|
|
12156
12533
|
deselectItem
|
|
12157
12534
|
]
|
|
12158
12535
|
);
|
|
12159
|
-
const handleClick = (0,
|
|
12536
|
+
const handleClick = (0, import_react87.useCallback)(
|
|
12160
12537
|
(e, itemIndex) => {
|
|
12161
|
-
const element = (0,
|
|
12162
|
-
if ((0,
|
|
12538
|
+
const element = (0, import_vuu_utils39.getClosestIndexItem)(e.target);
|
|
12539
|
+
if ((0, import_vuu_utils39.isSelectableElement)(element)) {
|
|
12163
12540
|
if (!selected.includes(itemIndex)) {
|
|
12164
12541
|
selectItem(itemIndex, e.shiftKey);
|
|
12165
12542
|
} else if (deselectionIsAllowed(selectionStrategy)) {
|
|
@@ -12192,7 +12569,7 @@ var useToolbar = ({
|
|
|
12192
12569
|
orientation,
|
|
12193
12570
|
selectionStrategy
|
|
12194
12571
|
}) => {
|
|
12195
|
-
const lastSelection = (0,
|
|
12572
|
+
const lastSelection = (0, import_react88.useRef)(activeItemIndexProp);
|
|
12196
12573
|
const {
|
|
12197
12574
|
focusItem: keyboardHookFocusItem,
|
|
12198
12575
|
highlightedIdx,
|
|
@@ -12219,14 +12596,14 @@ var useToolbar = ({
|
|
|
12219
12596
|
selectionStrategy
|
|
12220
12597
|
});
|
|
12221
12598
|
lastSelection.current = selectionHookSelected;
|
|
12222
|
-
const handleClick = (0,
|
|
12599
|
+
const handleClick = (0, import_react88.useCallback)(
|
|
12223
12600
|
(evt) => {
|
|
12224
12601
|
var _a2;
|
|
12225
12602
|
const target = evt.target;
|
|
12226
12603
|
const toolbarItem = target.closest("[data-index]");
|
|
12227
12604
|
if (toolbarItem) {
|
|
12228
12605
|
const index = parseInt((_a2 = toolbarItem.dataset.index) != null ? _a2 : "-1");
|
|
12229
|
-
if (index !== -1 && (0,
|
|
12606
|
+
if (index !== -1 && (0, import_vuu_utils40.isValidNumber)(index)) {
|
|
12230
12607
|
keyboardHookHandleClick(evt, index);
|
|
12231
12608
|
onClick == null ? void 0 : onClick(evt, index);
|
|
12232
12609
|
}
|
|
@@ -12234,7 +12611,7 @@ var useToolbar = ({
|
|
|
12234
12611
|
},
|
|
12235
12612
|
[keyboardHookHandleClick, onClick]
|
|
12236
12613
|
);
|
|
12237
|
-
const handleKeyDown = (0,
|
|
12614
|
+
const handleKeyDown = (0, import_react88.useCallback)(
|
|
12238
12615
|
(evt) => {
|
|
12239
12616
|
keyboardHookHandleKeyDown(evt);
|
|
12240
12617
|
if (!evt.defaultPrevented) {
|
|
@@ -12243,7 +12620,7 @@ var useToolbar = ({
|
|
|
12243
12620
|
},
|
|
12244
12621
|
[keyboardHookHandleKeyDown, onKeyDown]
|
|
12245
12622
|
);
|
|
12246
|
-
const onSwitchWrappedItemIntoView = (0,
|
|
12623
|
+
const onSwitchWrappedItemIntoView = (0, import_react88.useCallback)(
|
|
12247
12624
|
(item) => {
|
|
12248
12625
|
const index = parseInt(item.index);
|
|
12249
12626
|
if (!isNaN(index)) {
|
|
@@ -12275,8 +12652,8 @@ var useToolbar = ({
|
|
|
12275
12652
|
};
|
|
12276
12653
|
|
|
12277
12654
|
// src/toolbar/Toolbar.tsx
|
|
12278
|
-
var
|
|
12279
|
-
var
|
|
12655
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
12656
|
+
var classBase28 = "vuuToolbar";
|
|
12280
12657
|
var Toolbar = ({
|
|
12281
12658
|
activeItemIndex: activeItemIndexProp,
|
|
12282
12659
|
alignItems = "start",
|
|
@@ -12291,7 +12668,7 @@ var Toolbar = ({
|
|
|
12291
12668
|
showSeparators = false,
|
|
12292
12669
|
...props
|
|
12293
12670
|
}) => {
|
|
12294
|
-
const rootRef = (0,
|
|
12671
|
+
const rootRef = (0, import_react89.useRef)(null);
|
|
12295
12672
|
const {
|
|
12296
12673
|
activeItemIndex,
|
|
12297
12674
|
focusableIdx,
|
|
@@ -12307,18 +12684,18 @@ var Toolbar = ({
|
|
|
12307
12684
|
orientation,
|
|
12308
12685
|
selectionStrategy
|
|
12309
12686
|
});
|
|
12310
|
-
const id = (0,
|
|
12311
|
-
const items = (0,
|
|
12312
|
-
() => (0,
|
|
12687
|
+
const id = (0, import_vuu_utils41.useId)(idProp);
|
|
12688
|
+
const items = (0, import_react89.useMemo)(
|
|
12689
|
+
() => (0, import_vuu_utils41.asReactElements)(children).map((child, index) => {
|
|
12313
12690
|
const {
|
|
12314
12691
|
id: itemId = `${id}-tab-${index}`,
|
|
12315
12692
|
className: itemClassName,
|
|
12316
12693
|
...ownProps
|
|
12317
12694
|
} = child.props;
|
|
12318
12695
|
const selected = activeItemIndex.includes(index);
|
|
12319
|
-
return
|
|
12696
|
+
return import_react89.default.cloneElement(child, {
|
|
12320
12697
|
...forwardCallbackProps(ownProps, itemProps),
|
|
12321
|
-
className: (0,
|
|
12698
|
+
className: (0, import_clsx38.default)("vuuToolbarItem", itemClassName),
|
|
12322
12699
|
"data-overflow-priority": selected ? "1" : void 0,
|
|
12323
12700
|
id: itemId,
|
|
12324
12701
|
key: index,
|
|
@@ -12328,15 +12705,15 @@ var Toolbar = ({
|
|
|
12328
12705
|
}),
|
|
12329
12706
|
[activeItemIndex, children, focusableIdx, id, itemProps]
|
|
12330
12707
|
);
|
|
12331
|
-
return /* @__PURE__ */ (0,
|
|
12708
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
12332
12709
|
OverflowContainer,
|
|
12333
12710
|
{
|
|
12334
12711
|
...props,
|
|
12335
12712
|
...toolbarHook.containerProps,
|
|
12336
|
-
className: (0,
|
|
12337
|
-
[`${
|
|
12338
|
-
[`${
|
|
12339
|
-
[`${
|
|
12713
|
+
className: (0, import_clsx38.default)(className, classBase28, `${classBase28}-${orientation}`, {
|
|
12714
|
+
[`${classBase28}-alignCenter`]: alignItems === "center",
|
|
12715
|
+
[`${classBase28}-alignEnd`]: alignItems === "end",
|
|
12716
|
+
[`${classBase28}-withSeparators`]: showSeparators
|
|
12340
12717
|
}),
|
|
12341
12718
|
...props,
|
|
12342
12719
|
ref: rootRef,
|
|
@@ -12346,9 +12723,9 @@ var Toolbar = ({
|
|
|
12346
12723
|
};
|
|
12347
12724
|
|
|
12348
12725
|
// src/tree/Tree.tsx
|
|
12349
|
-
var
|
|
12350
|
-
var
|
|
12351
|
-
var
|
|
12726
|
+
var import_core38 = require("@salt-ds/core");
|
|
12727
|
+
var import_clsx39 = __toESM(require("clsx"));
|
|
12728
|
+
var import_react98 = require("react");
|
|
12352
12729
|
|
|
12353
12730
|
// src/tree/list-dom-utils.ts
|
|
12354
12731
|
function listItemIndex2(listItemEl) {
|
|
@@ -12366,7 +12743,7 @@ var closestListItem2 = (el) => el.closest("[data-idx],[aria-posinset]");
|
|
|
12366
12743
|
var closestListItemIndex2 = (el) => listItemIndex2(closestListItem2(el));
|
|
12367
12744
|
|
|
12368
12745
|
// src/tree/use-items-with-ids.ts
|
|
12369
|
-
var
|
|
12746
|
+
var import_react90 = require("react");
|
|
12370
12747
|
var PathSeparators2 = /* @__PURE__ */ new Set(["/", "-", "."]);
|
|
12371
12748
|
var isPathSeparator2 = (char) => PathSeparators2.has(char);
|
|
12372
12749
|
var isParentPath2 = (parentPath, childPath) => childPath.startsWith(parentPath) && isPathSeparator2(childPath[parentPath.length]);
|
|
@@ -12390,7 +12767,7 @@ var useItemsWithIds = (sourceProp, idRoot = "root", {
|
|
|
12390
12767
|
return 0;
|
|
12391
12768
|
}
|
|
12392
12769
|
};
|
|
12393
|
-
const isExpanded2 = (0,
|
|
12770
|
+
const isExpanded2 = (0, import_react90.useCallback)(
|
|
12394
12771
|
(path) => {
|
|
12395
12772
|
if (Array.isArray(revealSelected)) {
|
|
12396
12773
|
return revealSelected.some((id) => isParentPath2(path, id));
|
|
@@ -12399,7 +12776,7 @@ var useItemsWithIds = (sourceProp, idRoot = "root", {
|
|
|
12399
12776
|
},
|
|
12400
12777
|
[defaultExpanded, revealSelected]
|
|
12401
12778
|
);
|
|
12402
|
-
const normalizeItems = (0,
|
|
12779
|
+
const normalizeItems = (0, import_react90.useCallback)(
|
|
12403
12780
|
(items, indexer, level = 1, path = "", results = [], flattenedSource2 = []) => {
|
|
12404
12781
|
let count2 = 0;
|
|
12405
12782
|
items.forEach((item, i, all) => {
|
|
@@ -12443,10 +12820,10 @@ var useItemsWithIds = (sourceProp, idRoot = "root", {
|
|
|
12443
12820
|
},
|
|
12444
12821
|
[collapsibleHeaders, idRoot, isExpanded2]
|
|
12445
12822
|
);
|
|
12446
|
-
const [count, sourceWithIds, flattenedSource] = (0,
|
|
12823
|
+
const [count, sourceWithIds, flattenedSource] = (0, import_react90.useMemo)(() => {
|
|
12447
12824
|
return normalizeItems(sourceProp, { index: 0 });
|
|
12448
12825
|
}, [normalizeItems, sourceProp]);
|
|
12449
|
-
const sourceItemById = (0,
|
|
12826
|
+
const sourceItemById = (0, import_react90.useCallback)(
|
|
12450
12827
|
(id, target = sourceWithIds) => {
|
|
12451
12828
|
const sourceWithId = target.find(
|
|
12452
12829
|
(i) => {
|
|
@@ -12466,8 +12843,8 @@ var useItemsWithIds = (sourceProp, idRoot = "root", {
|
|
|
12466
12843
|
};
|
|
12467
12844
|
|
|
12468
12845
|
// src/tree/use-selection.ts
|
|
12469
|
-
var
|
|
12470
|
-
var
|
|
12846
|
+
var import_react91 = require("react");
|
|
12847
|
+
var import_core36 = require("@salt-ds/core");
|
|
12471
12848
|
var SINGLE = "single";
|
|
12472
12849
|
var CHECKBOX2 = "checkbox";
|
|
12473
12850
|
var MULTI = "multi";
|
|
@@ -12488,17 +12865,17 @@ var useSelection4 = ({
|
|
|
12488
12865
|
const singleSelect = selection === SINGLE;
|
|
12489
12866
|
const multiSelect = selection === MULTI || selection.startsWith(CHECKBOX2);
|
|
12490
12867
|
const extendedSelect = selection === EXTENDED;
|
|
12491
|
-
const lastActive = (0,
|
|
12492
|
-
const isSelectionEvent = (0,
|
|
12868
|
+
const lastActive = (0, import_react91.useRef)(-1);
|
|
12869
|
+
const isSelectionEvent = (0, import_react91.useCallback)(
|
|
12493
12870
|
(evt) => selectionKeys.includes(evt.key),
|
|
12494
12871
|
[selectionKeys]
|
|
12495
12872
|
);
|
|
12496
|
-
const [selected, setSelected] = (0,
|
|
12873
|
+
const [selected, setSelected] = (0, import_core36.useControlled)({
|
|
12497
12874
|
controlled: selectedProp,
|
|
12498
12875
|
default: defaultSelected != null ? defaultSelected : [],
|
|
12499
12876
|
name: "selected"
|
|
12500
12877
|
});
|
|
12501
|
-
const selectItemAtIndex = (0,
|
|
12878
|
+
const selectItemAtIndex = (0, import_react91.useCallback)(
|
|
12502
12879
|
(evt, idx, id, rangeSelect, preserveExistingSelection = false) => {
|
|
12503
12880
|
const { current: active } = lastActive;
|
|
12504
12881
|
const isSelected2 = selected == null ? void 0 : selected.includes(id);
|
|
@@ -12539,7 +12916,7 @@ var useSelection4 = ({
|
|
|
12539
12916
|
singleSelect
|
|
12540
12917
|
]
|
|
12541
12918
|
);
|
|
12542
|
-
const handleKeyDown = (0,
|
|
12919
|
+
const handleKeyDown = (0, import_react91.useCallback)(
|
|
12543
12920
|
(evt) => {
|
|
12544
12921
|
if (~highlightedIdx && isSelectionEvent(evt)) {
|
|
12545
12922
|
evt.preventDefault();
|
|
@@ -12564,7 +12941,7 @@ var useSelection4 = ({
|
|
|
12564
12941
|
selectItemAtIndex
|
|
12565
12942
|
]
|
|
12566
12943
|
);
|
|
12567
|
-
const handleKeyboardNavigation = (0,
|
|
12944
|
+
const handleKeyboardNavigation = (0, import_react91.useCallback)(
|
|
12568
12945
|
(evt, currentIndex) => {
|
|
12569
12946
|
if (extendedSelect && evt.shiftKey) {
|
|
12570
12947
|
const item = treeNodes[currentIndex];
|
|
@@ -12577,7 +12954,7 @@ var useSelection4 = ({
|
|
|
12577
12954
|
onKeyDown: handleKeyDown,
|
|
12578
12955
|
onKeyboardNavigation: handleKeyboardNavigation
|
|
12579
12956
|
};
|
|
12580
|
-
const handleClick = (0,
|
|
12957
|
+
const handleClick = (0, import_react91.useCallback)(
|
|
12581
12958
|
(evt) => {
|
|
12582
12959
|
if (highlightedIdx !== -1) {
|
|
12583
12960
|
const item = treeNodes[highlightedIdx];
|
|
@@ -12611,14 +12988,14 @@ var useSelection4 = ({
|
|
|
12611
12988
|
};
|
|
12612
12989
|
|
|
12613
12990
|
// src/tree/use-viewport-tracking.ts
|
|
12614
|
-
var
|
|
12991
|
+
var import_react92 = require("react");
|
|
12615
12992
|
var HeightOnly4 = ["height", "scrollHeight"];
|
|
12616
12993
|
var useViewportTracking2 = (root, highlightedIdx, stickyHeaders = false) => {
|
|
12617
|
-
const scrollTop = (0,
|
|
12618
|
-
const scrolling = (0,
|
|
12619
|
-
const rootHeight = (0,
|
|
12620
|
-
const rootScrollHeight = (0,
|
|
12621
|
-
const scrollIntoView = (0,
|
|
12994
|
+
const scrollTop = (0, import_react92.useRef)(0);
|
|
12995
|
+
const scrolling = (0, import_react92.useRef)(false);
|
|
12996
|
+
const rootHeight = (0, import_react92.useRef)(0);
|
|
12997
|
+
const rootScrollHeight = (0, import_react92.useRef)(0);
|
|
12998
|
+
const scrollIntoView = (0, import_react92.useCallback)(
|
|
12622
12999
|
(el) => {
|
|
12623
13000
|
const targetEl = el.ariaExpanded ? el.firstChild : el;
|
|
12624
13001
|
const headerHeight = stickyHeaders ? 30 : 0;
|
|
@@ -12639,10 +13016,10 @@ var useViewportTracking2 = (root, highlightedIdx, stickyHeaders = false) => {
|
|
|
12639
13016
|
},
|
|
12640
13017
|
[root, stickyHeaders]
|
|
12641
13018
|
);
|
|
12642
|
-
const scrollHandler = (0,
|
|
13019
|
+
const scrollHandler = (0, import_react92.useCallback)((e) => {
|
|
12643
13020
|
scrollTop.current = e.target.scrollTop;
|
|
12644
13021
|
}, []);
|
|
12645
|
-
(0,
|
|
13022
|
+
(0, import_react92.useEffect)(() => {
|
|
12646
13023
|
const { current: rootEl } = root;
|
|
12647
13024
|
if (rootEl) {
|
|
12648
13025
|
rootEl.addEventListener("scroll", scrollHandler);
|
|
@@ -12653,7 +13030,7 @@ var useViewportTracking2 = (root, highlightedIdx, stickyHeaders = false) => {
|
|
|
12653
13030
|
}
|
|
12654
13031
|
};
|
|
12655
13032
|
}, [root, scrollHandler]);
|
|
12656
|
-
(0,
|
|
13033
|
+
(0, import_react92.useLayoutEffect)(() => {
|
|
12657
13034
|
if (highlightedIdx !== -1 && rootScrollHeight.current > rootHeight.current) {
|
|
12658
13035
|
if (root.current) {
|
|
12659
13036
|
const item = root.current.querySelector(`
|
|
@@ -12670,9 +13047,9 @@ var useViewportTracking2 = (root, highlightedIdx, stickyHeaders = false) => {
|
|
|
12670
13047
|
}
|
|
12671
13048
|
}
|
|
12672
13049
|
}, [highlightedIdx, root, scrollIntoView]);
|
|
12673
|
-
(0,
|
|
13050
|
+
(0, import_react92.useEffect)(() => {
|
|
12674
13051
|
}, [stickyHeaders]);
|
|
12675
|
-
const onResize = (0,
|
|
13052
|
+
const onResize = (0, import_react92.useCallback)(({ height, scrollHeight }) => {
|
|
12676
13053
|
rootHeight.current = height;
|
|
12677
13054
|
rootScrollHeight.current = scrollHeight;
|
|
12678
13055
|
}, []);
|
|
@@ -12681,10 +13058,10 @@ var useViewportTracking2 = (root, highlightedIdx, stickyHeaders = false) => {
|
|
|
12681
13058
|
};
|
|
12682
13059
|
|
|
12683
13060
|
// src/tree/useTree.ts
|
|
12684
|
-
var
|
|
13061
|
+
var import_react97 = require("react");
|
|
12685
13062
|
|
|
12686
13063
|
// src/tree/use-keyboard-navigation.ts
|
|
12687
|
-
var
|
|
13064
|
+
var import_react93 = require("react");
|
|
12688
13065
|
|
|
12689
13066
|
// src/tree/hierarchical-data-utils.ts
|
|
12690
13067
|
var getNodeParentPath = ({ id }) => {
|
|
@@ -12751,7 +13128,7 @@ var replaceNode = (nodes, id, props) => {
|
|
|
12751
13128
|
};
|
|
12752
13129
|
|
|
12753
13130
|
// src/tree/use-keyboard-navigation.ts
|
|
12754
|
-
var
|
|
13131
|
+
var import_core37 = require("@salt-ds/core");
|
|
12755
13132
|
|
|
12756
13133
|
// src/tree/key-code.ts
|
|
12757
13134
|
function union2(set1, ...sets) {
|
|
@@ -12834,26 +13211,26 @@ var useKeyboardNavigation4 = ({
|
|
|
12834
13211
|
onKeyboardNavigation,
|
|
12835
13212
|
selected = []
|
|
12836
13213
|
}) => {
|
|
12837
|
-
const { bwd: ArrowBwd, fwd: ArrowFwd } = (0,
|
|
13214
|
+
const { bwd: ArrowBwd, fwd: ArrowFwd } = (0, import_react93.useMemo)(
|
|
12838
13215
|
() => ({
|
|
12839
13216
|
bwd: ArrowUp4,
|
|
12840
13217
|
fwd: ArrowDown4
|
|
12841
13218
|
}),
|
|
12842
13219
|
[]
|
|
12843
13220
|
);
|
|
12844
|
-
const [highlightedIdx, setHighlightedIdx, isControlledHighlighting] = (0,
|
|
13221
|
+
const [highlightedIdx, setHighlightedIdx, isControlledHighlighting] = (0, import_core37.useControlled)({
|
|
12845
13222
|
controlled: highlightedIdxProp,
|
|
12846
13223
|
default: defaultHighlightedIdx,
|
|
12847
13224
|
name: "highlightedIdx"
|
|
12848
13225
|
});
|
|
12849
|
-
const setHighlightedIndex = (0,
|
|
13226
|
+
const setHighlightedIndex = (0, import_react93.useCallback)(
|
|
12850
13227
|
(idx) => {
|
|
12851
13228
|
onHighlight == null ? void 0 : onHighlight(idx);
|
|
12852
13229
|
setHighlightedIdx(idx);
|
|
12853
13230
|
},
|
|
12854
13231
|
[onHighlight, setHighlightedIdx]
|
|
12855
13232
|
);
|
|
12856
|
-
const nextFocusableItemIdx = (0,
|
|
13233
|
+
const nextFocusableItemIdx = (0, import_react93.useCallback)(
|
|
12857
13234
|
(key = ArrowFwd, idx = key === ArrowFwd ? -1 : treeNodes.length) => {
|
|
12858
13235
|
let nextIdx = nextItemIdx4(treeNodes.length, key, idx);
|
|
12859
13236
|
while (nextIdx !== -1 && (key === ArrowFwd && nextIdx < treeNodes.length || key === ArrowBwd && nextIdx > 0) && !isFocusable3(treeNodes[nextIdx])) {
|
|
@@ -12863,10 +13240,10 @@ var useKeyboardNavigation4 = ({
|
|
|
12863
13240
|
},
|
|
12864
13241
|
[ArrowBwd, ArrowFwd, treeNodes]
|
|
12865
13242
|
);
|
|
12866
|
-
const keyBoardNavigation = (0,
|
|
12867
|
-
const ignoreFocus = (0,
|
|
13243
|
+
const keyBoardNavigation = (0, import_react93.useRef)(true);
|
|
13244
|
+
const ignoreFocus = (0, import_react93.useRef)(false);
|
|
12868
13245
|
const setIgnoreFocus = (value) => ignoreFocus.current = value;
|
|
12869
|
-
const handleFocus = (0,
|
|
13246
|
+
const handleFocus = (0, import_react93.useCallback)(() => {
|
|
12870
13247
|
if (ignoreFocus.current) {
|
|
12871
13248
|
ignoreFocus.current = false;
|
|
12872
13249
|
} else if (selected.length > 0) {
|
|
@@ -12879,7 +13256,7 @@ var useKeyboardNavigation4 = ({
|
|
|
12879
13256
|
setHighlightedIndex(nextFocusableItemIdx());
|
|
12880
13257
|
}
|
|
12881
13258
|
}, [treeNodes, nextFocusableItemIdx, selected, setHighlightedIndex]);
|
|
12882
|
-
const navigateChildItems = (0,
|
|
13259
|
+
const navigateChildItems = (0, import_react93.useCallback)(
|
|
12883
13260
|
(e) => {
|
|
12884
13261
|
const nextIdx = nextFocusableItemIdx(e.key, highlightedIdx);
|
|
12885
13262
|
if (nextIdx !== highlightedIdx) {
|
|
@@ -12894,7 +13271,7 @@ var useKeyboardNavigation4 = ({
|
|
|
12894
13271
|
setHighlightedIndex
|
|
12895
13272
|
]
|
|
12896
13273
|
);
|
|
12897
|
-
const handleKeyDown = (0,
|
|
13274
|
+
const handleKeyDown = (0, import_react93.useCallback)(
|
|
12898
13275
|
(e) => {
|
|
12899
13276
|
if (treeNodes.length > 0 && isNavigationKey4(e, "vertical")) {
|
|
12900
13277
|
e.preventDefault();
|
|
@@ -12905,7 +13282,7 @@ var useKeyboardNavigation4 = ({
|
|
|
12905
13282
|
},
|
|
12906
13283
|
[treeNodes, navigateChildItems]
|
|
12907
13284
|
);
|
|
12908
|
-
const listProps = (0,
|
|
13285
|
+
const listProps = (0, import_react93.useMemo)(
|
|
12909
13286
|
() => ({
|
|
12910
13287
|
onBlur: () => {
|
|
12911
13288
|
setHighlightedIndex(-1);
|
|
@@ -12943,7 +13320,7 @@ var useKeyboardNavigation4 = ({
|
|
|
12943
13320
|
};
|
|
12944
13321
|
|
|
12945
13322
|
// src/tree/use-hierarchical-data.ts
|
|
12946
|
-
var
|
|
13323
|
+
var import_react94 = require("react");
|
|
12947
13324
|
var populateIndices = (nodes, results = [], idx = { value: 0 }) => {
|
|
12948
13325
|
let skipToNextHeader = false;
|
|
12949
13326
|
for (const node of nodes) {
|
|
@@ -12965,10 +13342,10 @@ var populateIndices = (nodes, results = [], idx = { value: 0 }) => {
|
|
|
12965
13342
|
return results;
|
|
12966
13343
|
};
|
|
12967
13344
|
var useHierarchicalData = (source) => {
|
|
12968
|
-
const externalSource = (0,
|
|
12969
|
-
const statefulSource = (0,
|
|
12970
|
-
const indexPositions = (0,
|
|
12971
|
-
const [, forceUpdate] = (0,
|
|
13345
|
+
const externalSource = (0, import_react94.useRef)(source);
|
|
13346
|
+
const statefulSource = (0, import_react94.useRef)(source);
|
|
13347
|
+
const indexPositions = (0, import_react94.useRef)(populateIndices(source));
|
|
13348
|
+
const [, forceUpdate] = (0, import_react94.useState)({});
|
|
12972
13349
|
if (source !== externalSource.current) {
|
|
12973
13350
|
externalSource.current = source;
|
|
12974
13351
|
statefulSource.current = source;
|
|
@@ -12988,7 +13365,7 @@ var useHierarchicalData = (source) => {
|
|
|
12988
13365
|
};
|
|
12989
13366
|
|
|
12990
13367
|
// src/tree/use-collapsible-groups.ts
|
|
12991
|
-
var
|
|
13368
|
+
var import_react95 = require("react");
|
|
12992
13369
|
var NO_HANDLERS4 = {};
|
|
12993
13370
|
var isToggleElement = (element) => element && element.hasAttribute("aria-expanded");
|
|
12994
13371
|
var useCollapsibleGroups2 = ({
|
|
@@ -12998,23 +13375,23 @@ var useCollapsibleGroups2 = ({
|
|
|
12998
13375
|
setVisibleData,
|
|
12999
13376
|
source
|
|
13000
13377
|
}) => {
|
|
13001
|
-
const fullSource = (0,
|
|
13002
|
-
const stateSource = (0,
|
|
13003
|
-
const setSource = (0,
|
|
13378
|
+
const fullSource = (0, import_react95.useRef)(source);
|
|
13379
|
+
const stateSource = (0, import_react95.useRef)(fullSource.current);
|
|
13380
|
+
const setSource = (0, import_react95.useCallback)(
|
|
13004
13381
|
(value) => {
|
|
13005
13382
|
setVisibleData(stateSource.current = value);
|
|
13006
13383
|
},
|
|
13007
13384
|
[setVisibleData]
|
|
13008
13385
|
);
|
|
13009
|
-
const expandNode = (0,
|
|
13386
|
+
const expandNode = (0, import_react95.useCallback)(
|
|
13010
13387
|
(nodeList, { id }) => replaceNode(nodeList, id, { expanded: true }),
|
|
13011
13388
|
[]
|
|
13012
13389
|
);
|
|
13013
|
-
const collapseNode = (0,
|
|
13390
|
+
const collapseNode = (0, import_react95.useCallback)(
|
|
13014
13391
|
(nodeList, { id }) => replaceNode(nodeList, id, { expanded: false }),
|
|
13015
13392
|
[]
|
|
13016
13393
|
);
|
|
13017
|
-
const handleKeyDown = (0,
|
|
13394
|
+
const handleKeyDown = (0, import_react95.useCallback)(
|
|
13018
13395
|
(e) => {
|
|
13019
13396
|
if (e.key === ArrowRight4 || e.key === Enter2) {
|
|
13020
13397
|
const node = treeNodes[highlightedIdx];
|
|
@@ -13040,7 +13417,7 @@ var useCollapsibleGroups2 = ({
|
|
|
13040
13417
|
const listHandlers = collapsibleHeaders ? {
|
|
13041
13418
|
onKeyDown: handleKeyDown
|
|
13042
13419
|
} : NO_HANDLERS4;
|
|
13043
|
-
const handleClick = (0,
|
|
13420
|
+
const handleClick = (0, import_react95.useCallback)(
|
|
13044
13421
|
(evt) => {
|
|
13045
13422
|
const el = closestListItem2(evt.target);
|
|
13046
13423
|
if (isToggleElement(el)) {
|
|
@@ -13066,14 +13443,14 @@ var useCollapsibleGroups2 = ({
|
|
|
13066
13443
|
};
|
|
13067
13444
|
|
|
13068
13445
|
// src/tree/use-tree-keyboard-navigation.ts
|
|
13069
|
-
var
|
|
13446
|
+
var import_react96 = require("react");
|
|
13070
13447
|
var useTreeKeyboardNavigation = ({
|
|
13071
13448
|
highlightedIdx,
|
|
13072
13449
|
hiliteItemAtIndex,
|
|
13073
13450
|
indexPositions,
|
|
13074
13451
|
source
|
|
13075
13452
|
}) => {
|
|
13076
|
-
const handleKeyDown = (0,
|
|
13453
|
+
const handleKeyDown = (0, import_react96.useCallback)(
|
|
13077
13454
|
(e) => {
|
|
13078
13455
|
if (e.key === ArrowLeft4) {
|
|
13079
13456
|
const node = indexPositions[highlightedIdx];
|
|
@@ -13110,7 +13487,7 @@ var useTree = ({
|
|
|
13110
13487
|
selected: selectedProp,
|
|
13111
13488
|
selection
|
|
13112
13489
|
}) => {
|
|
13113
|
-
const lastSelection = (0,
|
|
13490
|
+
const lastSelection = (0, import_react97.useRef)(EMPTY_ARRAY2);
|
|
13114
13491
|
const dataHook = useHierarchicalData(sourceWithIds);
|
|
13115
13492
|
const handleKeyboardNavigation = (evt, nextIdx) => {
|
|
13116
13493
|
var _a2, _b;
|
|
@@ -13143,7 +13520,7 @@ var useTree = ({
|
|
|
13143
13520
|
hiliteItemAtIndex: keyboardHook.hiliteItemAtIndex,
|
|
13144
13521
|
indexPositions: dataHook.indexPositions
|
|
13145
13522
|
});
|
|
13146
|
-
const handleClick = (0,
|
|
13523
|
+
const handleClick = (0, import_react97.useCallback)(
|
|
13147
13524
|
(evt) => {
|
|
13148
13525
|
var _a2, _b, _c;
|
|
13149
13526
|
(_a2 = collapsibleHook.listItemHandlers) == null ? void 0 : _a2.onClick(evt);
|
|
@@ -13153,7 +13530,7 @@ var useTree = ({
|
|
|
13153
13530
|
},
|
|
13154
13531
|
[collapsibleHook, selectionHook]
|
|
13155
13532
|
);
|
|
13156
|
-
const handleKeyDown = (0,
|
|
13533
|
+
const handleKeyDown = (0, import_react97.useCallback)(
|
|
13157
13534
|
(evt) => {
|
|
13158
13535
|
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
13159
13536
|
(_b = (_a2 = keyboardHook.listProps).onKeyDown) == null ? void 0 : _b.call(_a2, evt);
|
|
@@ -13203,14 +13580,14 @@ var useTree = ({
|
|
|
13203
13580
|
};
|
|
13204
13581
|
|
|
13205
13582
|
// src/tree/Tree.tsx
|
|
13206
|
-
var
|
|
13207
|
-
var
|
|
13208
|
-
var
|
|
13583
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
13584
|
+
var import_react99 = require("react");
|
|
13585
|
+
var classBase29 = "vuuTree";
|
|
13209
13586
|
var isExpanded = (node) => node.expanded === true;
|
|
13210
13587
|
var TreeNode = ({ children, idx, ...props }) => {
|
|
13211
|
-
return /* @__PURE__ */ (0,
|
|
13588
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("li", { ...props, children });
|
|
13212
13589
|
};
|
|
13213
|
-
var Tree = (0,
|
|
13590
|
+
var Tree = (0, import_react98.forwardRef)(function Tree2({
|
|
13214
13591
|
allowDragDrop,
|
|
13215
13592
|
className,
|
|
13216
13593
|
defaultSelected,
|
|
@@ -13225,8 +13602,8 @@ var Tree = (0, import_react91.forwardRef)(function Tree2({
|
|
|
13225
13602
|
...htmlAttributes
|
|
13226
13603
|
}, forwardedRef) {
|
|
13227
13604
|
var _a2;
|
|
13228
|
-
const id = (0,
|
|
13229
|
-
const rootRef = (0,
|
|
13605
|
+
const id = (0, import_core38.useIdMemo)(idProp);
|
|
13606
|
+
const rootRef = (0, import_react98.useRef)(null);
|
|
13230
13607
|
const [, sourceWithIds, sourceItemById] = useItemsWithIds(source, id, {
|
|
13231
13608
|
revealSelected: revealSelected ? (_a2 = selectedProp != null ? selectedProp : defaultSelected) != null ? _a2 : false : void 0
|
|
13232
13609
|
});
|
|
@@ -13269,14 +13646,14 @@ var Tree = (0, import_react91.forwardRef)(function Tree2({
|
|
|
13269
13646
|
const allowGroupSelect = groupSelectionEnabled2(groupSelection);
|
|
13270
13647
|
function addLeafNode(list, item, idx) {
|
|
13271
13648
|
list.push(
|
|
13272
|
-
/* @__PURE__ */ (0,
|
|
13649
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
13273
13650
|
TreeNode,
|
|
13274
13651
|
{
|
|
13275
13652
|
...propsCommonToAllListItems,
|
|
13276
13653
|
...getListItemProps(item, idx, highlightedIdx, selected, focusVisible),
|
|
13277
13654
|
children: [
|
|
13278
|
-
item.icon ? /* @__PURE__ */ (0,
|
|
13279
|
-
/* @__PURE__ */ (0,
|
|
13655
|
+
item.icon ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: `${classBase29}Node-icon`, "data-icon": item.icon }) : null,
|
|
13656
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children: item.label })
|
|
13280
13657
|
]
|
|
13281
13658
|
}
|
|
13282
13659
|
)
|
|
@@ -13287,16 +13664,16 @@ var Tree = (0, import_react91.forwardRef)(function Tree2({
|
|
|
13287
13664
|
const { value: i } = idx;
|
|
13288
13665
|
idx.value += 1;
|
|
13289
13666
|
list.push(
|
|
13290
|
-
/* @__PURE__ */ (0,
|
|
13667
|
+
/* @__PURE__ */ (0, import_react99.createElement)(
|
|
13291
13668
|
TreeNode,
|
|
13292
13669
|
{
|
|
13293
13670
|
...listItemHandlers,
|
|
13294
13671
|
"aria-expanded": child.expanded,
|
|
13295
13672
|
"aria-level": child.level,
|
|
13296
13673
|
"aria-selected": selected.includes(id2) || void 0,
|
|
13297
|
-
className: (0,
|
|
13674
|
+
className: (0, import_clsx39.default)(`${classBase29}Node`, {
|
|
13298
13675
|
focusVisible: focusVisible === i,
|
|
13299
|
-
[`${
|
|
13676
|
+
[`${classBase29}Node-toggle`]: !allowGroupSelect
|
|
13300
13677
|
}),
|
|
13301
13678
|
"data-idx": i,
|
|
13302
13679
|
"data-highlighted": i === highlightedIdx || void 0,
|
|
@@ -13304,20 +13681,20 @@ var Tree = (0, import_react91.forwardRef)(function Tree2({
|
|
|
13304
13681
|
id: id2,
|
|
13305
13682
|
key: `header-${i}`
|
|
13306
13683
|
},
|
|
13307
|
-
allowGroupSelect ? /* @__PURE__ */ (0,
|
|
13308
|
-
/* @__PURE__ */ (0,
|
|
13684
|
+
allowGroupSelect ? /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: `${classBase29}Node-label`, children: [
|
|
13685
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: `${classBase29}Node-toggle` }),
|
|
13309
13686
|
title
|
|
13310
|
-
] }) : /* @__PURE__ */ (0,
|
|
13311
|
-
child.icon ? /* @__PURE__ */ (0,
|
|
13687
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: `${classBase29}Node-label`, children: [
|
|
13688
|
+
child.icon ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
13312
13689
|
"span",
|
|
13313
13690
|
{
|
|
13314
|
-
className: `${
|
|
13691
|
+
className: `${classBase29}Node-icon`,
|
|
13315
13692
|
"data-icon": child.icon
|
|
13316
13693
|
}
|
|
13317
13694
|
) : null,
|
|
13318
|
-
/* @__PURE__ */ (0,
|
|
13695
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children: title })
|
|
13319
13696
|
] }),
|
|
13320
|
-
/* @__PURE__ */ (0,
|
|
13697
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("ul", { role: "group", children: isExpanded(child) ? renderSourceContent(child.childNodes, idx) : "" })
|
|
13321
13698
|
)
|
|
13322
13699
|
);
|
|
13323
13700
|
}
|
|
@@ -13334,14 +13711,14 @@ var Tree = (0, import_react91.forwardRef)(function Tree2({
|
|
|
13334
13711
|
return listItems;
|
|
13335
13712
|
}
|
|
13336
13713
|
}
|
|
13337
|
-
return /* @__PURE__ */ (0,
|
|
13714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
13338
13715
|
"ul",
|
|
13339
13716
|
{
|
|
13340
13717
|
...htmlAttributes,
|
|
13341
13718
|
...listProps,
|
|
13342
|
-
className: (0,
|
|
13719
|
+
className: (0, import_clsx39.default)(classBase29, className),
|
|
13343
13720
|
id: `Tree-${id}`,
|
|
13344
|
-
ref: (0,
|
|
13721
|
+
ref: (0, import_core38.useForkRef)(rootRef, forwardedRef),
|
|
13345
13722
|
role: "tree",
|
|
13346
13723
|
tabIndex: 0,
|
|
13347
13724
|
children: renderSourceContent(visibleData)
|
|
@@ -13355,7 +13732,7 @@ var getListItemProps = (item, idx, highlightedIdx, selected, focusVisible, class
|
|
|
13355
13732
|
"aria-selected": selected.includes(item.id) || void 0,
|
|
13356
13733
|
"data-idx": idx.value,
|
|
13357
13734
|
"data-highlighted": idx.value === highlightedIdx || void 0,
|
|
13358
|
-
className: (0,
|
|
13735
|
+
className: (0, import_clsx39.default)("vuuTreeNode", className, {
|
|
13359
13736
|
focusVisible: focusVisible === idx.value
|
|
13360
13737
|
})
|
|
13361
13738
|
});
|