@vuu-ui/vuu-ui-controls 0.8.27-debug → 0.8.28-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 +523 -794
- package/cjs/index.js.map +4 -4
- package/esm/index.js +439 -709
- package/esm/index.js.map +4 -4
- package/index.css +4 -55
- package/index.css.map +3 -3
- package/package.json +7 -7
- package/types/cycle-state-button/CycleStateButton.d.ts +4 -2
- package/types/date-input/DateInput.d.ts +3 -2
- package/types/editable-label/EditableLabel.d.ts +8 -2
- package/types/index.d.ts +0 -1
- package/types/tabstrip/TabsTypes.d.ts +2 -2
- package/types/date-picker/DatePicker.d.ts +0 -5
- package/types/date-picker/DateRangePicker.d.ts +0 -5
- package/types/date-picker/index.d.ts +0 -2
- package/types/date-picker/input/DatePickerInput.d.ts +0 -7
- package/types/date-picker/input/DateRangePickerInput.d.ts +0 -7
- package/types/date-picker/input/types.d.ts +0 -6
- package/types/date-picker/internal/CalendarIconButton.d.ts +0 -3
- package/types/date-picker/types.d.ts +0 -15
- package/types/date-picker/useBaseDatePicker.d.ts +0 -17
- package/types/date-picker/useBaseDatePickerDropdown.d.ts +0 -15
package/cjs/index.js
CHANGED
|
@@ -44,10 +44,8 @@ __export(src_exports, {
|
|
|
44
44
|
ComboBox: () => ComboBox,
|
|
45
45
|
CycleStateButton: () => CycleStateButton,
|
|
46
46
|
DateInput: () => DateInput,
|
|
47
|
-
DatePicker: () => DatePicker,
|
|
48
47
|
DatePopup: () => DatePopup,
|
|
49
48
|
DateRangeInput: () => DateRangeInput,
|
|
50
|
-
DateRangePicker: () => DateRangePicker,
|
|
51
49
|
DragDropProvider: () => DragDropProvider,
|
|
52
50
|
DragDropState: () => DragDropState,
|
|
53
51
|
Dropdown: () => Dropdown2,
|
|
@@ -79,6 +77,7 @@ __export(src_exports, {
|
|
|
79
77
|
NOT_HIDDEN: () => NOT_HIDDEN,
|
|
80
78
|
NOT_OVERFLOWED: () => NOT_OVERFLOWED,
|
|
81
79
|
NO_WRAPPED_ITEMS: () => NO_WRAPPED_ITEMS,
|
|
80
|
+
NullEditAPI: () => NullEditAPI,
|
|
82
81
|
OverflowContainer: () => OverflowContainer,
|
|
83
82
|
PageDown: () => PageDown,
|
|
84
83
|
PageUp: () => PageUp,
|
|
@@ -916,10 +915,6 @@ function useResizeObserver(ref, dimensions2, onResize, reportInitialSize = false
|
|
|
916
915
|
}
|
|
917
916
|
if (target) {
|
|
918
917
|
if (observedMap.has(target)) {
|
|
919
|
-
console.log(
|
|
920
|
-
"useResizeObserver attemping to observe same element twice",
|
|
921
|
-
{ target }
|
|
922
|
-
);
|
|
923
918
|
}
|
|
924
919
|
registerObserver();
|
|
925
920
|
}
|
|
@@ -1056,9 +1051,6 @@ var useDropdownBase = ({
|
|
|
1056
1051
|
var _a2;
|
|
1057
1052
|
const justFocused = (0, import_react8.useRef)(null);
|
|
1058
1053
|
const popperRef = (0, import_react8.useRef)(null);
|
|
1059
|
-
const popperCallbackRef = (0, import_react8.useCallback)((element) => {
|
|
1060
|
-
popperRef.current = element;
|
|
1061
|
-
}, []);
|
|
1062
1054
|
const [isOpen, setIsOpen] = (0, import_core.useControlled)({
|
|
1063
1055
|
controlled: isOpenProp,
|
|
1064
1056
|
default: Boolean(defaultIsOpen),
|
|
@@ -1074,11 +1066,45 @@ var useDropdownBase = ({
|
|
|
1074
1066
|
}, [onOpenChange, setIsOpen]);
|
|
1075
1067
|
const hideDropdown = (0, import_react8.useCallback)(
|
|
1076
1068
|
(reason) => {
|
|
1069
|
+
console.log(`hide dropdown ${reason}`);
|
|
1077
1070
|
setIsOpen(false);
|
|
1078
1071
|
onOpenChange == null ? void 0 : onOpenChange(false, reason);
|
|
1079
1072
|
},
|
|
1080
1073
|
[onOpenChange, setIsOpen]
|
|
1081
1074
|
);
|
|
1075
|
+
const handleComponentFocusOut = (0, import_react8.useCallback)(
|
|
1076
|
+
(evt) => {
|
|
1077
|
+
var _a3;
|
|
1078
|
+
const target = evt.relatedTarget;
|
|
1079
|
+
if (target === null) {
|
|
1080
|
+
requestAnimationFrame(() => {
|
|
1081
|
+
var _a4;
|
|
1082
|
+
if (!((_a4 = popperRef.current) == null ? void 0 : _a4.contains(document.activeElement))) {
|
|
1083
|
+
hideDropdown("Tab");
|
|
1084
|
+
}
|
|
1085
|
+
});
|
|
1086
|
+
} else if (!((_a3 = popperRef.current) == null ? void 0 : _a3.contains(target))) {
|
|
1087
|
+
if (!targetWithinSubPopup(popperRef.current, target)) {
|
|
1088
|
+
hideDropdown("Tab");
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
},
|
|
1092
|
+
[hideDropdown]
|
|
1093
|
+
);
|
|
1094
|
+
const popperCallbackRef = (0, import_react8.useCallback)(
|
|
1095
|
+
(element) => {
|
|
1096
|
+
if (element) {
|
|
1097
|
+
element.addEventListener("focusout", handleComponentFocusOut);
|
|
1098
|
+
} else if (popperRef.current) {
|
|
1099
|
+
popperRef.current.removeEventListener(
|
|
1100
|
+
"focusout",
|
|
1101
|
+
handleComponentFocusOut
|
|
1102
|
+
);
|
|
1103
|
+
}
|
|
1104
|
+
popperRef.current = element;
|
|
1105
|
+
},
|
|
1106
|
+
[handleComponentFocusOut]
|
|
1107
|
+
);
|
|
1082
1108
|
useClickAway({
|
|
1083
1109
|
popperRef,
|
|
1084
1110
|
rootRef,
|
|
@@ -2671,9 +2697,9 @@ var getNonWrappedAndWrappedItems = (container, orientation) => {
|
|
|
2671
2697
|
}
|
|
2672
2698
|
return [nonWrappedItems, wrappedItems];
|
|
2673
2699
|
};
|
|
2674
|
-
var applyOverflowClassToWrappedItems = (container, overflowedItems,
|
|
2700
|
+
var applyOverflowClassToWrappedItems = (container, overflowedItems, classBase31) => {
|
|
2675
2701
|
let ignoreOverflow = false;
|
|
2676
|
-
const className =
|
|
2702
|
+
const className = classBase31 ? `${classBase31}-overflowed` : "overflow";
|
|
2677
2703
|
if (overflowedItems.find(({ index }) => index === "overflow")) {
|
|
2678
2704
|
if (overflowedItems.length === 1) {
|
|
2679
2705
|
ignoreOverflow = true;
|
|
@@ -9236,7 +9262,8 @@ var useCombobox = ({
|
|
|
9236
9262
|
const handleInputKeyDown = (0, import_react51.useCallback)(
|
|
9237
9263
|
(e) => {
|
|
9238
9264
|
var _a3, _b;
|
|
9239
|
-
if (e.key === "Enter" && value !== void 0 && value !== "" && allowEnterCommitsText
|
|
9265
|
+
if (e.key === "Enter" && value !== void 0 && value !== "" && // TODO this whole allowEnterCommitsText isquestionable
|
|
9266
|
+
allowEnterCommitsText) {
|
|
9240
9267
|
setIsOpen(false);
|
|
9241
9268
|
}
|
|
9242
9269
|
(_b = (_a3 = InputProps4.inputProps) == null ? void 0 : _a3.onKeyDown) == null ? void 0 : _b.call(_a3, e);
|
|
@@ -9346,7 +9373,9 @@ var useCombobox = ({
|
|
|
9346
9373
|
};
|
|
9347
9374
|
|
|
9348
9375
|
// src/combo-box/ComboBox.tsx
|
|
9376
|
+
var import_clsx19 = __toESM(require("clsx"));
|
|
9349
9377
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
9378
|
+
var classBase11 = "vuuCombobox";
|
|
9350
9379
|
var ComboBox = (0, import_react52.forwardRef)(function Combobox({
|
|
9351
9380
|
InputProps: InputPropsProp,
|
|
9352
9381
|
ListProps: ListProps3,
|
|
@@ -9357,6 +9386,7 @@ var ComboBox = (0, import_react52.forwardRef)(function Combobox({
|
|
|
9357
9386
|
allowEnterCommitsText,
|
|
9358
9387
|
allowFreeText,
|
|
9359
9388
|
children,
|
|
9389
|
+
className,
|
|
9360
9390
|
defaultIsOpen,
|
|
9361
9391
|
defaultSelected,
|
|
9362
9392
|
defaultValue,
|
|
@@ -9470,6 +9500,7 @@ var ComboBox = (0, import_react52.forwardRef)(function Combobox({
|
|
|
9470
9500
|
{
|
|
9471
9501
|
...props,
|
|
9472
9502
|
PopupProps,
|
|
9503
|
+
className: (0, import_clsx19.default)(classBase11, className),
|
|
9473
9504
|
id,
|
|
9474
9505
|
isOpen: isOpen && collectionHook.data.length > 0,
|
|
9475
9506
|
onOpenChange,
|
|
@@ -9510,12 +9541,12 @@ var ComboBox = (0, import_react52.forwardRef)(function Combobox({
|
|
|
9510
9541
|
|
|
9511
9542
|
// src/cycle-state-button/CycleStateButton.tsx
|
|
9512
9543
|
var import_core24 = require("@salt-ds/core");
|
|
9513
|
-
var
|
|
9544
|
+
var import_clsx20 = __toESM(require("clsx"));
|
|
9514
9545
|
var import_react53 = require("react");
|
|
9515
9546
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
9516
|
-
var
|
|
9547
|
+
var classBase12 = "vuuCycleStateButton";
|
|
9517
9548
|
var getNextValue = (value, valueList) => {
|
|
9518
|
-
const index = valueList.indexOf(value.toUpperCase());
|
|
9549
|
+
const index = valueList.map((v) => v.toUpperCase()).indexOf(value.toUpperCase());
|
|
9519
9550
|
if (index === valueList.length - 1) {
|
|
9520
9551
|
return valueList[0];
|
|
9521
9552
|
} else {
|
|
@@ -9524,6 +9555,7 @@ var getNextValue = (value, valueList) => {
|
|
|
9524
9555
|
};
|
|
9525
9556
|
var CycleStateButton = (0, import_react53.forwardRef)(function CycleStateButton2({
|
|
9526
9557
|
className,
|
|
9558
|
+
onChange,
|
|
9527
9559
|
onCommit,
|
|
9528
9560
|
value = "",
|
|
9529
9561
|
values,
|
|
@@ -9532,22 +9564,23 @@ var CycleStateButton = (0, import_react53.forwardRef)(function CycleStateButton2
|
|
|
9532
9564
|
const handleClick = (0, import_react53.useCallback)(
|
|
9533
9565
|
(evt) => {
|
|
9534
9566
|
const nextValue = getNextValue(value, values);
|
|
9535
|
-
|
|
9567
|
+
onChange == null ? void 0 : onChange(nextValue);
|
|
9568
|
+
onCommit == null ? void 0 : onCommit(evt, nextValue).then((response) => {
|
|
9536
9569
|
if (response !== true) {
|
|
9537
9570
|
console.error(response);
|
|
9538
9571
|
}
|
|
9539
9572
|
});
|
|
9540
9573
|
},
|
|
9541
|
-
[onCommit, value, values]
|
|
9574
|
+
[onChange, onCommit, value, values]
|
|
9542
9575
|
);
|
|
9543
9576
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
9544
9577
|
import_core24.Button,
|
|
9545
9578
|
{
|
|
9546
9579
|
...buttonProps,
|
|
9547
|
-
className: (0,
|
|
9548
|
-
|
|
9580
|
+
className: (0, import_clsx20.default)(
|
|
9581
|
+
classBase12,
|
|
9549
9582
|
className,
|
|
9550
|
-
`${
|
|
9583
|
+
`${classBase12}-${value.toLowerCase()}`
|
|
9551
9584
|
),
|
|
9552
9585
|
onClick: handleClick,
|
|
9553
9586
|
ref: forwardedRef,
|
|
@@ -9558,12 +9591,12 @@ var CycleStateButton = (0, import_react53.forwardRef)(function CycleStateButton2
|
|
|
9558
9591
|
|
|
9559
9592
|
// src/date-input/DateInput.tsx
|
|
9560
9593
|
var import_vuu_utils18 = require("@vuu-ui/vuu-utils");
|
|
9561
|
-
var
|
|
9594
|
+
var import_clsx22 = require("clsx");
|
|
9562
9595
|
var import_react57 = require("react");
|
|
9563
9596
|
|
|
9564
9597
|
// src/date-popup/DatePopup.tsx
|
|
9565
9598
|
var import_core25 = require("@salt-ds/core");
|
|
9566
|
-
var
|
|
9599
|
+
var import_clsx21 = __toESM(require("clsx"));
|
|
9567
9600
|
var import_react55 = require("react");
|
|
9568
9601
|
|
|
9569
9602
|
// src/date-popup/useDatePopup.ts
|
|
@@ -9643,7 +9676,7 @@ var useDatePopup = ({
|
|
|
9643
9676
|
|
|
9644
9677
|
// src/date-popup/DatePopup.tsx
|
|
9645
9678
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
9646
|
-
var
|
|
9679
|
+
var classBase13 = "vuuDatePopup";
|
|
9647
9680
|
var tz = $14e0f24ef4ac5c92$export$aa8b41735afcabd2();
|
|
9648
9681
|
var today = $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3(tz);
|
|
9649
9682
|
var DatePopup = (0, import_react55.forwardRef)(
|
|
@@ -9676,7 +9709,7 @@ var DatePopup = (0, import_react55.forwardRef)(
|
|
|
9676
9709
|
DropdownBase,
|
|
9677
9710
|
{
|
|
9678
9711
|
...htmlAttributes,
|
|
9679
|
-
className:
|
|
9712
|
+
className: classBase13,
|
|
9680
9713
|
isOpen,
|
|
9681
9714
|
placement: "below",
|
|
9682
9715
|
onOpenChange: handleOpenChange,
|
|
@@ -9688,7 +9721,7 @@ var DatePopup = (0, import_react55.forwardRef)(
|
|
|
9688
9721
|
icon: "date",
|
|
9689
9722
|
ref: (0, import_core25.useForkRef)(forwardedRef, triggererRef),
|
|
9690
9723
|
variant: "secondary",
|
|
9691
|
-
className: (0,
|
|
9724
|
+
className: (0, import_clsx21.default)({ "saltButton-active": isOpen })
|
|
9692
9725
|
}
|
|
9693
9726
|
),
|
|
9694
9727
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
@@ -9700,7 +9733,7 @@ var DatePopup = (0, import_react55.forwardRef)(
|
|
|
9700
9733
|
selectionVariant: "default",
|
|
9701
9734
|
onSelectedDateChange,
|
|
9702
9735
|
onVisibleMonthChange,
|
|
9703
|
-
className: `${
|
|
9736
|
+
className: `${classBase13}-calendar`
|
|
9704
9737
|
}
|
|
9705
9738
|
)
|
|
9706
9739
|
]
|
|
@@ -9727,8 +9760,9 @@ function useDatePicker({ onBlur }) {
|
|
|
9727
9760
|
|
|
9728
9761
|
// src/date-input/DateInput.tsx
|
|
9729
9762
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
9730
|
-
var
|
|
9763
|
+
var classBase14 = "vuuDateInput";
|
|
9731
9764
|
var DateInput = ({
|
|
9765
|
+
inputProps,
|
|
9732
9766
|
selectedDate,
|
|
9733
9767
|
onChange,
|
|
9734
9768
|
onBlur,
|
|
@@ -9744,31 +9778,37 @@ var DateInput = ({
|
|
|
9744
9778
|
if (v === "")
|
|
9745
9779
|
return;
|
|
9746
9780
|
else
|
|
9747
|
-
onChange((0, import_vuu_utils18.toCalendarDate)(new Date(v)));
|
|
9781
|
+
onChange((0, import_vuu_utils18.toCalendarDate)(new Date(v)), "input");
|
|
9748
9782
|
},
|
|
9749
9783
|
[onChange]
|
|
9750
9784
|
);
|
|
9751
9785
|
const onKeyDown = (0, import_react57.useCallback)((e) => {
|
|
9752
9786
|
if (e.key === "Tab" && !e.shiftKey) {
|
|
9753
|
-
console.log({ button: popupRef.current });
|
|
9754
9787
|
requestAnimationFrame(() => {
|
|
9755
9788
|
var _a3;
|
|
9756
9789
|
(_a3 = popupRef.current) == null ? void 0 : _a3.focus();
|
|
9757
9790
|
});
|
|
9758
9791
|
}
|
|
9759
9792
|
}, []);
|
|
9793
|
+
const onChangeCalendar = (0, import_react57.useCallback)(
|
|
9794
|
+
(date) => {
|
|
9795
|
+
onChange(date, "calendar");
|
|
9796
|
+
},
|
|
9797
|
+
[onChange]
|
|
9798
|
+
);
|
|
9760
9799
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
9761
9800
|
"div",
|
|
9762
9801
|
{
|
|
9763
9802
|
...htmlAttributes,
|
|
9764
|
-
className: (0,
|
|
9803
|
+
className: (0, import_clsx22.clsx)(classBase14, className),
|
|
9765
9804
|
onBlur: handleOnBlur,
|
|
9766
9805
|
children: [
|
|
9767
9806
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
9768
9807
|
"input",
|
|
9769
9808
|
{
|
|
9809
|
+
...inputProps,
|
|
9770
9810
|
"aria-label": "date-input",
|
|
9771
|
-
className: (0,
|
|
9811
|
+
className: (0, import_clsx22.clsx)("saltInput-input", classBase14),
|
|
9772
9812
|
type: "date",
|
|
9773
9813
|
value: (_a2 = selectedDate == null ? void 0 : selectedDate.toString()) != null ? _a2 : "",
|
|
9774
9814
|
onChange: onInputChange,
|
|
@@ -9781,7 +9821,7 @@ var DateInput = ({
|
|
|
9781
9821
|
{
|
|
9782
9822
|
"data-embedded": true,
|
|
9783
9823
|
onBlur,
|
|
9784
|
-
onChange,
|
|
9824
|
+
onChange: onChangeCalendar,
|
|
9785
9825
|
ref: popupRef,
|
|
9786
9826
|
selectedDate,
|
|
9787
9827
|
selectionVariant: "default"
|
|
@@ -9794,10 +9834,10 @@ var DateInput = ({
|
|
|
9794
9834
|
|
|
9795
9835
|
// src/date-input/DateRangeInput.tsx
|
|
9796
9836
|
var import_vuu_utils19 = require("@vuu-ui/vuu-utils");
|
|
9797
|
-
var
|
|
9837
|
+
var import_clsx23 = __toESM(require("clsx"));
|
|
9798
9838
|
var import_react58 = require("react");
|
|
9799
9839
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
9800
|
-
var
|
|
9840
|
+
var classBase15 = "vuuDateInput";
|
|
9801
9841
|
var DateRangeInput = ({
|
|
9802
9842
|
selectedDateRange,
|
|
9803
9843
|
onChange,
|
|
@@ -9824,13 +9864,13 @@ var DateRangeInput = ({
|
|
|
9824
9864
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
9825
9865
|
"div",
|
|
9826
9866
|
{
|
|
9827
|
-
className: (0,
|
|
9867
|
+
className: (0, import_clsx23.default)("saltInput saltInput-primary", classBase15, className),
|
|
9828
9868
|
onBlur: handleOnBlur,
|
|
9829
9869
|
children: [
|
|
9830
9870
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
9831
9871
|
"input",
|
|
9832
9872
|
{
|
|
9833
|
-
className: (0,
|
|
9873
|
+
className: (0, import_clsx23.default)("saltInput-input", classBase15, className),
|
|
9834
9874
|
type: "date",
|
|
9835
9875
|
value: (_b = (_a2 = selectedDateRange == null ? void 0 : selectedDateRange["startDate"]) == null ? void 0 : _a2.toString()) != null ? _b : "",
|
|
9836
9876
|
onChange: getHandleInputChange("startDate"),
|
|
@@ -9842,7 +9882,7 @@ var DateRangeInput = ({
|
|
|
9842
9882
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
9843
9883
|
"input",
|
|
9844
9884
|
{
|
|
9845
|
-
className: (0,
|
|
9885
|
+
className: (0, import_clsx23.default)("saltInput-input", classBase15, className),
|
|
9846
9886
|
type: "date",
|
|
9847
9887
|
value: (_d = (_c = selectedDateRange == null ? void 0 : selectedDateRange["endDate"]) == null ? void 0 : _c.toString()) != null ? _d : "",
|
|
9848
9888
|
onChange: getHandleInputChange("endDate"),
|
|
@@ -9864,331 +9904,13 @@ var DateRangeInput = ({
|
|
|
9864
9904
|
);
|
|
9865
9905
|
};
|
|
9866
9906
|
|
|
9867
|
-
// src/date-picker/DatePicker.tsx
|
|
9868
|
-
var import_react63 = require("react");
|
|
9869
|
-
var import_clsx25 = require("clsx");
|
|
9870
|
-
|
|
9871
|
-
// src/date-picker/input/DatePickerInput.tsx
|
|
9872
|
-
var import_react59 = require("react");
|
|
9873
|
-
var import_vuu_utils20 = require("@vuu-ui/vuu-utils");
|
|
9874
|
-
var import_clsx23 = require("clsx");
|
|
9875
|
-
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
9876
|
-
var baseClass2 = "vuuDatePickerInput";
|
|
9877
|
-
var DatePickerInput = (props) => {
|
|
9878
|
-
var _a2;
|
|
9879
|
-
const { value, onChange, className } = props;
|
|
9880
|
-
const onInputChange = (0, import_react59.useCallback)(
|
|
9881
|
-
(e) => {
|
|
9882
|
-
const v = e.target.value;
|
|
9883
|
-
if (v === "")
|
|
9884
|
-
return;
|
|
9885
|
-
else
|
|
9886
|
-
onChange((0, import_vuu_utils20.toCalendarDate)(new Date(v)));
|
|
9887
|
-
},
|
|
9888
|
-
[onChange]
|
|
9889
|
-
);
|
|
9890
|
-
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
9891
|
-
"input",
|
|
9892
|
-
{
|
|
9893
|
-
className: (0, import_clsx23.clsx)("saltInput-input", baseClass2, className),
|
|
9894
|
-
type: "date",
|
|
9895
|
-
value: (_a2 = value == null ? void 0 : value.toString()) != null ? _a2 : "",
|
|
9896
|
-
onChange: onInputChange,
|
|
9897
|
-
"aria-label": "date-input",
|
|
9898
|
-
max: "9999-12-31"
|
|
9899
|
-
}
|
|
9900
|
-
);
|
|
9901
|
-
};
|
|
9902
|
-
|
|
9903
|
-
// src/date-picker/internal/CalendarIconButton.tsx
|
|
9904
|
-
var import_core26 = require("@salt-ds/core");
|
|
9905
|
-
var import_icons2 = require("@salt-ds/icons");
|
|
9906
|
-
var import_react60 = require("react");
|
|
9907
|
-
var import_clsx24 = __toESM(require("clsx"));
|
|
9908
|
-
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
9909
|
-
var baseClass3 = "vuuDatePicker-calendarIconButton";
|
|
9910
|
-
var CalendarIconButton = (0, import_react60.forwardRef)(function CalendarIconButton2({ className, ...rest }, ref) {
|
|
9911
|
-
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
9912
|
-
import_core26.Button,
|
|
9913
|
-
{
|
|
9914
|
-
className: (0, import_clsx24.default)(baseClass3, className),
|
|
9915
|
-
variant: "secondary",
|
|
9916
|
-
"aria-label": "calendar-icon-button",
|
|
9917
|
-
ref,
|
|
9918
|
-
...rest,
|
|
9919
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_icons2.CalendarIcon, {})
|
|
9920
|
-
}
|
|
9921
|
-
);
|
|
9922
|
-
});
|
|
9923
|
-
|
|
9924
|
-
// src/date-picker/useBaseDatePicker.ts
|
|
9925
|
-
var import_react61 = require("react");
|
|
9926
|
-
function useBaseDatePicker(props) {
|
|
9927
|
-
var _a2;
|
|
9928
|
-
const { onBlur } = props;
|
|
9929
|
-
const [visibleMonth, setVisibleMonth] = (0, import_react61.useState)(
|
|
9930
|
-
props.variant === "default" ? props.selectedDate : (_a2 = props.selectedDate) == null ? void 0 : _a2.startDate
|
|
9931
|
-
);
|
|
9932
|
-
const handleOnBlur = (0, import_react61.useCallback)(
|
|
9933
|
-
(e) => {
|
|
9934
|
-
if (!e.currentTarget.contains(e.relatedTarget)) {
|
|
9935
|
-
onBlur == null ? void 0 : onBlur();
|
|
9936
|
-
}
|
|
9937
|
-
},
|
|
9938
|
-
[onBlur]
|
|
9939
|
-
);
|
|
9940
|
-
return {
|
|
9941
|
-
handleOnBlur,
|
|
9942
|
-
visibleMonth,
|
|
9943
|
-
handleVisibleMonthChange: setVisibleMonth
|
|
9944
|
-
};
|
|
9945
|
-
}
|
|
9946
|
-
|
|
9947
|
-
// src/date-picker/useBaseDatePickerDropdown.ts
|
|
9948
|
-
var import_react62 = require("react");
|
|
9949
|
-
function useBaseDatePickerDropdown({
|
|
9950
|
-
onVisibleMonthChange,
|
|
9951
|
-
onSelectedDateChange,
|
|
9952
|
-
shouldCloseOnSelectionChange
|
|
9953
|
-
}) {
|
|
9954
|
-
const [isOpen, setIsOpen] = (0, import_react62.useState)(false);
|
|
9955
|
-
const triggererRef = (0, import_react62.useRef)(null);
|
|
9956
|
-
const handleDateSelection = (0, import_react62.useCallback)(
|
|
9957
|
-
(_, d) => {
|
|
9958
|
-
var _a2;
|
|
9959
|
-
onSelectedDateChange(d);
|
|
9960
|
-
if (shouldCloseOnSelectionChange(d))
|
|
9961
|
-
setIsOpen(false);
|
|
9962
|
-
(_a2 = triggererRef.current) == null ? void 0 : _a2.focus();
|
|
9963
|
-
},
|
|
9964
|
-
[onSelectedDateChange, shouldCloseOnSelectionChange]
|
|
9965
|
-
);
|
|
9966
|
-
const handleVisibleMonthChange = (0, import_react62.useCallback)(
|
|
9967
|
-
(_, d) => {
|
|
9968
|
-
var _a2;
|
|
9969
|
-
onVisibleMonthChange(d);
|
|
9970
|
-
(_a2 = triggererRef.current) == null ? void 0 : _a2.focus();
|
|
9971
|
-
},
|
|
9972
|
-
[onVisibleMonthChange]
|
|
9973
|
-
);
|
|
9974
|
-
return {
|
|
9975
|
-
isOpen,
|
|
9976
|
-
handleOpenChange: setIsOpen,
|
|
9977
|
-
triggererRef,
|
|
9978
|
-
handleVisibleMonthChange,
|
|
9979
|
-
handleDateSelection
|
|
9980
|
-
};
|
|
9981
|
-
}
|
|
9982
|
-
|
|
9983
|
-
// src/date-picker/DatePicker.tsx
|
|
9984
|
-
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
9985
|
-
var baseClass4 = "vuuDatePicker";
|
|
9986
|
-
var DatePicker = (props) => {
|
|
9987
|
-
const { selectedDate, onSelectedDateChange, onBlur, className } = props;
|
|
9988
|
-
const { visibleMonth, handleVisibleMonthChange, handleOnBlur } = useBaseDatePicker({ variant: "default", selectedDate, onBlur });
|
|
9989
|
-
const handleInputChange = (0, import_react63.useCallback)(
|
|
9990
|
-
(d) => {
|
|
9991
|
-
onSelectedDateChange(d);
|
|
9992
|
-
handleVisibleMonthChange(d);
|
|
9993
|
-
},
|
|
9994
|
-
[onSelectedDateChange, handleVisibleMonthChange]
|
|
9995
|
-
);
|
|
9996
|
-
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
9997
|
-
"div",
|
|
9998
|
-
{
|
|
9999
|
-
className: (0, import_clsx25.clsx)("saltInput saltInput-primary", baseClass4, className),
|
|
10000
|
-
onBlur: handleOnBlur,
|
|
10001
|
-
children: [
|
|
10002
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DatePickerInput, { value: selectedDate, onChange: handleInputChange }),
|
|
10003
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
10004
|
-
DatePickerDropdown,
|
|
10005
|
-
{
|
|
10006
|
-
visibleMonth,
|
|
10007
|
-
onVisibleMonthChange: handleVisibleMonthChange,
|
|
10008
|
-
...props
|
|
10009
|
-
}
|
|
10010
|
-
)
|
|
10011
|
-
]
|
|
10012
|
-
}
|
|
10013
|
-
);
|
|
10014
|
-
};
|
|
10015
|
-
var DatePickerDropdown = (props) => {
|
|
10016
|
-
const {
|
|
10017
|
-
closeOnSelection,
|
|
10018
|
-
onSelectedDateChange,
|
|
10019
|
-
onVisibleMonthChange,
|
|
10020
|
-
className,
|
|
10021
|
-
...rest
|
|
10022
|
-
} = props;
|
|
10023
|
-
const shouldCloseOnSelectionChange = (0, import_react63.useCallback)(
|
|
10024
|
-
() => !!closeOnSelection,
|
|
10025
|
-
[closeOnSelection]
|
|
10026
|
-
);
|
|
10027
|
-
const {
|
|
10028
|
-
triggererRef,
|
|
10029
|
-
isOpen,
|
|
10030
|
-
handleOpenChange,
|
|
10031
|
-
handleVisibleMonthChange,
|
|
10032
|
-
handleDateSelection
|
|
10033
|
-
} = useBaseDatePickerDropdown({
|
|
10034
|
-
onVisibleMonthChange,
|
|
10035
|
-
onSelectedDateChange,
|
|
10036
|
-
shouldCloseOnSelectionChange
|
|
10037
|
-
});
|
|
10038
|
-
const defaultSelectedDate = (0, import_react63.useMemo)(() => $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3($14e0f24ef4ac5c92$export$aa8b41735afcabd2()), []);
|
|
10039
|
-
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
10040
|
-
DropdownBase,
|
|
10041
|
-
{
|
|
10042
|
-
placement: "below",
|
|
10043
|
-
isOpen,
|
|
10044
|
-
onOpenChange: handleOpenChange,
|
|
10045
|
-
className,
|
|
10046
|
-
children: [
|
|
10047
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CalendarIconButton, { ref: triggererRef }),
|
|
10048
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
10049
|
-
Calendar,
|
|
10050
|
-
{
|
|
10051
|
-
selectionVariant: "default",
|
|
10052
|
-
onVisibleMonthChange: handleVisibleMonthChange,
|
|
10053
|
-
onSelectedDateChange: handleDateSelection,
|
|
10054
|
-
defaultSelectedDate,
|
|
10055
|
-
className: `${baseClass4}-calendar`,
|
|
10056
|
-
...rest
|
|
10057
|
-
}
|
|
10058
|
-
)
|
|
10059
|
-
]
|
|
10060
|
-
}
|
|
10061
|
-
);
|
|
10062
|
-
};
|
|
10063
|
-
|
|
10064
|
-
// src/date-picker/DateRangePicker.tsx
|
|
10065
|
-
var import_react65 = require("react");
|
|
10066
|
-
var import_clsx27 = require("clsx");
|
|
10067
|
-
|
|
10068
|
-
// src/date-picker/input/DateRangePickerInput.tsx
|
|
10069
|
-
var import_react64 = require("react");
|
|
10070
|
-
var import_clsx26 = require("clsx");
|
|
10071
|
-
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
10072
|
-
var baseClass5 = "vuuDateRangePickerInput";
|
|
10073
|
-
var DateRangePickerInput = (props) => {
|
|
10074
|
-
const { value, onChange, className } = props;
|
|
10075
|
-
const getHandleInputChange = (0, import_react64.useCallback)(
|
|
10076
|
-
(k) => (d) => {
|
|
10077
|
-
onChange({ ...value, [k]: d });
|
|
10078
|
-
},
|
|
10079
|
-
[value, onChange]
|
|
10080
|
-
);
|
|
10081
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: (0, import_clsx26.clsx)(baseClass5, className), children: [
|
|
10082
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
10083
|
-
DatePickerInput,
|
|
10084
|
-
{
|
|
10085
|
-
value: value == null ? void 0 : value["startDate"],
|
|
10086
|
-
onChange: getHandleInputChange("startDate")
|
|
10087
|
-
}
|
|
10088
|
-
),
|
|
10089
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: "\u2014" }),
|
|
10090
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
10091
|
-
DatePickerInput,
|
|
10092
|
-
{
|
|
10093
|
-
value: value == null ? void 0 : value["endDate"],
|
|
10094
|
-
onChange: getHandleInputChange("endDate")
|
|
10095
|
-
}
|
|
10096
|
-
)
|
|
10097
|
-
] });
|
|
10098
|
-
};
|
|
10099
|
-
|
|
10100
|
-
// src/date-picker/DateRangePicker.tsx
|
|
10101
|
-
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
10102
|
-
var baseClass6 = "vuuDatePicker";
|
|
10103
|
-
var DateRangePicker = (props) => {
|
|
10104
|
-
const { selectedDate, onSelectedDateChange, className, onBlur } = props;
|
|
10105
|
-
const { visibleMonth, handleVisibleMonthChange, handleOnBlur } = useBaseDatePicker({ variant: "range", selectedDate, onBlur });
|
|
10106
|
-
const handleInputChange = (0, import_react65.useCallback)(
|
|
10107
|
-
(r) => {
|
|
10108
|
-
var _a2;
|
|
10109
|
-
onSelectedDateChange(r);
|
|
10110
|
-
handleVisibleMonthChange((_a2 = r.endDate) != null ? _a2 : r.startDate);
|
|
10111
|
-
},
|
|
10112
|
-
[onSelectedDateChange, handleVisibleMonthChange]
|
|
10113
|
-
);
|
|
10114
|
-
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
10115
|
-
"div",
|
|
10116
|
-
{
|
|
10117
|
-
className: (0, import_clsx27.clsx)("saltInput saltInput-primary", baseClass6, className),
|
|
10118
|
-
onBlur: handleOnBlur,
|
|
10119
|
-
children: [
|
|
10120
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DateRangePickerInput, { value: selectedDate, onChange: handleInputChange }),
|
|
10121
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
10122
|
-
DateRangePickerDropdown,
|
|
10123
|
-
{
|
|
10124
|
-
...props,
|
|
10125
|
-
visibleMonth,
|
|
10126
|
-
onVisibleMonthChange: handleVisibleMonthChange
|
|
10127
|
-
}
|
|
10128
|
-
)
|
|
10129
|
-
]
|
|
10130
|
-
}
|
|
10131
|
-
);
|
|
10132
|
-
};
|
|
10133
|
-
var DateRangePickerDropdown = (props) => {
|
|
10134
|
-
const {
|
|
10135
|
-
onVisibleMonthChange,
|
|
10136
|
-
onSelectedDateChange,
|
|
10137
|
-
closeOnSelection,
|
|
10138
|
-
className,
|
|
10139
|
-
...rest
|
|
10140
|
-
} = props;
|
|
10141
|
-
const shouldCloseOnSelectionChange = (0, import_react65.useCallback)(
|
|
10142
|
-
(r) => !!(closeOnSelection && r.endDate),
|
|
10143
|
-
[closeOnSelection]
|
|
10144
|
-
);
|
|
10145
|
-
const {
|
|
10146
|
-
triggererRef,
|
|
10147
|
-
isOpen,
|
|
10148
|
-
handleOpenChange,
|
|
10149
|
-
handleVisibleMonthChange,
|
|
10150
|
-
handleDateSelection
|
|
10151
|
-
} = useBaseDatePickerDropdown({
|
|
10152
|
-
onVisibleMonthChange,
|
|
10153
|
-
onSelectedDateChange,
|
|
10154
|
-
shouldCloseOnSelectionChange
|
|
10155
|
-
});
|
|
10156
|
-
const defaultSelectedDate = (0, import_react65.useMemo)(
|
|
10157
|
-
() => ({ startDate: $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3($14e0f24ef4ac5c92$export$aa8b41735afcabd2()) }),
|
|
10158
|
-
[]
|
|
10159
|
-
);
|
|
10160
|
-
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
10161
|
-
DropdownBase,
|
|
10162
|
-
{
|
|
10163
|
-
placement: "below",
|
|
10164
|
-
isOpen,
|
|
10165
|
-
className,
|
|
10166
|
-
onOpenChange: handleOpenChange,
|
|
10167
|
-
children: [
|
|
10168
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CalendarIconButton, { ref: triggererRef }),
|
|
10169
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
10170
|
-
Calendar,
|
|
10171
|
-
{
|
|
10172
|
-
selectionVariant: "range",
|
|
10173
|
-
onVisibleMonthChange: handleVisibleMonthChange,
|
|
10174
|
-
onSelectedDateChange: handleDateSelection,
|
|
10175
|
-
defaultSelectedDate,
|
|
10176
|
-
className: `${baseClass6}-calendar`,
|
|
10177
|
-
...rest
|
|
10178
|
-
}
|
|
10179
|
-
)
|
|
10180
|
-
]
|
|
10181
|
-
}
|
|
10182
|
-
);
|
|
10183
|
-
};
|
|
10184
|
-
|
|
10185
9907
|
// src/editable/editable-utils.ts
|
|
10186
|
-
var
|
|
9908
|
+
var import_vuu_utils20 = require("@vuu-ui/vuu-utils");
|
|
10187
9909
|
var buildValidationChecker = (rules) => (value) => applyRules(rules, value);
|
|
10188
9910
|
function applyRules(rules, value) {
|
|
10189
9911
|
let result = void 0;
|
|
10190
9912
|
for (const rule of rules) {
|
|
10191
|
-
const editRuleValidator = (0,
|
|
9913
|
+
const editRuleValidator = (0, import_vuu_utils20.getEditRuleValidator)(rule.name);
|
|
10192
9914
|
if (editRuleValidator) {
|
|
10193
9915
|
const ruleResult = editRuleValidator(rule, value);
|
|
10194
9916
|
switch (ruleResult) {
|
|
@@ -10216,9 +9938,9 @@ function applyRules(rules, value) {
|
|
|
10216
9938
|
}
|
|
10217
9939
|
|
|
10218
9940
|
// src/editable/useEditableText.ts
|
|
9941
|
+
var import_vuu_utils21 = require("@vuu-ui/vuu-utils");
|
|
10219
9942
|
var import_vuu_utils22 = require("@vuu-ui/vuu-utils");
|
|
10220
|
-
var
|
|
10221
|
-
var import_react66 = require("react");
|
|
9943
|
+
var import_react59 = require("react");
|
|
10222
9944
|
var WarnCommit = () => {
|
|
10223
9945
|
console.warn(
|
|
10224
9946
|
"onCommit handler has not been provided to InputCell cell renderer"
|
|
@@ -10231,15 +9953,15 @@ var useEditableText = ({
|
|
|
10231
9953
|
onCommit,
|
|
10232
9954
|
type
|
|
10233
9955
|
}) => {
|
|
10234
|
-
const [message, setMessage] = (0,
|
|
10235
|
-
const [value, setValue] = (0,
|
|
10236
|
-
const initialValueRef = (0,
|
|
10237
|
-
const isDirtyRef = (0,
|
|
10238
|
-
const hasCommittedRef = (0,
|
|
10239
|
-
(0,
|
|
9956
|
+
const [message, setMessage] = (0, import_react59.useState)();
|
|
9957
|
+
const [value, setValue] = (0, import_react59.useState)(initialValue);
|
|
9958
|
+
const initialValueRef = (0, import_react59.useRef)(initialValue);
|
|
9959
|
+
const isDirtyRef = (0, import_react59.useRef)(false);
|
|
9960
|
+
const hasCommittedRef = (0, import_react59.useRef)(false);
|
|
9961
|
+
(0, import_vuu_utils21.useLayoutEffectSkipFirst)(() => {
|
|
10240
9962
|
setValue(initialValue);
|
|
10241
9963
|
}, [initialValue]);
|
|
10242
|
-
const commit = (0,
|
|
9964
|
+
const commit = (0, import_react59.useCallback)(
|
|
10243
9965
|
(target) => {
|
|
10244
9966
|
if (isDirtyRef.current) {
|
|
10245
9967
|
hasCommittedRef.current = true;
|
|
@@ -10252,20 +9974,20 @@ var useEditableText = ({
|
|
|
10252
9974
|
onCommit(value).then((response) => {
|
|
10253
9975
|
if (response === true) {
|
|
10254
9976
|
isDirtyRef.current = false;
|
|
10255
|
-
(0,
|
|
9977
|
+
(0, import_vuu_utils22.dispatchCustomEvent)(target, "vuu-commit");
|
|
10256
9978
|
} else {
|
|
10257
9979
|
setMessage(response);
|
|
10258
9980
|
}
|
|
10259
9981
|
});
|
|
10260
9982
|
}
|
|
10261
9983
|
} else {
|
|
10262
|
-
(0,
|
|
9984
|
+
(0, import_vuu_utils22.dispatchCustomEvent)(target, "vuu-commit");
|
|
10263
9985
|
hasCommittedRef.current = false;
|
|
10264
9986
|
}
|
|
10265
9987
|
},
|
|
10266
9988
|
[clientSideEditValidationCheck, onCommit, value]
|
|
10267
9989
|
);
|
|
10268
|
-
const handleKeyDown = (0,
|
|
9990
|
+
const handleKeyDown = (0, import_react59.useCallback)(
|
|
10269
9991
|
(evt) => {
|
|
10270
9992
|
if (evt.key === "Enter") {
|
|
10271
9993
|
commit(evt.target);
|
|
@@ -10281,7 +10003,7 @@ var useEditableText = ({
|
|
|
10281
10003
|
},
|
|
10282
10004
|
[commit]
|
|
10283
10005
|
);
|
|
10284
|
-
const handleBlur = (0,
|
|
10006
|
+
const handleBlur = (0, import_react59.useCallback)(
|
|
10285
10007
|
(evt) => {
|
|
10286
10008
|
if (isDirtyRef.current) {
|
|
10287
10009
|
commit(evt.target);
|
|
@@ -10289,7 +10011,7 @@ var useEditableText = ({
|
|
|
10289
10011
|
},
|
|
10290
10012
|
[commit]
|
|
10291
10013
|
);
|
|
10292
|
-
const handleChange = (0,
|
|
10014
|
+
const handleChange = (0, import_react59.useCallback)(
|
|
10293
10015
|
(evt) => {
|
|
10294
10016
|
let typedValue = evt.target.value;
|
|
10295
10017
|
if (type === "number" && !isNaN(parseFloat(typedValue))) {
|
|
@@ -10318,15 +10040,19 @@ var useEditableText = ({
|
|
|
10318
10040
|
};
|
|
10319
10041
|
|
|
10320
10042
|
// src/editable-label/EditableLabel.tsx
|
|
10321
|
-
var
|
|
10322
|
-
var
|
|
10323
|
-
var
|
|
10324
|
-
var
|
|
10325
|
-
var
|
|
10326
|
-
var
|
|
10043
|
+
var import_clsx24 = __toESM(require("clsx"));
|
|
10044
|
+
var import_react60 = require("react");
|
|
10045
|
+
var import_core26 = require("@salt-ds/core");
|
|
10046
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
10047
|
+
var classBase16 = "vuuEditableLabel";
|
|
10048
|
+
var NullEditAPI = {
|
|
10049
|
+
beginEdit: () => void 0
|
|
10050
|
+
};
|
|
10051
|
+
var EditableLabel = (0, import_react60.forwardRef)(function EditableLabel2({
|
|
10327
10052
|
className: classNameProp,
|
|
10328
10053
|
defaultEditing,
|
|
10329
10054
|
defaultValue,
|
|
10055
|
+
editLabelApiRef,
|
|
10330
10056
|
editing: editingProp,
|
|
10331
10057
|
onChange,
|
|
10332
10058
|
onEnterEditMode,
|
|
@@ -10334,28 +10060,28 @@ var EditableLabel = (0, import_react67.forwardRef)(function EditableLabel2({
|
|
|
10334
10060
|
value: valueProp,
|
|
10335
10061
|
...restProps
|
|
10336
10062
|
}, forwardedRef) {
|
|
10337
|
-
const inputRef = (0,
|
|
10338
|
-
const editingRef = (0,
|
|
10339
|
-
const [value, setValue] = (0,
|
|
10063
|
+
const inputRef = (0, import_react60.useRef)(null);
|
|
10064
|
+
const editingRef = (0, import_react60.useRef)(false);
|
|
10065
|
+
const [value, setValue] = (0, import_core26.useControlled)({
|
|
10340
10066
|
controlled: valueProp,
|
|
10341
10067
|
default: defaultValue != null ? defaultValue : "",
|
|
10342
10068
|
name: "EditableLabel",
|
|
10343
10069
|
state: "value"
|
|
10344
10070
|
});
|
|
10345
|
-
const [editing, _setEditing] = (0,
|
|
10071
|
+
const [editing, _setEditing] = (0, import_core26.useControlled)({
|
|
10346
10072
|
controlled: editingProp,
|
|
10347
10073
|
default: defaultEditing != null ? defaultEditing : false,
|
|
10348
10074
|
name: "EditableLabel",
|
|
10349
10075
|
state: "editing"
|
|
10350
10076
|
});
|
|
10351
|
-
const setEditing = (0,
|
|
10077
|
+
const setEditing = (0, import_react60.useCallback)(
|
|
10352
10078
|
(value2) => {
|
|
10353
10079
|
_setEditing(editingRef.current = value2);
|
|
10354
10080
|
},
|
|
10355
10081
|
[_setEditing]
|
|
10356
10082
|
);
|
|
10357
|
-
const initialValue = (0,
|
|
10358
|
-
(0,
|
|
10083
|
+
const initialValue = (0, import_react60.useRef)(value);
|
|
10084
|
+
(0, import_react60.useLayoutEffect)(() => {
|
|
10359
10085
|
if (editing) {
|
|
10360
10086
|
if (inputRef.current !== null) {
|
|
10361
10087
|
inputRef.current.select();
|
|
@@ -10363,10 +10089,17 @@ var EditableLabel = (0, import_react67.forwardRef)(function EditableLabel2({
|
|
|
10363
10089
|
}
|
|
10364
10090
|
}
|
|
10365
10091
|
}, [editing, inputRef]);
|
|
10366
|
-
const
|
|
10092
|
+
const beginEdit = (0, import_react60.useCallback)(() => {
|
|
10367
10093
|
setEditing(true);
|
|
10368
|
-
onEnterEditMode
|
|
10094
|
+
onEnterEditMode == null ? void 0 : onEnterEditMode();
|
|
10369
10095
|
}, [onEnterEditMode, setEditing]);
|
|
10096
|
+
(0, import_react60.useImperativeHandle)(
|
|
10097
|
+
editLabelApiRef,
|
|
10098
|
+
() => ({
|
|
10099
|
+
beginEdit
|
|
10100
|
+
}),
|
|
10101
|
+
[beginEdit]
|
|
10102
|
+
);
|
|
10370
10103
|
const exitEditMode = ({
|
|
10371
10104
|
cancelEdit = false,
|
|
10372
10105
|
allowDeactivation = false
|
|
@@ -10387,9 +10120,6 @@ var EditableLabel = (0, import_react67.forwardRef)(function EditableLabel2({
|
|
|
10387
10120
|
setValue(value2);
|
|
10388
10121
|
onChange && onChange(value2);
|
|
10389
10122
|
};
|
|
10390
|
-
const handleDoubleClick = () => {
|
|
10391
|
-
enterEditMode();
|
|
10392
|
-
};
|
|
10393
10123
|
const handleBlur = () => {
|
|
10394
10124
|
if (editingRef.current) {
|
|
10395
10125
|
exitEditMode({ allowDeactivation: true });
|
|
@@ -10405,21 +10135,20 @@ var EditableLabel = (0, import_react67.forwardRef)(function EditableLabel2({
|
|
|
10405
10135
|
exitEditMode({ cancelEdit: true });
|
|
10406
10136
|
}
|
|
10407
10137
|
};
|
|
10408
|
-
const className = (0,
|
|
10409
|
-
[`${
|
|
10138
|
+
const className = (0, import_clsx24.default)(classBase16, classNameProp, {
|
|
10139
|
+
[`${classBase16}-editing`]: editing
|
|
10410
10140
|
});
|
|
10411
|
-
return /* @__PURE__ */ (0,
|
|
10141
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
10412
10142
|
"div",
|
|
10413
10143
|
{
|
|
10414
10144
|
...restProps,
|
|
10415
10145
|
className,
|
|
10416
|
-
onDoubleClick: handleDoubleClick,
|
|
10417
10146
|
"data-text": value,
|
|
10418
10147
|
ref: forwardedRef,
|
|
10419
|
-
children: editing ? /* @__PURE__ */ (0,
|
|
10420
|
-
|
|
10148
|
+
children: editing ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
10149
|
+
import_core26.Input,
|
|
10421
10150
|
{
|
|
10422
|
-
inputProps: { className: `${
|
|
10151
|
+
inputProps: { className: `${classBase16}-input`, spellCheck: false },
|
|
10423
10152
|
value,
|
|
10424
10153
|
onBlur: handleBlur,
|
|
10425
10154
|
onChange: handleChange,
|
|
@@ -10429,27 +10158,27 @@ var EditableLabel = (0, import_react67.forwardRef)(function EditableLabel2({
|
|
|
10429
10158
|
textAlign: "left",
|
|
10430
10159
|
variant: "secondary"
|
|
10431
10160
|
}
|
|
10432
|
-
) : /* @__PURE__ */ (0,
|
|
10161
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: `${classBase16}-label`, children: value })
|
|
10433
10162
|
}
|
|
10434
10163
|
);
|
|
10435
10164
|
});
|
|
10436
10165
|
|
|
10437
10166
|
// src/expando-input/ExpandoInput.tsx
|
|
10438
|
-
var
|
|
10439
|
-
var
|
|
10167
|
+
var import_clsx26 = __toESM(require("clsx"));
|
|
10168
|
+
var import_react62 = require("react");
|
|
10440
10169
|
|
|
10441
10170
|
// src/vuu-input/VuuInput.tsx
|
|
10442
10171
|
var import_vuu_popups4 = require("@vuu-ui/vuu-popups");
|
|
10443
|
-
var
|
|
10444
|
-
var
|
|
10445
|
-
var
|
|
10446
|
-
var
|
|
10447
|
-
var
|
|
10448
|
-
var
|
|
10172
|
+
var import_vuu_utils23 = require("@vuu-ui/vuu-utils");
|
|
10173
|
+
var import_core27 = require("@salt-ds/core");
|
|
10174
|
+
var import_clsx25 = __toESM(require("clsx"));
|
|
10175
|
+
var import_react61 = require("react");
|
|
10176
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
10177
|
+
var classBase17 = "vuuInput";
|
|
10449
10178
|
var constantInputProps = {
|
|
10450
10179
|
autoComplete: "off"
|
|
10451
10180
|
};
|
|
10452
|
-
var VuuInput = (0,
|
|
10181
|
+
var VuuInput = (0, import_react61.forwardRef)(function VuuInput2({
|
|
10453
10182
|
className,
|
|
10454
10183
|
errorMessage,
|
|
10455
10184
|
id: idProp,
|
|
@@ -10458,16 +10187,16 @@ var VuuInput = (0, import_react68.forwardRef)(function VuuInput2({
|
|
|
10458
10187
|
type,
|
|
10459
10188
|
...props
|
|
10460
10189
|
}, forwardedRef) {
|
|
10461
|
-
const id = (0,
|
|
10190
|
+
const id = (0, import_vuu_utils23.useId)(idProp);
|
|
10462
10191
|
const { anchorProps, tooltipProps } = (0, import_vuu_popups4.useTooltip)({
|
|
10463
10192
|
id,
|
|
10464
10193
|
tooltipContent: errorMessage
|
|
10465
10194
|
});
|
|
10466
|
-
const commitValue = (0,
|
|
10195
|
+
const commitValue = (0, import_react61.useCallback)(
|
|
10467
10196
|
(evt, value) => {
|
|
10468
10197
|
if (type === "number") {
|
|
10469
10198
|
const numericValue = parseFloat(value);
|
|
10470
|
-
if ((0,
|
|
10199
|
+
if ((0, import_vuu_utils23.isValidNumber)(numericValue)) {
|
|
10471
10200
|
onCommit(evt, numericValue);
|
|
10472
10201
|
} else {
|
|
10473
10202
|
throw Error("Invalid value");
|
|
@@ -10480,7 +10209,7 @@ var VuuInput = (0, import_react68.forwardRef)(function VuuInput2({
|
|
|
10480
10209
|
},
|
|
10481
10210
|
[onCommit, type]
|
|
10482
10211
|
);
|
|
10483
|
-
const handleKeyDown = (0,
|
|
10212
|
+
const handleKeyDown = (0, import_react61.useCallback)(
|
|
10484
10213
|
(evt) => {
|
|
10485
10214
|
if (evt.key === "Enter") {
|
|
10486
10215
|
evt.preventDefault();
|
|
@@ -10492,24 +10221,24 @@ var VuuInput = (0, import_react68.forwardRef)(function VuuInput2({
|
|
|
10492
10221
|
},
|
|
10493
10222
|
[commitValue, onKeyDown]
|
|
10494
10223
|
);
|
|
10495
|
-
const handleBlur = (0,
|
|
10224
|
+
const handleBlur = (0, import_react61.useCallback)(
|
|
10496
10225
|
(evt) => {
|
|
10497
10226
|
const { value } = evt.target;
|
|
10498
10227
|
commitValue(evt, value);
|
|
10499
10228
|
},
|
|
10500
10229
|
[commitValue]
|
|
10501
10230
|
);
|
|
10502
|
-
const endAdornment = errorMessage ? /* @__PURE__ */ (0,
|
|
10231
|
+
const endAdornment = errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
10503
10232
|
"span",
|
|
10504
10233
|
{
|
|
10505
10234
|
...anchorProps,
|
|
10506
|
-
className: `${
|
|
10235
|
+
className: `${classBase17}-errorIcon`,
|
|
10507
10236
|
"data-icon": "error"
|
|
10508
10237
|
}
|
|
10509
10238
|
) : void 0;
|
|
10510
|
-
return /* @__PURE__ */ (0,
|
|
10511
|
-
/* @__PURE__ */ (0,
|
|
10512
|
-
|
|
10239
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
10240
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
10241
|
+
import_core27.Input,
|
|
10513
10242
|
{
|
|
10514
10243
|
...props,
|
|
10515
10244
|
endAdornment,
|
|
@@ -10518,23 +10247,23 @@ var VuuInput = (0, import_react68.forwardRef)(function VuuInput2({
|
|
|
10518
10247
|
...constantInputProps,
|
|
10519
10248
|
...props.inputProps
|
|
10520
10249
|
},
|
|
10521
|
-
className: (0,
|
|
10522
|
-
[`${
|
|
10250
|
+
className: (0, import_clsx25.default)(classBase17, className, {
|
|
10251
|
+
[`${classBase17}-errror`]: errorMessage
|
|
10523
10252
|
}),
|
|
10524
10253
|
onBlur: handleBlur,
|
|
10525
10254
|
ref: forwardedRef,
|
|
10526
10255
|
onKeyDown: handleKeyDown
|
|
10527
10256
|
}
|
|
10528
10257
|
),
|
|
10529
|
-
tooltipProps ? /* @__PURE__ */ (0,
|
|
10258
|
+
tooltipProps ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_vuu_popups4.Tooltip, { ...tooltipProps, status: "error" }) : null
|
|
10530
10259
|
] });
|
|
10531
10260
|
});
|
|
10532
10261
|
|
|
10533
10262
|
// src/expando-input/ExpandoInput.tsx
|
|
10534
|
-
var
|
|
10535
|
-
var
|
|
10263
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
10264
|
+
var classBase18 = "vuuExpandoInput";
|
|
10536
10265
|
var noop = () => void 0;
|
|
10537
|
-
var ExpandoInput = (0,
|
|
10266
|
+
var ExpandoInput = (0, import_react62.forwardRef)(function ExpandoInput2({
|
|
10538
10267
|
className: classNameProp,
|
|
10539
10268
|
errorMessage,
|
|
10540
10269
|
value,
|
|
@@ -10542,19 +10271,19 @@ var ExpandoInput = (0, import_react69.forwardRef)(function ExpandoInput2({
|
|
|
10542
10271
|
onCommit = noop,
|
|
10543
10272
|
...props
|
|
10544
10273
|
}, forwardedRef) {
|
|
10545
|
-
return /* @__PURE__ */ (0,
|
|
10274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
10546
10275
|
"div",
|
|
10547
10276
|
{
|
|
10548
|
-
className: (0,
|
|
10549
|
-
[`${
|
|
10277
|
+
className: (0, import_clsx26.default)(classBase18, classNameProp, {
|
|
10278
|
+
[`${classBase18}-error`]: errorMessage
|
|
10550
10279
|
}),
|
|
10551
10280
|
"data-text": value,
|
|
10552
|
-
children: /* @__PURE__ */ (0,
|
|
10281
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
10553
10282
|
VuuInput,
|
|
10554
10283
|
{
|
|
10555
10284
|
...props,
|
|
10556
10285
|
errorMessage,
|
|
10557
|
-
inputProps: { ...inputProps, className: `${
|
|
10286
|
+
inputProps: { ...inputProps, className: `${classBase18}-input` },
|
|
10558
10287
|
onCommit,
|
|
10559
10288
|
ref: forwardedRef,
|
|
10560
10289
|
style: { padding: 0 },
|
|
@@ -10568,17 +10297,17 @@ var ExpandoInput = (0, import_react69.forwardRef)(function ExpandoInput2({
|
|
|
10568
10297
|
});
|
|
10569
10298
|
|
|
10570
10299
|
// src/inputs/Checkbox.tsx
|
|
10571
|
-
var
|
|
10300
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
10572
10301
|
var Checkbox = (props) => {
|
|
10573
10302
|
const { onToggle, checked, label } = props;
|
|
10574
|
-
return /* @__PURE__ */ (0,
|
|
10303
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
10575
10304
|
"div",
|
|
10576
10305
|
{
|
|
10577
10306
|
className: "vuuCheckbox",
|
|
10578
10307
|
onClick: onToggle,
|
|
10579
10308
|
onKeyUp: (e) => e.key === " " && onToggle(),
|
|
10580
10309
|
children: [
|
|
10581
|
-
/* @__PURE__ */ (0,
|
|
10310
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CheckboxIcon, { tabIndex: 0, checked }),
|
|
10582
10311
|
label
|
|
10583
10312
|
]
|
|
10584
10313
|
}
|
|
@@ -10586,13 +10315,13 @@ var Checkbox = (props) => {
|
|
|
10586
10315
|
};
|
|
10587
10316
|
|
|
10588
10317
|
// src/inputs/RadioButton.tsx
|
|
10589
|
-
var
|
|
10318
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
10590
10319
|
var RadioButton = (props) => {
|
|
10591
10320
|
const { onClick, checked, label, groupName } = props;
|
|
10592
|
-
return /* @__PURE__ */ (0,
|
|
10593
|
-
/* @__PURE__ */ (0,
|
|
10594
|
-
/* @__PURE__ */ (0,
|
|
10595
|
-
/* @__PURE__ */ (0,
|
|
10321
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "vuuRadioButton", onClick, children: [
|
|
10322
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "radio", children: [
|
|
10323
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("input", { type: "radio", name: groupName }),
|
|
10324
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(RadioIcon, { checked })
|
|
10596
10325
|
] }),
|
|
10597
10326
|
label
|
|
10598
10327
|
] });
|
|
@@ -10600,14 +10329,14 @@ var RadioButton = (props) => {
|
|
|
10600
10329
|
|
|
10601
10330
|
// src/instrument-picker/InstrumentPicker.tsx
|
|
10602
10331
|
var import_vuu_table2 = require("@vuu-ui/vuu-table");
|
|
10603
|
-
var
|
|
10604
|
-
var
|
|
10605
|
-
var
|
|
10332
|
+
var import_vuu_utils25 = require("@vuu-ui/vuu-utils");
|
|
10333
|
+
var import_core28 = require("@salt-ds/core");
|
|
10334
|
+
var import_react64 = require("react");
|
|
10606
10335
|
|
|
10607
10336
|
// src/instrument-picker/SearchCell.tsx
|
|
10608
|
-
var
|
|
10609
|
-
var
|
|
10610
|
-
var
|
|
10337
|
+
var import_vuu_utils24 = require("@vuu-ui/vuu-utils");
|
|
10338
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
10339
|
+
var classBase19 = "vuuSearchCell";
|
|
10611
10340
|
var SearchCell = ({
|
|
10612
10341
|
column,
|
|
10613
10342
|
columnMap,
|
|
@@ -10615,18 +10344,18 @@ var SearchCell = ({
|
|
|
10615
10344
|
}) => {
|
|
10616
10345
|
const key = columnMap[column.name];
|
|
10617
10346
|
const value = row[key];
|
|
10618
|
-
return /* @__PURE__ */ (0,
|
|
10619
|
-
/* @__PURE__ */ (0,
|
|
10347
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: classBase19, tabIndex: -1, children: [
|
|
10348
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { "data-icon": "draggable" }),
|
|
10620
10349
|
value
|
|
10621
10350
|
] });
|
|
10622
10351
|
};
|
|
10623
|
-
(0,
|
|
10352
|
+
(0, import_vuu_utils24.registerComponent)("search-cell", SearchCell, "cell-renderer", {
|
|
10624
10353
|
serverDataType: "private"
|
|
10625
10354
|
});
|
|
10626
10355
|
|
|
10627
10356
|
// src/instrument-picker/useInstrumentPicker.ts
|
|
10628
10357
|
var import_vuu_table = require("@vuu-ui/vuu-table");
|
|
10629
|
-
var
|
|
10358
|
+
var import_react63 = require("react");
|
|
10630
10359
|
var defaultItemToString = (row) => Object.values(row.data).join(" ");
|
|
10631
10360
|
var useInstrumentPicker = ({
|
|
10632
10361
|
dataSource,
|
|
@@ -10637,26 +10366,26 @@ var useInstrumentPicker = ({
|
|
|
10637
10366
|
onSelect,
|
|
10638
10367
|
searchColumns
|
|
10639
10368
|
}) => {
|
|
10640
|
-
const [value, setValue] = (0,
|
|
10369
|
+
const [value, setValue] = (0, import_react63.useState)("");
|
|
10641
10370
|
const [isOpen, setIsOpen] = useControlled({
|
|
10642
10371
|
controlled: isOpenProp,
|
|
10643
10372
|
default: defaultIsOpen != null ? defaultIsOpen : false,
|
|
10644
10373
|
name: "useDropdownList"
|
|
10645
10374
|
});
|
|
10646
10375
|
const { highlightedIndexRef, onKeyDown, tableRef } = (0, import_vuu_table.useControlledTableNavigation)(-1, dataSource.size);
|
|
10647
|
-
const baseFilterPattern = (0,
|
|
10376
|
+
const baseFilterPattern = (0, import_react63.useMemo)(
|
|
10648
10377
|
// TODO make this contains once server supports it
|
|
10649
10378
|
() => searchColumns.map((col) => `${col} starts "__VALUE__"`).join(" or "),
|
|
10650
10379
|
[searchColumns]
|
|
10651
10380
|
);
|
|
10652
|
-
const handleOpenChange = (0,
|
|
10381
|
+
const handleOpenChange = (0, import_react63.useCallback)(
|
|
10653
10382
|
(open, closeReason) => {
|
|
10654
10383
|
setIsOpen(open);
|
|
10655
10384
|
onOpenChange == null ? void 0 : onOpenChange(open, closeReason);
|
|
10656
10385
|
},
|
|
10657
10386
|
[onOpenChange, setIsOpen]
|
|
10658
10387
|
);
|
|
10659
|
-
const handleInputChange = (0,
|
|
10388
|
+
const handleInputChange = (0, import_react63.useCallback)(
|
|
10660
10389
|
(evt) => {
|
|
10661
10390
|
const { value: value2 } = evt.target;
|
|
10662
10391
|
setValue(value2);
|
|
@@ -10674,7 +10403,7 @@ var useInstrumentPicker = ({
|
|
|
10674
10403
|
},
|
|
10675
10404
|
[baseFilterPattern, dataSource, setIsOpen]
|
|
10676
10405
|
);
|
|
10677
|
-
const handleSelectRow = (0,
|
|
10406
|
+
const handleSelectRow = (0, import_react63.useCallback)(
|
|
10678
10407
|
(row) => {
|
|
10679
10408
|
const value2 = row === null ? "" : itemToString2(row);
|
|
10680
10409
|
setValue(value2);
|
|
@@ -10705,12 +10434,12 @@ var useInstrumentPicker = ({
|
|
|
10705
10434
|
};
|
|
10706
10435
|
|
|
10707
10436
|
// src/instrument-picker/InstrumentPicker.tsx
|
|
10708
|
-
var
|
|
10709
|
-
var
|
|
10437
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
10438
|
+
var classBase20 = "vuuInstrumentPicker";
|
|
10710
10439
|
if (typeof SearchCell !== "function") {
|
|
10711
10440
|
console.warn("Instrument Picker: SearchCell module not loaded ");
|
|
10712
10441
|
}
|
|
10713
|
-
var InstrumentPicker = (0,
|
|
10442
|
+
var InstrumentPicker = (0, import_react64.forwardRef)(function InstrumentPicker2({
|
|
10714
10443
|
TableProps: { dataSource, ...TableProps3 },
|
|
10715
10444
|
className,
|
|
10716
10445
|
columnMap,
|
|
@@ -10724,7 +10453,7 @@ var InstrumentPicker = (0, import_react71.forwardRef)(function InstrumentPicker2
|
|
|
10724
10453
|
width,
|
|
10725
10454
|
...htmlAttributes
|
|
10726
10455
|
}, forwardedRef) {
|
|
10727
|
-
const id = (0,
|
|
10456
|
+
const id = (0, import_vuu_utils25.useId)(idProp);
|
|
10728
10457
|
const {
|
|
10729
10458
|
highlightedIndex,
|
|
10730
10459
|
inputProps,
|
|
@@ -10742,7 +10471,7 @@ var InstrumentPicker = (0, import_react71.forwardRef)(function InstrumentPicker2
|
|
|
10742
10471
|
onSelect,
|
|
10743
10472
|
searchColumns
|
|
10744
10473
|
});
|
|
10745
|
-
const endAdornment = (0,
|
|
10474
|
+
const endAdornment = (0, import_react64.useMemo)(() => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { "data-icon": "chevron-down" }), []);
|
|
10746
10475
|
const tableProps = {
|
|
10747
10476
|
...TableProps3,
|
|
10748
10477
|
config: {
|
|
@@ -10750,7 +10479,7 @@ var InstrumentPicker = (0, import_react71.forwardRef)(function InstrumentPicker2
|
|
|
10750
10479
|
zebraStripes: false
|
|
10751
10480
|
}
|
|
10752
10481
|
};
|
|
10753
|
-
return /* @__PURE__ */ (0,
|
|
10482
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
10754
10483
|
DropdownBase,
|
|
10755
10484
|
{
|
|
10756
10485
|
...htmlAttributes,
|
|
@@ -10763,8 +10492,8 @@ var InstrumentPicker = (0, import_react71.forwardRef)(function InstrumentPicker2
|
|
|
10763
10492
|
ref: forwardedRef,
|
|
10764
10493
|
width,
|
|
10765
10494
|
children: [
|
|
10766
|
-
/* @__PURE__ */ (0,
|
|
10767
|
-
|
|
10495
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
10496
|
+
import_core28.Input,
|
|
10768
10497
|
{
|
|
10769
10498
|
...inputProps,
|
|
10770
10499
|
disabled,
|
|
@@ -10772,14 +10501,14 @@ var InstrumentPicker = (0, import_react71.forwardRef)(function InstrumentPicker2
|
|
|
10772
10501
|
value
|
|
10773
10502
|
}
|
|
10774
10503
|
),
|
|
10775
|
-
/* @__PURE__ */ (0,
|
|
10504
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
10776
10505
|
import_vuu_table2.Table,
|
|
10777
10506
|
{
|
|
10778
10507
|
rowHeight: 25,
|
|
10779
10508
|
renderBufferSize: 100,
|
|
10780
10509
|
...tableProps,
|
|
10781
10510
|
...tableHandlers,
|
|
10782
|
-
className: `${
|
|
10511
|
+
className: `${classBase20}-list`,
|
|
10783
10512
|
height: 200,
|
|
10784
10513
|
highlightedIndex,
|
|
10785
10514
|
dataSource,
|
|
@@ -10796,14 +10525,14 @@ var InstrumentPicker = (0, import_react71.forwardRef)(function InstrumentPicker2
|
|
|
10796
10525
|
// src/instrument-search/InstrumentSearch.tsx
|
|
10797
10526
|
var import_vuu_layout = require("@vuu-ui/vuu-layout");
|
|
10798
10527
|
var import_vuu_table3 = require("@vuu-ui/vuu-table");
|
|
10799
|
-
var
|
|
10800
|
-
var
|
|
10801
|
-
var
|
|
10528
|
+
var import_core29 = require("@salt-ds/core");
|
|
10529
|
+
var import_clsx27 = __toESM(require("clsx"));
|
|
10530
|
+
var import_react66 = require("react");
|
|
10802
10531
|
|
|
10803
10532
|
// src/instrument-search/SearchCell.tsx
|
|
10804
|
-
var
|
|
10805
|
-
var
|
|
10806
|
-
var
|
|
10533
|
+
var import_vuu_utils26 = require("@vuu-ui/vuu-utils");
|
|
10534
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
10535
|
+
var classBase21 = "vuuSearchCell";
|
|
10807
10536
|
var SearchCell2 = ({
|
|
10808
10537
|
column,
|
|
10809
10538
|
columnMap,
|
|
@@ -10811,28 +10540,28 @@ var SearchCell2 = ({
|
|
|
10811
10540
|
}) => {
|
|
10812
10541
|
const key = columnMap[column.name];
|
|
10813
10542
|
const value = row[key];
|
|
10814
|
-
return /* @__PURE__ */ (0,
|
|
10815
|
-
/* @__PURE__ */ (0,
|
|
10543
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: classBase21, tabIndex: -1, children: [
|
|
10544
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { "data-icon": "draggable" }),
|
|
10816
10545
|
value
|
|
10817
10546
|
] });
|
|
10818
10547
|
};
|
|
10819
|
-
(0,
|
|
10548
|
+
(0, import_vuu_utils26.registerComponent)("search-cell", SearchCell2, "cell-renderer", {
|
|
10820
10549
|
serverDataType: "private"
|
|
10821
10550
|
});
|
|
10822
10551
|
|
|
10823
10552
|
// src/instrument-search/useInstrumentSearch.ts
|
|
10824
|
-
var
|
|
10553
|
+
var import_react65 = require("react");
|
|
10825
10554
|
var useInstrumentSearch = ({
|
|
10826
10555
|
dataSource,
|
|
10827
10556
|
searchColumns = ["description"]
|
|
10828
10557
|
}) => {
|
|
10829
|
-
const [searchState, setSearchState] = (0,
|
|
10830
|
-
const baseFilterPattern = (0,
|
|
10558
|
+
const [searchState, setSearchState] = (0, import_react65.useState)({ searchText: "", filter: "" });
|
|
10559
|
+
const baseFilterPattern = (0, import_react65.useMemo)(
|
|
10831
10560
|
// TODO make this contains once server supports it
|
|
10832
10561
|
() => searchColumns.map((col) => `${col} starts "__VALUE__"`).join(" or "),
|
|
10833
10562
|
[searchColumns]
|
|
10834
10563
|
);
|
|
10835
|
-
const handleChange = (0,
|
|
10564
|
+
const handleChange = (0, import_react65.useCallback)(
|
|
10836
10565
|
(evt) => {
|
|
10837
10566
|
const { value } = evt.target;
|
|
10838
10567
|
const filter = baseFilterPattern.replaceAll("__VALUE__", value);
|
|
@@ -10856,8 +10585,8 @@ var useInstrumentSearch = ({
|
|
|
10856
10585
|
};
|
|
10857
10586
|
|
|
10858
10587
|
// src/instrument-search/InstrumentSearch.tsx
|
|
10859
|
-
var
|
|
10860
|
-
var
|
|
10588
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
10589
|
+
var classBase22 = "vuuInstrumentSearch";
|
|
10861
10590
|
if (typeof SearchCell2 !== "function") {
|
|
10862
10591
|
console.warn("Instrument Search: SearchCell module not loaded ");
|
|
10863
10592
|
}
|
|
@@ -10877,7 +10606,7 @@ var defaultTableConfig = {
|
|
|
10877
10606
|
],
|
|
10878
10607
|
rowSeparators: true
|
|
10879
10608
|
};
|
|
10880
|
-
var searchIcon = /* @__PURE__ */ (0,
|
|
10609
|
+
var searchIcon = /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { "data-icon": "search" });
|
|
10881
10610
|
var InstrumentSearch = ({
|
|
10882
10611
|
TableProps: TableProps3,
|
|
10883
10612
|
autoFocus = false,
|
|
@@ -10893,15 +10622,15 @@ var InstrumentSearch = ({
|
|
|
10893
10622
|
searchColumns
|
|
10894
10623
|
});
|
|
10895
10624
|
const { highlightedIndexRef, onHighlight, onKeyDown, tableRef } = (0, import_vuu_table3.useControlledTableNavigation)(-1, (_a2 = dataSource == null ? void 0 : dataSource.size) != null ? _a2 : 0);
|
|
10896
|
-
const searchCallbackRef = (0,
|
|
10625
|
+
const searchCallbackRef = (0, import_react66.useCallback)((el) => {
|
|
10897
10626
|
setTimeout(() => {
|
|
10898
10627
|
var _a3;
|
|
10899
10628
|
(_a3 = el == null ? void 0 : el.querySelector("input")) == null ? void 0 : _a3.focus();
|
|
10900
10629
|
}, 100);
|
|
10901
10630
|
}, []);
|
|
10902
|
-
return /* @__PURE__ */ (0,
|
|
10903
|
-
/* @__PURE__ */ (0,
|
|
10904
|
-
|
|
10631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { ...htmlAttributes, className: (0, import_clsx27.default)(classBase22, className), children: [
|
|
10632
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: `${classBase22}-inputField`, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
10633
|
+
import_core29.Input,
|
|
10905
10634
|
{
|
|
10906
10635
|
inputProps: { onKeyDown },
|
|
10907
10636
|
endAdornment: searchIcon,
|
|
@@ -10911,7 +10640,7 @@ var InstrumentSearch = ({
|
|
|
10911
10640
|
onChange
|
|
10912
10641
|
}
|
|
10913
10642
|
) }),
|
|
10914
|
-
dataSource ? /* @__PURE__ */ (0,
|
|
10643
|
+
dataSource ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
10915
10644
|
import_vuu_table3.Table,
|
|
10916
10645
|
{
|
|
10917
10646
|
disableFocus: true,
|
|
@@ -10921,7 +10650,7 @@ var InstrumentSearch = ({
|
|
|
10921
10650
|
highlightedIndex: highlightedIndexRef.current,
|
|
10922
10651
|
renderBufferSize: 100,
|
|
10923
10652
|
...TableProps3,
|
|
10924
|
-
className: `${
|
|
10653
|
+
className: `${classBase22}-list`,
|
|
10925
10654
|
dataSource,
|
|
10926
10655
|
navigationStyle: "row",
|
|
10927
10656
|
onHighlight,
|
|
@@ -10935,12 +10664,12 @@ var _a;
|
|
|
10935
10664
|
(_a = import_vuu_layout.registerComponent) == null ? void 0 : _a("InstrumentSearch", InstrumentSearch, "view");
|
|
10936
10665
|
|
|
10937
10666
|
// src/price-ticker/PriceTicker.tsx
|
|
10938
|
-
var
|
|
10939
|
-
var
|
|
10940
|
-
var
|
|
10941
|
-
var
|
|
10942
|
-
var
|
|
10943
|
-
var getValueFormatter = (decimals) => (0,
|
|
10667
|
+
var import_vuu_utils27 = require("@vuu-ui/vuu-utils");
|
|
10668
|
+
var import_react67 = require("react");
|
|
10669
|
+
var import_clsx28 = __toESM(require("clsx"));
|
|
10670
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
10671
|
+
var classBase23 = "vuuPriceTicker";
|
|
10672
|
+
var getValueFormatter = (decimals) => (0, import_vuu_utils27.numericFormatter)({
|
|
10944
10673
|
type: {
|
|
10945
10674
|
name: "number",
|
|
10946
10675
|
formatting: {
|
|
@@ -10950,7 +10679,7 @@ var getValueFormatter = (decimals) => (0, import_vuu_utils28.numericFormatter)({
|
|
|
10950
10679
|
}
|
|
10951
10680
|
});
|
|
10952
10681
|
var INITIAL_VALUE = [void 0, void 0];
|
|
10953
|
-
var PriceTicker = (0,
|
|
10682
|
+
var PriceTicker = (0, import_react67.memo)(
|
|
10954
10683
|
({
|
|
10955
10684
|
className,
|
|
10956
10685
|
decimals = 2,
|
|
@@ -10958,14 +10687,14 @@ var PriceTicker = (0, import_react74.memo)(
|
|
|
10958
10687
|
showArrow,
|
|
10959
10688
|
...htmlAttributes
|
|
10960
10689
|
}) => {
|
|
10961
|
-
const ref = (0,
|
|
10690
|
+
const ref = (0, import_react67.useRef)(INITIAL_VALUE);
|
|
10962
10691
|
const [prevValue, prevDirection] = ref.current;
|
|
10963
|
-
const formatNumber = (0,
|
|
10964
|
-
const direction = (0,
|
|
10692
|
+
const formatNumber = (0, import_react67.useMemo)(() => getValueFormatter(decimals), [decimals]);
|
|
10693
|
+
const direction = (0, import_vuu_utils27.isValidNumber)(prevValue) ? (0, import_vuu_utils27.getMovingValueDirection)(price, prevDirection, prevValue, decimals) : "";
|
|
10965
10694
|
ref.current = [price, direction];
|
|
10966
|
-
return /* @__PURE__ */ (0,
|
|
10695
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { ...htmlAttributes, className: (0, import_clsx28.default)(classBase23, className, direction), children: [
|
|
10967
10696
|
formatNumber(price),
|
|
10968
|
-
showArrow ? /* @__PURE__ */ (0,
|
|
10697
|
+
showArrow ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { "data-icon": "price-arrow" }) : null
|
|
10969
10698
|
] });
|
|
10970
10699
|
}
|
|
10971
10700
|
);
|
|
@@ -10973,12 +10702,12 @@ PriceTicker.displayName = "PriceTicker";
|
|
|
10973
10702
|
|
|
10974
10703
|
// src/split-button/SplitButton.tsx
|
|
10975
10704
|
var import_vuu_popups5 = require("@vuu-ui/vuu-popups");
|
|
10976
|
-
var
|
|
10977
|
-
var
|
|
10705
|
+
var import_core30 = require("@salt-ds/core");
|
|
10706
|
+
var import_react69 = require("react");
|
|
10978
10707
|
|
|
10979
10708
|
// src/split-button/useSplitButton.ts
|
|
10980
|
-
var
|
|
10981
|
-
var
|
|
10709
|
+
var import_vuu_utils28 = require("@vuu-ui/vuu-utils");
|
|
10710
|
+
var import_react68 = require("react");
|
|
10982
10711
|
var focusTargetIsEditableLabel = (target) => {
|
|
10983
10712
|
if (target.tagName === "INPUT") {
|
|
10984
10713
|
return true;
|
|
@@ -10988,12 +10717,12 @@ var focusTargetIsEditableLabel = (target) => {
|
|
|
10988
10717
|
var useSplitButton = ({
|
|
10989
10718
|
ButtonProps: ButtonPropsProp,
|
|
10990
10719
|
PopupMenuProps: PopupMenuProps3,
|
|
10991
|
-
classBase:
|
|
10720
|
+
classBase: classBase31,
|
|
10992
10721
|
onClick
|
|
10993
10722
|
}) => {
|
|
10994
|
-
const buttonRef = (0,
|
|
10995
|
-
const rootRef = (0,
|
|
10996
|
-
const onMenuClose = (0,
|
|
10723
|
+
const buttonRef = (0, import_react68.useRef)(null);
|
|
10724
|
+
const rootRef = (0, import_react68.useRef)(null);
|
|
10725
|
+
const onMenuClose = (0, import_react68.useCallback)((reason) => {
|
|
10997
10726
|
var _a2;
|
|
10998
10727
|
if ((reason == null ? void 0 : reason.type) !== "tab-away") {
|
|
10999
10728
|
const buttonMain = (_a2 = rootRef.current) == null ? void 0 : _a2.querySelector(
|
|
@@ -11005,11 +10734,11 @@ var useSplitButton = ({
|
|
|
11005
10734
|
const menuProps = {
|
|
11006
10735
|
...PopupMenuProps3,
|
|
11007
10736
|
anchorElement: rootRef,
|
|
11008
|
-
menuClassName: `${
|
|
10737
|
+
menuClassName: `${classBase31}-menu`,
|
|
11009
10738
|
onMenuClose,
|
|
11010
10739
|
popupPlacement: "below-full-width"
|
|
11011
10740
|
};
|
|
11012
|
-
const handleRootFocus = (0,
|
|
10741
|
+
const handleRootFocus = (0, import_react68.useCallback)((evt) => {
|
|
11013
10742
|
const { current: splitButton } = rootRef;
|
|
11014
10743
|
if (!(splitButton == null ? void 0 : splitButton.classList.contains("vuuFocusVisible"))) {
|
|
11015
10744
|
splitButton == null ? void 0 : splitButton.classList.add("vuuFocusVisible");
|
|
@@ -11021,7 +10750,7 @@ var useSplitButton = ({
|
|
|
11021
10750
|
}
|
|
11022
10751
|
}
|
|
11023
10752
|
}, []);
|
|
11024
|
-
const handleRootBlur = (0,
|
|
10753
|
+
const handleRootBlur = (0, import_react68.useCallback)((evt) => {
|
|
11025
10754
|
const { current: splitButton } = rootRef;
|
|
11026
10755
|
const target = evt.relatedTarget;
|
|
11027
10756
|
if (!(splitButton == null ? void 0 : splitButton.contains(target))) {
|
|
@@ -11030,19 +10759,19 @@ var useSplitButton = ({
|
|
|
11030
10759
|
}
|
|
11031
10760
|
}
|
|
11032
10761
|
}, []);
|
|
11033
|
-
const handleButtonKeyDown = (0,
|
|
10762
|
+
const handleButtonKeyDown = (0, import_react68.useCallback)(
|
|
11034
10763
|
(evt) => {
|
|
11035
10764
|
var _a2;
|
|
11036
10765
|
if (evt.key === "ArrowDown") {
|
|
11037
10766
|
const popupTrigger = (_a2 = rootRef.current) == null ? void 0 : _a2.querySelector(
|
|
11038
|
-
`.${
|
|
10767
|
+
`.${classBase31}-trigger`
|
|
11039
10768
|
);
|
|
11040
10769
|
if (popupTrigger) {
|
|
11041
|
-
(0,
|
|
10770
|
+
(0, import_vuu_utils28.dispatchMouseEvent)(popupTrigger, "click");
|
|
11042
10771
|
}
|
|
11043
10772
|
}
|
|
11044
10773
|
},
|
|
11045
|
-
[
|
|
10774
|
+
[classBase31]
|
|
11046
10775
|
);
|
|
11047
10776
|
const ButtonProps6 = {
|
|
11048
10777
|
...ButtonPropsProp,
|
|
@@ -11060,10 +10789,10 @@ var useSplitButton = ({
|
|
|
11060
10789
|
};
|
|
11061
10790
|
|
|
11062
10791
|
// src/split-button/SplitButton.tsx
|
|
11063
|
-
var
|
|
11064
|
-
var
|
|
11065
|
-
var
|
|
11066
|
-
var SplitButton = (0,
|
|
10792
|
+
var import_clsx29 = __toESM(require("clsx"));
|
|
10793
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
10794
|
+
var classBase24 = "vuuSplitButton";
|
|
10795
|
+
var SplitButton = (0, import_react69.forwardRef)(
|
|
11067
10796
|
function SplitButton2({
|
|
11068
10797
|
ButtonProps: ButtonPropsProp,
|
|
11069
10798
|
PopupMenuProps: PopupMenuPropsProp,
|
|
@@ -11079,39 +10808,39 @@ var SplitButton = (0, import_react76.forwardRef)(
|
|
|
11079
10808
|
const { ButtonProps: ButtonProps6, buttonRef, rootRef, PopupMenuProps: PopupMenuProps3, ...rootProps } = useSplitButton({
|
|
11080
10809
|
ButtonProps: ButtonPropsProp,
|
|
11081
10810
|
PopupMenuProps: PopupMenuPropsProp,
|
|
11082
|
-
classBase:
|
|
10811
|
+
classBase: classBase24,
|
|
11083
10812
|
onClick,
|
|
11084
10813
|
segmented
|
|
11085
10814
|
});
|
|
11086
|
-
return /* @__PURE__ */ (0,
|
|
10815
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
11087
10816
|
"div",
|
|
11088
10817
|
{
|
|
11089
10818
|
...htmlAttributes,
|
|
11090
10819
|
...rootProps,
|
|
11091
|
-
className: (0,
|
|
11092
|
-
[`${
|
|
11093
|
-
[`${
|
|
10820
|
+
className: (0, import_clsx29.default)(classBase24, `${classBase24}-${variant}`, className, {
|
|
10821
|
+
[`${classBase24}-disabled`]: disabled,
|
|
10822
|
+
[`${classBase24}-segmented`]: segmented
|
|
11094
10823
|
}),
|
|
11095
|
-
ref: (0,
|
|
10824
|
+
ref: (0, import_core30.useForkRef)(forwardedRef, rootRef),
|
|
11096
10825
|
"data-showcase-center": true,
|
|
11097
10826
|
tabIndex: -1,
|
|
11098
10827
|
children: [
|
|
11099
|
-
/* @__PURE__ */ (0,
|
|
11100
|
-
|
|
10828
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
10829
|
+
import_core30.Button,
|
|
11101
10830
|
{
|
|
11102
10831
|
...ButtonProps6,
|
|
11103
|
-
className: `${
|
|
10832
|
+
className: `${classBase24}-main`,
|
|
11104
10833
|
disabled,
|
|
11105
10834
|
ref: buttonRef,
|
|
11106
10835
|
variant,
|
|
11107
10836
|
children
|
|
11108
10837
|
}
|
|
11109
10838
|
),
|
|
11110
|
-
/* @__PURE__ */ (0,
|
|
10839
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
11111
10840
|
import_vuu_popups5.PopupMenu,
|
|
11112
10841
|
{
|
|
11113
10842
|
...PopupMenuProps3,
|
|
11114
|
-
className: `${
|
|
10843
|
+
className: `${classBase24}-trigger`,
|
|
11115
10844
|
disabled,
|
|
11116
10845
|
icon: (_a2 = PopupMenuProps3 == null ? void 0 : PopupMenuProps3.icon) != null ? _a2 : "chevron-down",
|
|
11117
10846
|
tabIndex: segmented ? 0 : -1,
|
|
@@ -11125,30 +10854,30 @@ var SplitButton = (0, import_react76.forwardRef)(
|
|
|
11125
10854
|
);
|
|
11126
10855
|
|
|
11127
10856
|
// src/split-button/SplitStateButton.tsx
|
|
11128
|
-
var
|
|
11129
|
-
var
|
|
11130
|
-
var
|
|
11131
|
-
var
|
|
11132
|
-
var SplitStateButton = (0,
|
|
11133
|
-
return /* @__PURE__ */ (0,
|
|
10857
|
+
var import_clsx30 = __toESM(require("clsx"));
|
|
10858
|
+
var import_react70 = require("react");
|
|
10859
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
10860
|
+
var classBase25 = "vuuSplitStateButton";
|
|
10861
|
+
var SplitStateButton = (0, import_react70.forwardRef)(function SplitStateButton2({ className, selected, ...splitButtonProps }, forwardedRef) {
|
|
10862
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
11134
10863
|
SplitButton,
|
|
11135
10864
|
{
|
|
11136
10865
|
...splitButtonProps,
|
|
11137
10866
|
"aria-checked": selected,
|
|
11138
|
-
className: (0,
|
|
10867
|
+
className: (0, import_clsx30.default)(classBase25, className),
|
|
11139
10868
|
ref: forwardedRef
|
|
11140
10869
|
}
|
|
11141
10870
|
);
|
|
11142
10871
|
});
|
|
11143
10872
|
|
|
11144
10873
|
// src/tabstrip/Tabstrip.tsx
|
|
11145
|
-
var
|
|
11146
|
-
var
|
|
11147
|
-
var
|
|
10874
|
+
var import_vuu_utils34 = require("@vuu-ui/vuu-utils");
|
|
10875
|
+
var import_clsx31 = __toESM(require("clsx"));
|
|
10876
|
+
var import_react75 = __toESM(require("react"));
|
|
11148
10877
|
|
|
11149
10878
|
// src/tabstrip/useTabstrip.ts
|
|
11150
|
-
var
|
|
11151
|
-
var
|
|
10879
|
+
var import_vuu_utils33 = require("@vuu-ui/vuu-utils");
|
|
10880
|
+
var import_react74 = require("react");
|
|
11152
10881
|
|
|
11153
10882
|
// src/tabstrip/TabMenuOptions.ts
|
|
11154
10883
|
var isTabMenuOptions = (options) => typeof options === "object" && options !== null && "tabIndex" in options && typeof options.tabIndex === "number";
|
|
@@ -11166,13 +10895,13 @@ var renameCommand = (options) => ({
|
|
|
11166
10895
|
});
|
|
11167
10896
|
|
|
11168
10897
|
// src/tabstrip/tabstrip-dom-utils.ts
|
|
11169
|
-
var
|
|
10898
|
+
var import_vuu_utils29 = require("@vuu-ui/vuu-utils");
|
|
11170
10899
|
var getIndexOfItem = (container, query) => {
|
|
11171
10900
|
if (container) {
|
|
11172
10901
|
const targetTab = container.querySelector(
|
|
11173
10902
|
`[data-index]:has(${query})`
|
|
11174
10903
|
);
|
|
11175
|
-
return (0,
|
|
10904
|
+
return (0, import_vuu_utils29.getElementDataIndex)(targetTab);
|
|
11176
10905
|
}
|
|
11177
10906
|
return -1;
|
|
11178
10907
|
};
|
|
@@ -11180,23 +10909,23 @@ var getIndexOfSelectedTab = (container) => getIndexOfItem(container, '[aria-sele
|
|
|
11180
10909
|
var getIndexOfEditedItem = (container) => getIndexOfItem(container, ".vuuEditableLabel-editing");
|
|
11181
10910
|
|
|
11182
10911
|
// src/tabstrip/useAnimatedSelectionThumb.ts
|
|
11183
|
-
var
|
|
11184
|
-
var
|
|
10912
|
+
var import_vuu_utils30 = require("@vuu-ui/vuu-utils");
|
|
10913
|
+
var import_react71 = require("react");
|
|
11185
10914
|
var useAnimatedSelectionThumb = (containerRef, activeTabIndex, orientation = "horizontal") => {
|
|
11186
|
-
const animationSuspendedRef = (0,
|
|
11187
|
-
const suspendAnimation = (0,
|
|
10915
|
+
const animationSuspendedRef = (0, import_react71.useRef)(false);
|
|
10916
|
+
const suspendAnimation = (0, import_react71.useCallback)(() => {
|
|
11188
10917
|
animationSuspendedRef.current = true;
|
|
11189
10918
|
}, []);
|
|
11190
|
-
const resumeAnimation = (0,
|
|
10919
|
+
const resumeAnimation = (0, import_react71.useCallback)(() => {
|
|
11191
10920
|
animationSuspendedRef.current = false;
|
|
11192
10921
|
}, []);
|
|
11193
|
-
const onTransitionEnd = (0,
|
|
10922
|
+
const onTransitionEnd = (0, import_react71.useCallback)(() => {
|
|
11194
10923
|
var _a2, _b;
|
|
11195
10924
|
(_a2 = containerRef.current) == null ? void 0 : _a2.style.setProperty("--tab-thumb-transition", "none");
|
|
11196
10925
|
(_b = containerRef.current) == null ? void 0 : _b.removeEventListener("transitionend", onTransitionEnd);
|
|
11197
10926
|
}, [containerRef]);
|
|
11198
|
-
const lastSelectedRef = (0,
|
|
11199
|
-
return (0,
|
|
10927
|
+
const lastSelectedRef = (0, import_react71.useRef)(-1);
|
|
10928
|
+
return (0, import_react71.useMemo)(() => {
|
|
11200
10929
|
var _a2, _b;
|
|
11201
10930
|
let offset = 0;
|
|
11202
10931
|
let size = 0;
|
|
@@ -11205,11 +10934,11 @@ var useAnimatedSelectionThumb = (containerRef, activeTabIndex, orientation = "ho
|
|
|
11205
10934
|
const newSelected = (_b = containerRef.current) == null ? void 0 : _b.querySelector(
|
|
11206
10935
|
`[data-index="${activeTabIndex}"] .vuuTab`
|
|
11207
10936
|
);
|
|
11208
|
-
const { positionProp, sizeProp } =
|
|
10937
|
+
const { positionProp, sizeProp } = import_vuu_utils30.MEASURES[orientation];
|
|
11209
10938
|
if (oldSelected && newSelected && !animationSuspendedRef.current) {
|
|
11210
10939
|
const { [positionProp]: oldPosition, [sizeProp]: oldSize } = oldSelected.getBoundingClientRect();
|
|
11211
10940
|
const { [positionProp]: newPosition } = newSelected.getBoundingClientRect();
|
|
11212
|
-
if ((0,
|
|
10941
|
+
if ((0, import_vuu_utils30.isValidNumber)(oldPosition) && (0, import_vuu_utils30.isValidNumber)(newPosition) && (0, import_vuu_utils30.isValidNumber)(oldSize)) {
|
|
11213
10942
|
offset = oldPosition - newPosition;
|
|
11214
10943
|
size = oldSize;
|
|
11215
10944
|
const speed = orientation === "horizontal" ? 1100 : 700;
|
|
@@ -11264,26 +10993,26 @@ var useAnimatedSelectionThumb = (containerRef, activeTabIndex, orientation = "ho
|
|
|
11264
10993
|
};
|
|
11265
10994
|
|
|
11266
10995
|
// src/tabstrip/useKeyboardNavigation.ts
|
|
11267
|
-
var
|
|
10996
|
+
var import_core31 = require("@salt-ds/core");
|
|
10997
|
+
var import_vuu_utils31 = require("@vuu-ui/vuu-utils");
|
|
10998
|
+
var import_react72 = require("react");
|
|
11268
10999
|
var import_vuu_utils32 = require("@vuu-ui/vuu-utils");
|
|
11269
|
-
var import_react79 = require("react");
|
|
11270
|
-
var import_vuu_utils33 = require("@vuu-ui/vuu-utils");
|
|
11271
11000
|
var navigation = {
|
|
11272
11001
|
horizontal: {
|
|
11273
|
-
[
|
|
11274
|
-
[
|
|
11275
|
-
[
|
|
11276
|
-
[
|
|
11002
|
+
[import_vuu_utils32.Home]: "start",
|
|
11003
|
+
[import_vuu_utils32.End]: "end",
|
|
11004
|
+
[import_vuu_utils32.ArrowLeft]: "bwd",
|
|
11005
|
+
[import_vuu_utils32.ArrowRight]: "fwd"
|
|
11277
11006
|
},
|
|
11278
11007
|
vertical: {
|
|
11279
|
-
[
|
|
11280
|
-
[
|
|
11281
|
-
[
|
|
11282
|
-
[
|
|
11008
|
+
[import_vuu_utils32.Home]: "start",
|
|
11009
|
+
[import_vuu_utils32.End]: "end",
|
|
11010
|
+
[import_vuu_utils32.ArrowUp]: "bwd",
|
|
11011
|
+
[import_vuu_utils32.ArrowDown]: "fwd"
|
|
11283
11012
|
}
|
|
11284
11013
|
};
|
|
11285
11014
|
var isNavigationKey2 = (key, orientation = "horizontal") => navigation[orientation][key] !== void 0;
|
|
11286
|
-
var isMenuActivationKey = (key) => key ===
|
|
11015
|
+
var isMenuActivationKey = (key) => key === import_vuu_utils32.ArrowDown;
|
|
11287
11016
|
function nextItemIdx2(count, direction, idx) {
|
|
11288
11017
|
if (direction === "start") {
|
|
11289
11018
|
return 0;
|
|
@@ -11316,23 +11045,23 @@ var useKeyboardNavigation2 = ({
|
|
|
11316
11045
|
selectedIndex: selectedTabIndex = 0
|
|
11317
11046
|
}) => {
|
|
11318
11047
|
const manualActivation = keyBoardActivation === "manual";
|
|
11319
|
-
const mouseClickPending = (0,
|
|
11320
|
-
const focusedRef = (0,
|
|
11321
|
-
const [hasFocus, setHasFocus] = (0,
|
|
11322
|
-
const [, forceRefresh] = (0,
|
|
11323
|
-
const [highlightedIdx, _setHighlightedIdx] = (0,
|
|
11048
|
+
const mouseClickPending = (0, import_react72.useRef)(false);
|
|
11049
|
+
const focusedRef = (0, import_react72.useRef)(-1);
|
|
11050
|
+
const [hasFocus, setHasFocus] = (0, import_react72.useState)(false);
|
|
11051
|
+
const [, forceRefresh] = (0, import_react72.useState)({});
|
|
11052
|
+
const [highlightedIdx, _setHighlightedIdx] = (0, import_core31.useControlled)({
|
|
11324
11053
|
controlled: highlightedIdxProp,
|
|
11325
11054
|
default: defaultHighlightedIdx,
|
|
11326
11055
|
name: "UseKeyboardNavigation"
|
|
11327
11056
|
});
|
|
11328
|
-
const setHighlightedIdx = (0,
|
|
11057
|
+
const setHighlightedIdx = (0, import_react72.useCallback)(
|
|
11329
11058
|
(value) => {
|
|
11330
11059
|
_setHighlightedIdx(focusedRef.current = value);
|
|
11331
11060
|
},
|
|
11332
11061
|
[_setHighlightedIdx]
|
|
11333
11062
|
);
|
|
11334
|
-
const keyboardNavigation = (0,
|
|
11335
|
-
const focusTab = (0,
|
|
11063
|
+
const keyboardNavigation = (0, import_react72.useRef)(false);
|
|
11064
|
+
const focusTab = (0, import_react72.useCallback)(
|
|
11336
11065
|
(tabIndex, immediateFocus = false, withKeyboard, delay = 70) => {
|
|
11337
11066
|
setHighlightedIdx(tabIndex);
|
|
11338
11067
|
if (withKeyboard === true && !keyboardNavigation.current) {
|
|
@@ -11341,7 +11070,7 @@ var useKeyboardNavigation2 = ({
|
|
|
11341
11070
|
const setFocus = () => {
|
|
11342
11071
|
const element = getElementByPosition(containerRef.current, tabIndex);
|
|
11343
11072
|
if (element) {
|
|
11344
|
-
const focussableElement = (0,
|
|
11073
|
+
const focussableElement = (0, import_vuu_utils31.getFocusableElement)(element);
|
|
11345
11074
|
focussableElement == null ? void 0 : focussableElement.focus();
|
|
11346
11075
|
}
|
|
11347
11076
|
};
|
|
@@ -11372,14 +11101,14 @@ var useKeyboardNavigation2 = ({
|
|
|
11372
11101
|
}
|
|
11373
11102
|
}
|
|
11374
11103
|
};
|
|
11375
|
-
const getIndexCount = (0,
|
|
11104
|
+
const getIndexCount = (0, import_react72.useCallback)(
|
|
11376
11105
|
() => {
|
|
11377
11106
|
var _a2, _b;
|
|
11378
11107
|
return (_b = (_a2 = containerRef.current) == null ? void 0 : _a2.querySelectorAll(`[data-index]`).length) != null ? _b : 0;
|
|
11379
11108
|
},
|
|
11380
11109
|
[containerRef]
|
|
11381
11110
|
);
|
|
11382
|
-
const nextFocusableItemIdx = (0,
|
|
11111
|
+
const nextFocusableItemIdx = (0, import_react72.useCallback)(
|
|
11383
11112
|
(direction = "fwd", idx) => {
|
|
11384
11113
|
const indexCount = getIndexCount();
|
|
11385
11114
|
const index = typeof idx === "number" ? idx : indexCount;
|
|
@@ -11399,7 +11128,7 @@ var useKeyboardNavigation2 = ({
|
|
|
11399
11128
|
},
|
|
11400
11129
|
[containerRef, getIndexCount]
|
|
11401
11130
|
);
|
|
11402
|
-
const navigateChildItems = (0,
|
|
11131
|
+
const navigateChildItems = (0, import_react72.useCallback)(
|
|
11403
11132
|
(e, forceFocusVisible = false) => {
|
|
11404
11133
|
const direction = navigation[orientation][e.key];
|
|
11405
11134
|
const nextIdx = nextFocusableItemIdx(direction, highlightedIdx);
|
|
@@ -11421,22 +11150,22 @@ var useKeyboardNavigation2 = ({
|
|
|
11421
11150
|
orientation
|
|
11422
11151
|
]
|
|
11423
11152
|
);
|
|
11424
|
-
const highlightedTabHasMenu = (0,
|
|
11153
|
+
const highlightedTabHasMenu = (0, import_react72.useCallback)(() => {
|
|
11425
11154
|
const el = getElementByPosition(containerRef.current, highlightedIdx);
|
|
11426
11155
|
if (el) {
|
|
11427
11156
|
return el.querySelector(".vuuPopupMenu") != null;
|
|
11428
11157
|
}
|
|
11429
11158
|
return false;
|
|
11430
11159
|
}, [containerRef, highlightedIdx]);
|
|
11431
|
-
const activateTabMenu = (0,
|
|
11160
|
+
const activateTabMenu = (0, import_react72.useCallback)(() => {
|
|
11432
11161
|
const el = getElementByPosition(containerRef.current, highlightedIdx);
|
|
11433
11162
|
const menuEl = el == null ? void 0 : el.querySelector(".vuuPopupMenu");
|
|
11434
11163
|
if (menuEl) {
|
|
11435
|
-
(0,
|
|
11164
|
+
(0, import_vuu_utils31.dispatchMouseEvent)(menuEl, "click");
|
|
11436
11165
|
}
|
|
11437
11166
|
return false;
|
|
11438
11167
|
}, [containerRef, highlightedIdx]);
|
|
11439
|
-
const handleKeyDown = (0,
|
|
11168
|
+
const handleKeyDown = (0, import_react72.useCallback)(
|
|
11440
11169
|
(e) => {
|
|
11441
11170
|
if (getIndexCount() > 0 && isNavigationKey2(e.key, orientation)) {
|
|
11442
11171
|
e.preventDefault();
|
|
@@ -11461,7 +11190,7 @@ var useKeyboardNavigation2 = ({
|
|
|
11461
11190
|
const handleItemClick = (_, tabIndex) => {
|
|
11462
11191
|
setHighlightedIdx(tabIndex);
|
|
11463
11192
|
};
|
|
11464
|
-
const handleFocus = (0,
|
|
11193
|
+
const handleFocus = (0, import_react72.useCallback)(() => {
|
|
11465
11194
|
if (!hasFocus) {
|
|
11466
11195
|
setHasFocus(true);
|
|
11467
11196
|
if (!mouseClickPending.current) {
|
|
@@ -11471,7 +11200,7 @@ var useKeyboardNavigation2 = ({
|
|
|
11471
11200
|
}
|
|
11472
11201
|
}
|
|
11473
11202
|
}, [hasFocus]);
|
|
11474
|
-
const handleContainerMouseDown = (0,
|
|
11203
|
+
const handleContainerMouseDown = (0, import_react72.useCallback)(() => {
|
|
11475
11204
|
if (!hasFocus) {
|
|
11476
11205
|
mouseClickPending.current = true;
|
|
11477
11206
|
}
|
|
@@ -11508,8 +11237,8 @@ var useKeyboardNavigation2 = ({
|
|
|
11508
11237
|
};
|
|
11509
11238
|
|
|
11510
11239
|
// src/tabstrip/useSelection.ts
|
|
11511
|
-
var
|
|
11512
|
-
var
|
|
11240
|
+
var import_core32 = require("@salt-ds/core");
|
|
11241
|
+
var import_react73 = require("react");
|
|
11513
11242
|
var defaultSelectionKeys2 = ["Enter", " "];
|
|
11514
11243
|
var isTabElement = (el) => el && el.matches('[class*="vuuTab "]');
|
|
11515
11244
|
var useSelection2 = ({
|
|
@@ -11518,24 +11247,24 @@ var useSelection2 = ({
|
|
|
11518
11247
|
onSelectionChange,
|
|
11519
11248
|
selected: selectedProp
|
|
11520
11249
|
}) => {
|
|
11521
|
-
const [selected, setSelected, isControlled] = (0,
|
|
11250
|
+
const [selected, setSelected, isControlled] = (0, import_core32.useControlled)({
|
|
11522
11251
|
controlled: selectedProp,
|
|
11523
11252
|
default: defaultSelected != null ? defaultSelected : 0,
|
|
11524
11253
|
name: "Tabstrip",
|
|
11525
11254
|
state: "value"
|
|
11526
11255
|
});
|
|
11527
|
-
const isSelectionEvent = (0,
|
|
11256
|
+
const isSelectionEvent = (0, import_react73.useCallback)(
|
|
11528
11257
|
(evt) => defaultSelectionKeys2.includes(evt.key),
|
|
11529
11258
|
[]
|
|
11530
11259
|
);
|
|
11531
|
-
const selectItem = (0,
|
|
11260
|
+
const selectItem = (0, import_react73.useCallback)(
|
|
11532
11261
|
(tabIndex) => {
|
|
11533
11262
|
setSelected(tabIndex);
|
|
11534
11263
|
onSelectionChange == null ? void 0 : onSelectionChange(tabIndex);
|
|
11535
11264
|
},
|
|
11536
11265
|
[onSelectionChange, setSelected]
|
|
11537
11266
|
);
|
|
11538
|
-
const handleKeyDown = (0,
|
|
11267
|
+
const handleKeyDown = (0, import_react73.useCallback)(
|
|
11539
11268
|
(e) => {
|
|
11540
11269
|
const targetElement = e.target;
|
|
11541
11270
|
if (isSelectionEvent(e) && highlightedIdx !== selected && isTabElement(targetElement)) {
|
|
@@ -11546,7 +11275,7 @@ var useSelection2 = ({
|
|
|
11546
11275
|
},
|
|
11547
11276
|
[isSelectionEvent, highlightedIdx, selected, selectItem]
|
|
11548
11277
|
);
|
|
11549
|
-
const onClick = (0,
|
|
11278
|
+
const onClick = (0, import_react73.useCallback)(
|
|
11550
11279
|
(e, tabIndex) => {
|
|
11551
11280
|
if (tabIndex !== selected) {
|
|
11552
11281
|
selectItem(tabIndex);
|
|
@@ -11586,7 +11315,7 @@ var useTabstrip = ({
|
|
|
11586
11315
|
orientation,
|
|
11587
11316
|
keyBoardActivation
|
|
11588
11317
|
}) => {
|
|
11589
|
-
const lastSelection = (0,
|
|
11318
|
+
const lastSelection = (0, import_react74.useRef)(activeTabIndexProp);
|
|
11590
11319
|
const {
|
|
11591
11320
|
focusTab: keyboardHookFocusTab,
|
|
11592
11321
|
highlightedIdx,
|
|
@@ -11616,7 +11345,7 @@ var useTabstrip = ({
|
|
|
11616
11345
|
animateSelectionThumb ? selectionHookSelected : -1,
|
|
11617
11346
|
orientation
|
|
11618
11347
|
);
|
|
11619
|
-
const handleDrop = (0,
|
|
11348
|
+
const handleDrop = (0, import_react74.useCallback)(
|
|
11620
11349
|
({ fromIndex, toIndex }) => {
|
|
11621
11350
|
const { current: selected } = lastSelection;
|
|
11622
11351
|
console.log(
|
|
@@ -11658,7 +11387,7 @@ var useTabstrip = ({
|
|
|
11658
11387
|
orientation: "horizontal",
|
|
11659
11388
|
itemQuery: ".vuuOverflowContainer-item"
|
|
11660
11389
|
});
|
|
11661
|
-
const handleExitEditMode = (0,
|
|
11390
|
+
const handleExitEditMode = (0, import_react74.useCallback)(
|
|
11662
11391
|
(originalValue, editedValue, allowDeactivation, tabIndex) => {
|
|
11663
11392
|
console.log(
|
|
11664
11393
|
`handleExitEditMode ${originalValue} ${editedValue} ${allowDeactivation} ${tabIndex}`
|
|
@@ -11670,7 +11399,7 @@ var useTabstrip = ({
|
|
|
11670
11399
|
},
|
|
11671
11400
|
[keyboardHookFocusTab, onExitEditMode]
|
|
11672
11401
|
);
|
|
11673
|
-
const handleClick = (0,
|
|
11402
|
+
const handleClick = (0, import_react74.useCallback)(
|
|
11674
11403
|
(evt, tabIndex) => {
|
|
11675
11404
|
keyboardHookHandleClick(evt, tabIndex);
|
|
11676
11405
|
selectionHookHandleClick(evt, tabIndex);
|
|
@@ -11678,7 +11407,7 @@ var useTabstrip = ({
|
|
|
11678
11407
|
// [dragDropHook.isDragging, keyboardHook, selectionHook]
|
|
11679
11408
|
[keyboardHookHandleClick, selectionHookHandleClick]
|
|
11680
11409
|
);
|
|
11681
|
-
const getEditableLabel = (0,
|
|
11410
|
+
const getEditableLabel = (0, import_react74.useCallback)(
|
|
11682
11411
|
(tabIndex = highlightedIdx) => {
|
|
11683
11412
|
const targetEl = getElementWithIndex(containerRef.current, tabIndex);
|
|
11684
11413
|
if (targetEl) {
|
|
@@ -11687,7 +11416,7 @@ var useTabstrip = ({
|
|
|
11687
11416
|
},
|
|
11688
11417
|
[containerRef, highlightedIdx]
|
|
11689
11418
|
);
|
|
11690
|
-
const tabInEditMode = (0,
|
|
11419
|
+
const tabInEditMode = (0, import_react74.useCallback)(
|
|
11691
11420
|
(tabIndex = highlightedIdx) => {
|
|
11692
11421
|
const editableLabel = getEditableLabel(tabIndex);
|
|
11693
11422
|
if (editableLabel) {
|
|
@@ -11697,16 +11426,16 @@ var useTabstrip = ({
|
|
|
11697
11426
|
},
|
|
11698
11427
|
[getEditableLabel, highlightedIdx]
|
|
11699
11428
|
);
|
|
11700
|
-
const editTab = (0,
|
|
11429
|
+
const editTab = (0, import_react74.useCallback)(
|
|
11701
11430
|
(tabIndex = highlightedIdx) => {
|
|
11702
11431
|
const editableLabelEl = getEditableLabel(tabIndex);
|
|
11703
11432
|
if (editableLabelEl) {
|
|
11704
|
-
(0,
|
|
11433
|
+
(0, import_vuu_utils33.dispatchMouseEvent)(editableLabelEl, "dblclick");
|
|
11705
11434
|
}
|
|
11706
11435
|
},
|
|
11707
11436
|
[getEditableLabel, highlightedIdx]
|
|
11708
11437
|
);
|
|
11709
|
-
const handleKeyDown = (0,
|
|
11438
|
+
const handleKeyDown = (0, import_react74.useCallback)(
|
|
11710
11439
|
(evt) => {
|
|
11711
11440
|
keyboardHookHandleKeyDown(evt);
|
|
11712
11441
|
if (!evt.defaultPrevented) {
|
|
@@ -11718,7 +11447,7 @@ var useTabstrip = ({
|
|
|
11718
11447
|
},
|
|
11719
11448
|
[editTab, keyboardHookHandleKeyDown, selectionHookHandleKeyDown]
|
|
11720
11449
|
);
|
|
11721
|
-
const handleCloseTabFromMenu = (0,
|
|
11450
|
+
const handleCloseTabFromMenu = (0, import_react74.useCallback)(
|
|
11722
11451
|
(tabIndex) => {
|
|
11723
11452
|
const selectedTabIndex = getIndexOfSelectedTab(containerRef.current);
|
|
11724
11453
|
const newActiveTabIndex = selectedTabIndex > tabIndex ? selectedTabIndex - 1 : selectedTabIndex === tabIndex ? 0 : selectedTabIndex;
|
|
@@ -11731,14 +11460,14 @@ var useTabstrip = ({
|
|
|
11731
11460
|
},
|
|
11732
11461
|
[containerRef, onCloseTab, resumeAnimation, suspendAnimation]
|
|
11733
11462
|
);
|
|
11734
|
-
const handleRenameTabFromMenu = (0,
|
|
11463
|
+
const handleRenameTabFromMenu = (0, import_react74.useCallback)(
|
|
11735
11464
|
(tabIndex) => {
|
|
11736
11465
|
editTab(tabIndex);
|
|
11737
11466
|
return true;
|
|
11738
11467
|
},
|
|
11739
11468
|
[editTab]
|
|
11740
11469
|
);
|
|
11741
|
-
const handleTabMenuAction = (0,
|
|
11470
|
+
const handleTabMenuAction = (0, import_react74.useCallback)(
|
|
11742
11471
|
(action) => {
|
|
11743
11472
|
if (isTabMenuOptions(action.options)) {
|
|
11744
11473
|
switch (action.menuId) {
|
|
@@ -11754,7 +11483,7 @@ var useTabstrip = ({
|
|
|
11754
11483
|
},
|
|
11755
11484
|
[handleCloseTabFromMenu, handleRenameTabFromMenu]
|
|
11756
11485
|
);
|
|
11757
|
-
const handleTabMenuClose = (0,
|
|
11486
|
+
const handleTabMenuClose = (0, import_react74.useCallback)(() => {
|
|
11758
11487
|
if (!tabInEditMode()) {
|
|
11759
11488
|
keyboardHookFocusTab(highlightedIdx);
|
|
11760
11489
|
} else {
|
|
@@ -11766,7 +11495,7 @@ var useTabstrip = ({
|
|
|
11766
11495
|
keyboardHookSetHighlightedIndex,
|
|
11767
11496
|
tabInEditMode
|
|
11768
11497
|
]);
|
|
11769
|
-
const onSwitchWrappedItemIntoView = (0,
|
|
11498
|
+
const onSwitchWrappedItemIntoView = (0, import_react74.useCallback)(
|
|
11770
11499
|
(item) => {
|
|
11771
11500
|
const index = parseInt(item.index);
|
|
11772
11501
|
if (!isNaN(index)) {
|
|
@@ -11779,7 +11508,7 @@ var useTabstrip = ({
|
|
|
11779
11508
|
onFocus: keyboardHook.onFocus,
|
|
11780
11509
|
onKeyDown: handleKeyDown
|
|
11781
11510
|
};
|
|
11782
|
-
const handleAddTabClick = (0,
|
|
11511
|
+
const handleAddTabClick = (0, import_react74.useCallback)(() => {
|
|
11783
11512
|
onAddTab == null ? void 0 : onAddTab();
|
|
11784
11513
|
requestAnimationFrame(() => {
|
|
11785
11514
|
const selectedTabIndex = getIndexOfSelectedTab(containerRef.current);
|
|
@@ -11812,9 +11541,9 @@ var useTabstrip = ({
|
|
|
11812
11541
|
};
|
|
11813
11542
|
|
|
11814
11543
|
// src/tabstrip/Tabstrip.tsx
|
|
11815
|
-
var
|
|
11816
|
-
var
|
|
11817
|
-
var
|
|
11544
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
11545
|
+
var import_react76 = require("react");
|
|
11546
|
+
var classBase26 = "vuuTabstrip";
|
|
11818
11547
|
var Tabstrip = ({
|
|
11819
11548
|
activeTabIndex: activeTabIndexProp,
|
|
11820
11549
|
allowAddTab,
|
|
@@ -11839,7 +11568,7 @@ var Tabstrip = ({
|
|
|
11839
11568
|
variant = "secondary",
|
|
11840
11569
|
...htmlAttributes
|
|
11841
11570
|
}) => {
|
|
11842
|
-
const rootRef = (0,
|
|
11571
|
+
const rootRef = (0, import_react75.useRef)(null);
|
|
11843
11572
|
const {
|
|
11844
11573
|
activeTabIndex,
|
|
11845
11574
|
focusVisible,
|
|
@@ -11861,14 +11590,14 @@ var Tabstrip = ({
|
|
|
11861
11590
|
onMoveTab,
|
|
11862
11591
|
orientation
|
|
11863
11592
|
});
|
|
11864
|
-
const id = (0,
|
|
11865
|
-
const className = (0,
|
|
11593
|
+
const id = (0, import_vuu_utils34.useId)(idProp);
|
|
11594
|
+
const className = (0, import_clsx31.default)(classBase26, classNameProp);
|
|
11866
11595
|
const style = styleProp || containerStyle ? {
|
|
11867
11596
|
...styleProp,
|
|
11868
11597
|
...containerStyle
|
|
11869
11598
|
} : void 0;
|
|
11870
|
-
const tabs = (0,
|
|
11871
|
-
() => (0,
|
|
11599
|
+
const tabs = (0, import_react75.useMemo)(
|
|
11600
|
+
() => (0, import_vuu_utils34.asReactElements)(children).map((child, index) => {
|
|
11872
11601
|
const {
|
|
11873
11602
|
id: tabId = `${id}-tab-${index}`,
|
|
11874
11603
|
className: className2,
|
|
@@ -11878,10 +11607,10 @@ var Tabstrip = ({
|
|
|
11878
11607
|
showMenuButton = showTabMenuButton
|
|
11879
11608
|
} = child.props;
|
|
11880
11609
|
const selected = index === activeTabIndex;
|
|
11881
|
-
return
|
|
11610
|
+
return import_react75.default.cloneElement(child, {
|
|
11882
11611
|
...tabProps,
|
|
11883
11612
|
...tabstripHook.navigationProps,
|
|
11884
|
-
className: (0,
|
|
11613
|
+
className: (0, import_clsx31.default)(className2, tabClassName),
|
|
11885
11614
|
closeable,
|
|
11886
11615
|
"data-overflow-priority": selected ? "1" : void 0,
|
|
11887
11616
|
dragging: draggedItemIndex === index,
|
|
@@ -11890,18 +11619,18 @@ var Tabstrip = ({
|
|
|
11890
11619
|
id: tabId,
|
|
11891
11620
|
index,
|
|
11892
11621
|
key: index,
|
|
11893
|
-
location: (0,
|
|
11622
|
+
location: (0, import_clsx31.default)(location, tabLocation),
|
|
11894
11623
|
selected,
|
|
11895
11624
|
showMenuButton,
|
|
11896
11625
|
tabIndex: selected ? 0 : -1
|
|
11897
11626
|
});
|
|
11898
11627
|
}).concat(
|
|
11899
|
-
allowAddTab ? /* @__PURE__ */ (0,
|
|
11628
|
+
allowAddTab ? /* @__PURE__ */ (0, import_react76.createElement)(
|
|
11900
11629
|
IconButton,
|
|
11901
11630
|
{
|
|
11902
11631
|
...tabstripHook.navigationProps,
|
|
11903
11632
|
"aria-label": "Create Tab",
|
|
11904
|
-
className: `${
|
|
11633
|
+
className: `${classBase26}-addTabButton`,
|
|
11905
11634
|
"data-embedded": true,
|
|
11906
11635
|
icon: "add",
|
|
11907
11636
|
"data-overflow-priority": "1",
|
|
@@ -11929,13 +11658,13 @@ var Tabstrip = ({
|
|
|
11929
11658
|
location
|
|
11930
11659
|
]
|
|
11931
11660
|
);
|
|
11932
|
-
return /* @__PURE__ */ (0,
|
|
11933
|
-
/* @__PURE__ */ (0,
|
|
11661
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
11662
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
11934
11663
|
OverflowContainer,
|
|
11935
11664
|
{
|
|
11936
11665
|
...htmlAttributes,
|
|
11937
11666
|
...tabstripHook.containerProps,
|
|
11938
|
-
className: (0,
|
|
11667
|
+
className: (0, import_clsx31.default)(className, `${classBase26}-${variant}`),
|
|
11939
11668
|
id,
|
|
11940
11669
|
orientation,
|
|
11941
11670
|
overflowIcon: "more-horiz",
|
|
@@ -11950,16 +11679,16 @@ var Tabstrip = ({
|
|
|
11950
11679
|
};
|
|
11951
11680
|
|
|
11952
11681
|
// src/tabstrip/Tab.tsx
|
|
11953
|
-
var
|
|
11954
|
-
var
|
|
11955
|
-
var
|
|
11682
|
+
var import_core33 = require("@salt-ds/core");
|
|
11683
|
+
var import_clsx33 = __toESM(require("clsx"));
|
|
11684
|
+
var import_react78 = require("react");
|
|
11956
11685
|
|
|
11957
11686
|
// src/tabstrip/TabMenu.tsx
|
|
11958
11687
|
var import_vuu_popups6 = require("@vuu-ui/vuu-popups");
|
|
11959
|
-
var
|
|
11960
|
-
var
|
|
11961
|
-
var
|
|
11962
|
-
var
|
|
11688
|
+
var import_react77 = require("react");
|
|
11689
|
+
var import_clsx32 = __toESM(require("clsx"));
|
|
11690
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
11691
|
+
var classBase27 = "vuuTabMenu";
|
|
11963
11692
|
var TabMenu = ({
|
|
11964
11693
|
allowClose,
|
|
11965
11694
|
allowRename,
|
|
@@ -11970,7 +11699,7 @@ var TabMenu = ({
|
|
|
11970
11699
|
onMenuClose,
|
|
11971
11700
|
index
|
|
11972
11701
|
}) => {
|
|
11973
|
-
const [menuBuilder, menuOptions] = (0,
|
|
11702
|
+
const [menuBuilder, menuOptions] = (0, import_react77.useMemo)(
|
|
11974
11703
|
() => [
|
|
11975
11704
|
(_location, options) => {
|
|
11976
11705
|
const menuItems = [];
|
|
@@ -11996,15 +11725,15 @@ var TabMenu = ({
|
|
|
11996
11725
|
index
|
|
11997
11726
|
]
|
|
11998
11727
|
);
|
|
11999
|
-
return /* @__PURE__ */ (0,
|
|
11728
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
12000
11729
|
import_vuu_popups6.PopupMenu,
|
|
12001
11730
|
{
|
|
12002
11731
|
"aria-label": "context menu",
|
|
12003
|
-
className:
|
|
11732
|
+
className: classBase27,
|
|
12004
11733
|
"data-embedded": true,
|
|
12005
11734
|
menuBuilder,
|
|
12006
11735
|
menuActionHandler: onMenuAction,
|
|
12007
|
-
menuLocation: (0,
|
|
11736
|
+
menuLocation: (0, import_clsx32.default)("tab", location),
|
|
12008
11737
|
menuOptions,
|
|
12009
11738
|
onMenuClose,
|
|
12010
11739
|
tabIndex: -1
|
|
@@ -12013,10 +11742,10 @@ var TabMenu = ({
|
|
|
12013
11742
|
};
|
|
12014
11743
|
|
|
12015
11744
|
// src/tabstrip/Tab.tsx
|
|
12016
|
-
var
|
|
12017
|
-
var
|
|
11745
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
11746
|
+
var classBase28 = "vuuTab";
|
|
12018
11747
|
var noop2 = () => void 0;
|
|
12019
|
-
var Tab = (0,
|
|
11748
|
+
var Tab = (0, import_react78.forwardRef)(function Tab2({
|
|
12020
11749
|
ariaControls,
|
|
12021
11750
|
children,
|
|
12022
11751
|
className,
|
|
@@ -12045,10 +11774,10 @@ var Tab = (0, import_react85.forwardRef)(function Tab2({
|
|
|
12045
11774
|
if (showMenuButton && typeof onMenuAction !== "function") {
|
|
12046
11775
|
throw Error("Tab onMenuAction must be provided if showMenuButton is set");
|
|
12047
11776
|
}
|
|
12048
|
-
const rootRef = (0,
|
|
12049
|
-
const editableRef = (0,
|
|
12050
|
-
const setForkRef = (0,
|
|
12051
|
-
const handleClick = (0,
|
|
11777
|
+
const rootRef = (0, import_react78.useRef)(null);
|
|
11778
|
+
const editableRef = (0, import_react78.useRef)(null);
|
|
11779
|
+
const setForkRef = (0, import_core33.useForkRef)(ref, rootRef);
|
|
11780
|
+
const handleClick = (0, import_react78.useCallback)(
|
|
12052
11781
|
(e) => {
|
|
12053
11782
|
if (!editing) {
|
|
12054
11783
|
e.preventDefault();
|
|
@@ -12073,7 +11802,7 @@ var Tab = (0, import_react85.forwardRef)(function Tab2({
|
|
|
12073
11802
|
};
|
|
12074
11803
|
const getLabel = () => {
|
|
12075
11804
|
if (editable) {
|
|
12076
|
-
return /* @__PURE__ */ (0,
|
|
11805
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
12077
11806
|
EditableLabel,
|
|
12078
11807
|
{
|
|
12079
11808
|
editing,
|
|
@@ -12098,18 +11827,18 @@ var Tab = (0, import_react85.forwardRef)(function Tab2({
|
|
|
12098
11827
|
}
|
|
12099
11828
|
onFocusProp == null ? void 0 : onFocusProp(evt);
|
|
12100
11829
|
};
|
|
12101
|
-
return /* @__PURE__ */ (0,
|
|
11830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
12102
11831
|
"div",
|
|
12103
11832
|
{
|
|
12104
11833
|
...props,
|
|
12105
11834
|
"aria-controls": ariaControls,
|
|
12106
11835
|
"aria-selected": selected,
|
|
12107
|
-
className: (0,
|
|
12108
|
-
[`${
|
|
11836
|
+
className: (0, import_clsx33.default)(classBase28, className, {
|
|
11837
|
+
[`${classBase28}-closeable`]: closeable,
|
|
12109
11838
|
"vuuDraggable-dragAway": dragging,
|
|
12110
|
-
[`${
|
|
12111
|
-
[`${
|
|
12112
|
-
[`${
|
|
11839
|
+
[`${classBase28}-editing`]: editing,
|
|
11840
|
+
[`${classBase28}-selected`]: selected || void 0,
|
|
11841
|
+
[`${classBase28}-vertical`]: orientation === "vertical",
|
|
12113
11842
|
[`vuuFocusVisible`]: focusVisible
|
|
12114
11843
|
}),
|
|
12115
11844
|
onClick: handleClick,
|
|
@@ -12119,15 +11848,15 @@ var Tab = (0, import_react85.forwardRef)(function Tab2({
|
|
|
12119
11848
|
role: "tab",
|
|
12120
11849
|
tabIndex,
|
|
12121
11850
|
children: [
|
|
12122
|
-
/* @__PURE__ */ (0,
|
|
11851
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: `${classBase28}-main`, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
12123
11852
|
"span",
|
|
12124
11853
|
{
|
|
12125
|
-
className: `${
|
|
11854
|
+
className: `${classBase28}-text`,
|
|
12126
11855
|
"data-text": editable ? void 0 : label,
|
|
12127
11856
|
children: children != null ? children : getLabel()
|
|
12128
11857
|
}
|
|
12129
11858
|
) }),
|
|
12130
|
-
showMenuButton ? /* @__PURE__ */ (0,
|
|
11859
|
+
showMenuButton ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
12131
11860
|
TabMenu,
|
|
12132
11861
|
{
|
|
12133
11862
|
allowClose: closeable,
|
|
@@ -12146,28 +11875,28 @@ var Tab = (0, import_react85.forwardRef)(function Tab2({
|
|
|
12146
11875
|
});
|
|
12147
11876
|
|
|
12148
11877
|
// src/toolbar/Toolbar.tsx
|
|
12149
|
-
var
|
|
12150
|
-
var
|
|
12151
|
-
var
|
|
11878
|
+
var import_vuu_utils40 = require("@vuu-ui/vuu-utils");
|
|
11879
|
+
var import_clsx34 = __toESM(require("clsx"));
|
|
11880
|
+
var import_react82 = __toESM(require("react"));
|
|
12152
11881
|
|
|
12153
11882
|
// src/toolbar/useToolbar.ts
|
|
12154
|
-
var
|
|
12155
|
-
var
|
|
11883
|
+
var import_vuu_utils39 = require("@vuu-ui/vuu-utils");
|
|
11884
|
+
var import_react81 = require("react");
|
|
12156
11885
|
|
|
12157
11886
|
// src/toolbar/useKeyboardNavigation.ts
|
|
12158
|
-
var
|
|
11887
|
+
var import_core34 = require("@salt-ds/core");
|
|
11888
|
+
var import_vuu_utils36 = require("@vuu-ui/vuu-utils");
|
|
11889
|
+
var import_react79 = require("react");
|
|
12159
11890
|
var import_vuu_utils37 = require("@vuu-ui/vuu-utils");
|
|
12160
|
-
var import_react86 = require("react");
|
|
12161
|
-
var import_vuu_utils38 = require("@vuu-ui/vuu-utils");
|
|
12162
11891
|
|
|
12163
11892
|
// src/toolbar/toolbar-dom-utils.ts
|
|
12164
|
-
var
|
|
11893
|
+
var import_vuu_utils35 = require("@vuu-ui/vuu-utils");
|
|
12165
11894
|
var getIndexOfItem2 = (container, query) => {
|
|
12166
11895
|
if (container) {
|
|
12167
11896
|
const targetTab = container.querySelector(
|
|
12168
11897
|
`[data-index]:has(${query})`
|
|
12169
11898
|
);
|
|
12170
|
-
return (0,
|
|
11899
|
+
return (0, import_vuu_utils35.getElementDataIndex)(targetTab);
|
|
12171
11900
|
}
|
|
12172
11901
|
return -1;
|
|
12173
11902
|
};
|
|
@@ -12176,16 +11905,16 @@ var getIndexOfEditedItem2 = (container) => getIndexOfItem2(container, ".vuuEdita
|
|
|
12176
11905
|
// src/toolbar/useKeyboardNavigation.ts
|
|
12177
11906
|
var navigation2 = {
|
|
12178
11907
|
horizontal: {
|
|
12179
|
-
[
|
|
12180
|
-
[
|
|
12181
|
-
[
|
|
12182
|
-
[
|
|
11908
|
+
[import_vuu_utils37.Home]: "start",
|
|
11909
|
+
[import_vuu_utils37.End]: "end",
|
|
11910
|
+
[import_vuu_utils37.ArrowLeft]: "bwd",
|
|
11911
|
+
[import_vuu_utils37.ArrowRight]: "fwd"
|
|
12183
11912
|
},
|
|
12184
11913
|
vertical: {
|
|
12185
|
-
[
|
|
12186
|
-
[
|
|
12187
|
-
[
|
|
12188
|
-
[
|
|
11914
|
+
[import_vuu_utils37.Home]: "start",
|
|
11915
|
+
[import_vuu_utils37.End]: "end",
|
|
11916
|
+
[import_vuu_utils37.ArrowUp]: "bwd",
|
|
11917
|
+
[import_vuu_utils37.ArrowDown]: "fwd"
|
|
12189
11918
|
}
|
|
12190
11919
|
};
|
|
12191
11920
|
var isOverflowIndicator = (el) => el !== null && el.dataset.index === "overflow";
|
|
@@ -12204,7 +11933,7 @@ var itemIsNotFocusable = (container, direction, indexCount, nextIdx, hasOverflow
|
|
|
12204
11933
|
}
|
|
12205
11934
|
};
|
|
12206
11935
|
var isNavigationKey3 = (key, orientation = "horizontal") => navigation2[orientation][key] !== void 0;
|
|
12207
|
-
var isMenuActivationKey2 = (key) => key ===
|
|
11936
|
+
var isMenuActivationKey2 = (key) => key === import_vuu_utils37.ArrowDown;
|
|
12208
11937
|
function nextItemIdx3(count, direction, idx) {
|
|
12209
11938
|
if (direction === "start") {
|
|
12210
11939
|
return 0;
|
|
@@ -12256,22 +11985,22 @@ var useKeyboardNavigation3 = ({
|
|
|
12256
11985
|
onNavigateOutOfBounds,
|
|
12257
11986
|
orientation
|
|
12258
11987
|
}) => {
|
|
12259
|
-
const mouseClickPending = (0,
|
|
12260
|
-
const focusedRef = (0,
|
|
12261
|
-
const [hasFocus, setHasFocus] = (0,
|
|
12262
|
-
const [highlightedIdx, _setHighlightedIdx] = (0,
|
|
11988
|
+
const mouseClickPending = (0, import_react79.useRef)(false);
|
|
11989
|
+
const focusedRef = (0, import_react79.useRef)(-1);
|
|
11990
|
+
const [hasFocus, setHasFocus] = (0, import_react79.useState)(false);
|
|
11991
|
+
const [highlightedIdx, _setHighlightedIdx] = (0, import_core34.useControlled)({
|
|
12263
11992
|
controlled: highlightedIdxProp,
|
|
12264
11993
|
default: defaultHighlightedIdx,
|
|
12265
11994
|
name: "UseKeyboardNavigation"
|
|
12266
11995
|
});
|
|
12267
|
-
const setHighlightedIdx = (0,
|
|
11996
|
+
const setHighlightedIdx = (0, import_react79.useCallback)(
|
|
12268
11997
|
(value) => {
|
|
12269
11998
|
_setHighlightedIdx(focusedRef.current = value);
|
|
12270
11999
|
},
|
|
12271
12000
|
[_setHighlightedIdx]
|
|
12272
12001
|
);
|
|
12273
|
-
const keyboardNavigation = (0,
|
|
12274
|
-
const focusItem = (0,
|
|
12002
|
+
const keyboardNavigation = (0, import_react79.useRef)(false);
|
|
12003
|
+
const focusItem = (0, import_react79.useCallback)(
|
|
12275
12004
|
(itemIndex, immediateFocus = false, withKeyboard, delay = 70) => {
|
|
12276
12005
|
console.log(`focus item ${itemIndex}`);
|
|
12277
12006
|
setHighlightedIdx(itemIndex);
|
|
@@ -12285,7 +12014,7 @@ var useKeyboardNavigation3 = ({
|
|
|
12285
12014
|
true
|
|
12286
12015
|
);
|
|
12287
12016
|
if (element) {
|
|
12288
|
-
const focussableElement = (0,
|
|
12017
|
+
const focussableElement = (0, import_vuu_utils36.getFocusableElement)(element);
|
|
12289
12018
|
focussableElement == null ? void 0 : focussableElement.focus();
|
|
12290
12019
|
}
|
|
12291
12020
|
};
|
|
@@ -12300,7 +12029,7 @@ var useKeyboardNavigation3 = ({
|
|
|
12300
12029
|
const onFocus = (e) => {
|
|
12301
12030
|
if (focusedRef.current === -1) {
|
|
12302
12031
|
if (e.target.tabIndex === 0) {
|
|
12303
|
-
const index = (0,
|
|
12032
|
+
const index = (0, import_vuu_utils36.getElementDataIndex)((0, import_vuu_utils36.getClosest)(e.target, "index"));
|
|
12304
12033
|
setHighlightedIdx(index);
|
|
12305
12034
|
} else if (e.target.tabIndex === -1) {
|
|
12306
12035
|
} else {
|
|
@@ -12313,14 +12042,14 @@ var useKeyboardNavigation3 = ({
|
|
|
12313
12042
|
}
|
|
12314
12043
|
}
|
|
12315
12044
|
};
|
|
12316
|
-
const getIndexCount = (0,
|
|
12045
|
+
const getIndexCount = (0, import_react79.useCallback)(
|
|
12317
12046
|
() => {
|
|
12318
12047
|
var _a2, _b;
|
|
12319
12048
|
return (_b = (_a2 = containerRef.current) == null ? void 0 : _a2.querySelectorAll(`[data-index]`).length) != null ? _b : 0;
|
|
12320
12049
|
},
|
|
12321
12050
|
[containerRef]
|
|
12322
12051
|
);
|
|
12323
|
-
const nextFocusableItemIdx = (0,
|
|
12052
|
+
const nextFocusableItemIdx = (0, import_react79.useCallback)(
|
|
12324
12053
|
(direction = "fwd", idx) => {
|
|
12325
12054
|
var _a2;
|
|
12326
12055
|
const indexCount = getIndexCount();
|
|
@@ -12348,7 +12077,7 @@ var useKeyboardNavigation3 = ({
|
|
|
12348
12077
|
},
|
|
12349
12078
|
[containerRef, getIndexCount]
|
|
12350
12079
|
);
|
|
12351
|
-
const navigateChildItems = (0,
|
|
12080
|
+
const navigateChildItems = (0, import_react79.useCallback)(
|
|
12352
12081
|
(e) => {
|
|
12353
12082
|
const direction = navigation2[orientation][e.key];
|
|
12354
12083
|
const nextIdx = nextFocusableItemIdx(direction, highlightedIdx);
|
|
@@ -12368,29 +12097,29 @@ var useKeyboardNavigation3 = ({
|
|
|
12368
12097
|
onNavigateOutOfBounds
|
|
12369
12098
|
]
|
|
12370
12099
|
);
|
|
12371
|
-
const highlightedItemHasMenu = (0,
|
|
12100
|
+
const highlightedItemHasMenu = (0, import_react79.useCallback)(() => {
|
|
12372
12101
|
const el = getElementByPosition2(containerRef.current, highlightedIdx);
|
|
12373
12102
|
if (el) {
|
|
12374
12103
|
return el.querySelector(".vuuPopupMenu") != null;
|
|
12375
12104
|
}
|
|
12376
12105
|
return false;
|
|
12377
12106
|
}, [containerRef, highlightedIdx]);
|
|
12378
|
-
const highlightedItemInEditState = (0,
|
|
12107
|
+
const highlightedItemInEditState = (0, import_react79.useCallback)(() => {
|
|
12379
12108
|
const el = getElementByPosition2(containerRef.current, highlightedIdx);
|
|
12380
12109
|
if (el) {
|
|
12381
12110
|
return el.querySelector(".vuuEditableLabel-input") != null;
|
|
12382
12111
|
}
|
|
12383
12112
|
return false;
|
|
12384
12113
|
}, [containerRef, highlightedIdx]);
|
|
12385
|
-
const activateItemMenu = (0,
|
|
12114
|
+
const activateItemMenu = (0, import_react79.useCallback)(() => {
|
|
12386
12115
|
const el = getElementByPosition2(containerRef.current, highlightedIdx);
|
|
12387
12116
|
const menuEl = el == null ? void 0 : el.querySelector(".vuuPopupMenu");
|
|
12388
12117
|
if (menuEl) {
|
|
12389
|
-
(0,
|
|
12118
|
+
(0, import_vuu_utils36.dispatchMouseEvent)(menuEl, "click");
|
|
12390
12119
|
}
|
|
12391
12120
|
return false;
|
|
12392
12121
|
}, [containerRef, highlightedIdx]);
|
|
12393
|
-
const handleKeyDown = (0,
|
|
12122
|
+
const handleKeyDown = (0, import_react79.useCallback)(
|
|
12394
12123
|
(e) => {
|
|
12395
12124
|
if (getIndexCount() > 0 && isNavigationKey3(e.key, orientation)) {
|
|
12396
12125
|
e.preventDefault();
|
|
@@ -12416,7 +12145,7 @@ var useKeyboardNavigation3 = ({
|
|
|
12416
12145
|
const handleItemClick = (_, itemIndex) => {
|
|
12417
12146
|
setHighlightedIdx(itemIndex);
|
|
12418
12147
|
};
|
|
12419
|
-
const handleFocus = (0,
|
|
12148
|
+
const handleFocus = (0, import_react79.useCallback)(() => {
|
|
12420
12149
|
if (!hasFocus) {
|
|
12421
12150
|
setHasFocus(true);
|
|
12422
12151
|
if (!mouseClickPending.current) {
|
|
@@ -12426,13 +12155,13 @@ var useKeyboardNavigation3 = ({
|
|
|
12426
12155
|
}
|
|
12427
12156
|
}
|
|
12428
12157
|
}, [hasFocus]);
|
|
12429
|
-
const handleContainerMouseDown = (0,
|
|
12158
|
+
const handleContainerMouseDown = (0, import_react79.useCallback)(() => {
|
|
12430
12159
|
if (!hasFocus) {
|
|
12431
12160
|
mouseClickPending.current = true;
|
|
12432
12161
|
}
|
|
12433
12162
|
keyboardNavigation.current = false;
|
|
12434
12163
|
}, [hasFocus]);
|
|
12435
|
-
const handleOverflowMenuClose = (0,
|
|
12164
|
+
const handleOverflowMenuClose = (0, import_react79.useCallback)(
|
|
12436
12165
|
(closeReason) => {
|
|
12437
12166
|
if ((closeReason == null ? void 0 : closeReason.type) === "escape") {
|
|
12438
12167
|
const index = getIndexOfOverflowItem(containerRef.current);
|
|
@@ -12476,8 +12205,8 @@ var useKeyboardNavigation3 = ({
|
|
|
12476
12205
|
};
|
|
12477
12206
|
|
|
12478
12207
|
// src/toolbar/useSelection.ts
|
|
12479
|
-
var
|
|
12480
|
-
var
|
|
12208
|
+
var import_vuu_utils38 = require("@vuu-ui/vuu-utils");
|
|
12209
|
+
var import_react80 = require("react");
|
|
12481
12210
|
var defaultSelectionKeys3 = ["Enter", " "];
|
|
12482
12211
|
var NO_SELECTION_HANDLERS = {};
|
|
12483
12212
|
var useSelection3 = ({
|
|
@@ -12493,11 +12222,11 @@ var useSelection3 = ({
|
|
|
12493
12222
|
name: "useSelection",
|
|
12494
12223
|
state: "selected"
|
|
12495
12224
|
});
|
|
12496
|
-
const isSelectionEvent = (0,
|
|
12225
|
+
const isSelectionEvent = (0, import_react80.useCallback)(
|
|
12497
12226
|
(evt) => defaultSelectionKeys3.includes(evt.key),
|
|
12498
12227
|
[]
|
|
12499
12228
|
);
|
|
12500
|
-
const selectItem = (0,
|
|
12229
|
+
const selectItem = (0, import_react80.useCallback)(
|
|
12501
12230
|
(itemIndex, specialKey = false) => {
|
|
12502
12231
|
const newSelected = allowMultipleSelection(selectionStrategy, specialKey) ? selected.concat(itemIndex) : [itemIndex];
|
|
12503
12232
|
setSelected(newSelected);
|
|
@@ -12505,7 +12234,7 @@ var useSelection3 = ({
|
|
|
12505
12234
|
},
|
|
12506
12235
|
[onSelectionChange, selected, selectionStrategy, setSelected]
|
|
12507
12236
|
);
|
|
12508
|
-
const deselectItem = (0,
|
|
12237
|
+
const deselectItem = (0, import_react80.useCallback)(
|
|
12509
12238
|
(itemIndex, specialKey = false) => {
|
|
12510
12239
|
const newSelected = selectionStrategy === "deselectable" || selectionStrategy === "multiple-special-key" && !specialKey ? [] : selected.filter((index) => index !== itemIndex);
|
|
12511
12240
|
setSelected(newSelected);
|
|
@@ -12513,9 +12242,9 @@ var useSelection3 = ({
|
|
|
12513
12242
|
},
|
|
12514
12243
|
[onSelectionChange, selected, selectionStrategy, setSelected]
|
|
12515
12244
|
);
|
|
12516
|
-
const handleKeyDown = (0,
|
|
12245
|
+
const handleKeyDown = (0, import_react80.useCallback)(
|
|
12517
12246
|
(e) => {
|
|
12518
|
-
if (isSelectionEvent(e) && (0,
|
|
12247
|
+
if (isSelectionEvent(e) && (0, import_vuu_utils38.isSelectableElement)(e.target)) {
|
|
12519
12248
|
if (!selected.includes(highlightedIdx)) {
|
|
12520
12249
|
e.stopPropagation();
|
|
12521
12250
|
e.preventDefault();
|
|
@@ -12536,10 +12265,10 @@ var useSelection3 = ({
|
|
|
12536
12265
|
deselectItem
|
|
12537
12266
|
]
|
|
12538
12267
|
);
|
|
12539
|
-
const handleClick = (0,
|
|
12268
|
+
const handleClick = (0, import_react80.useCallback)(
|
|
12540
12269
|
(e, itemIndex) => {
|
|
12541
|
-
const element = (0,
|
|
12542
|
-
if ((0,
|
|
12270
|
+
const element = (0, import_vuu_utils38.getClosestIndexItem)(e.target);
|
|
12271
|
+
if ((0, import_vuu_utils38.isSelectableElement)(element)) {
|
|
12543
12272
|
if (!selected.includes(itemIndex)) {
|
|
12544
12273
|
selectItem(itemIndex, e.shiftKey);
|
|
12545
12274
|
} else if (deselectionIsAllowed(selectionStrategy)) {
|
|
@@ -12572,7 +12301,7 @@ var useToolbar = ({
|
|
|
12572
12301
|
orientation,
|
|
12573
12302
|
selectionStrategy
|
|
12574
12303
|
}) => {
|
|
12575
|
-
const lastSelection = (0,
|
|
12304
|
+
const lastSelection = (0, import_react81.useRef)(activeItemIndexProp);
|
|
12576
12305
|
const {
|
|
12577
12306
|
focusItem: keyboardHookFocusItem,
|
|
12578
12307
|
highlightedIdx,
|
|
@@ -12599,14 +12328,14 @@ var useToolbar = ({
|
|
|
12599
12328
|
selectionStrategy
|
|
12600
12329
|
});
|
|
12601
12330
|
lastSelection.current = selectionHookSelected;
|
|
12602
|
-
const handleClick = (0,
|
|
12331
|
+
const handleClick = (0, import_react81.useCallback)(
|
|
12603
12332
|
(evt) => {
|
|
12604
12333
|
var _a2;
|
|
12605
12334
|
const target = evt.target;
|
|
12606
12335
|
const toolbarItem = target.closest("[data-index]");
|
|
12607
12336
|
if (toolbarItem) {
|
|
12608
12337
|
const index = parseInt((_a2 = toolbarItem.dataset.index) != null ? _a2 : "-1");
|
|
12609
|
-
if (index !== -1 && (0,
|
|
12338
|
+
if (index !== -1 && (0, import_vuu_utils39.isValidNumber)(index)) {
|
|
12610
12339
|
keyboardHookHandleClick(evt, index);
|
|
12611
12340
|
onClick == null ? void 0 : onClick(evt, index);
|
|
12612
12341
|
}
|
|
@@ -12614,7 +12343,7 @@ var useToolbar = ({
|
|
|
12614
12343
|
},
|
|
12615
12344
|
[keyboardHookHandleClick, onClick]
|
|
12616
12345
|
);
|
|
12617
|
-
const handleKeyDown = (0,
|
|
12346
|
+
const handleKeyDown = (0, import_react81.useCallback)(
|
|
12618
12347
|
(evt) => {
|
|
12619
12348
|
keyboardHookHandleKeyDown(evt);
|
|
12620
12349
|
if (!evt.defaultPrevented) {
|
|
@@ -12623,7 +12352,7 @@ var useToolbar = ({
|
|
|
12623
12352
|
},
|
|
12624
12353
|
[keyboardHookHandleKeyDown, onKeyDown]
|
|
12625
12354
|
);
|
|
12626
|
-
const onSwitchWrappedItemIntoView = (0,
|
|
12355
|
+
const onSwitchWrappedItemIntoView = (0, import_react81.useCallback)(
|
|
12627
12356
|
(item) => {
|
|
12628
12357
|
const index = parseInt(item.index);
|
|
12629
12358
|
if (!isNaN(index)) {
|
|
@@ -12655,8 +12384,8 @@ var useToolbar = ({
|
|
|
12655
12384
|
};
|
|
12656
12385
|
|
|
12657
12386
|
// src/toolbar/Toolbar.tsx
|
|
12658
|
-
var
|
|
12659
|
-
var
|
|
12387
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
12388
|
+
var classBase29 = "vuuToolbar";
|
|
12660
12389
|
var Toolbar = ({
|
|
12661
12390
|
activeItemIndex: activeItemIndexProp,
|
|
12662
12391
|
alignItems = "start",
|
|
@@ -12671,7 +12400,7 @@ var Toolbar = ({
|
|
|
12671
12400
|
showSeparators = false,
|
|
12672
12401
|
...props
|
|
12673
12402
|
}) => {
|
|
12674
|
-
const rootRef = (0,
|
|
12403
|
+
const rootRef = (0, import_react82.useRef)(null);
|
|
12675
12404
|
const {
|
|
12676
12405
|
activeItemIndex,
|
|
12677
12406
|
focusableIdx,
|
|
@@ -12687,18 +12416,18 @@ var Toolbar = ({
|
|
|
12687
12416
|
orientation,
|
|
12688
12417
|
selectionStrategy
|
|
12689
12418
|
});
|
|
12690
|
-
const id = (0,
|
|
12691
|
-
const items = (0,
|
|
12692
|
-
() => (0,
|
|
12419
|
+
const id = (0, import_vuu_utils40.useId)(idProp);
|
|
12420
|
+
const items = (0, import_react82.useMemo)(
|
|
12421
|
+
() => (0, import_vuu_utils40.asReactElements)(children).map((child, index) => {
|
|
12693
12422
|
const {
|
|
12694
12423
|
id: itemId = `${id}-tab-${index}`,
|
|
12695
12424
|
className: itemClassName,
|
|
12696
12425
|
...ownProps
|
|
12697
12426
|
} = child.props;
|
|
12698
12427
|
const selected = activeItemIndex.includes(index);
|
|
12699
|
-
return
|
|
12428
|
+
return import_react82.default.cloneElement(child, {
|
|
12700
12429
|
...forwardCallbackProps(ownProps, itemProps),
|
|
12701
|
-
className: (0,
|
|
12430
|
+
className: (0, import_clsx34.default)("vuuToolbarItem", itemClassName),
|
|
12702
12431
|
"data-overflow-priority": selected ? "1" : void 0,
|
|
12703
12432
|
id: itemId,
|
|
12704
12433
|
key: index,
|
|
@@ -12708,15 +12437,15 @@ var Toolbar = ({
|
|
|
12708
12437
|
}),
|
|
12709
12438
|
[activeItemIndex, children, focusableIdx, id, itemProps]
|
|
12710
12439
|
);
|
|
12711
|
-
return /* @__PURE__ */ (0,
|
|
12440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
12712
12441
|
OverflowContainer,
|
|
12713
12442
|
{
|
|
12714
12443
|
...props,
|
|
12715
12444
|
...toolbarHook.containerProps,
|
|
12716
|
-
className: (0,
|
|
12717
|
-
[`${
|
|
12718
|
-
[`${
|
|
12719
|
-
[`${
|
|
12445
|
+
className: (0, import_clsx34.default)(className, classBase29, `${classBase29}-${orientation}`, {
|
|
12446
|
+
[`${classBase29}-alignCenter`]: alignItems === "center",
|
|
12447
|
+
[`${classBase29}-alignEnd`]: alignItems === "end",
|
|
12448
|
+
[`${classBase29}-withSeparators`]: showSeparators
|
|
12720
12449
|
}),
|
|
12721
12450
|
...props,
|
|
12722
12451
|
ref: rootRef,
|
|
@@ -12726,9 +12455,9 @@ var Toolbar = ({
|
|
|
12726
12455
|
};
|
|
12727
12456
|
|
|
12728
12457
|
// src/tree/Tree.tsx
|
|
12729
|
-
var
|
|
12730
|
-
var
|
|
12731
|
-
var
|
|
12458
|
+
var import_core37 = require("@salt-ds/core");
|
|
12459
|
+
var import_clsx35 = __toESM(require("clsx"));
|
|
12460
|
+
var import_react91 = require("react");
|
|
12732
12461
|
|
|
12733
12462
|
// src/tree/list-dom-utils.ts
|
|
12734
12463
|
function listItemIndex2(listItemEl) {
|
|
@@ -12746,7 +12475,7 @@ var closestListItem2 = (el) => el.closest("[data-idx],[aria-posinset]");
|
|
|
12746
12475
|
var closestListItemIndex2 = (el) => listItemIndex2(closestListItem2(el));
|
|
12747
12476
|
|
|
12748
12477
|
// src/tree/use-items-with-ids.ts
|
|
12749
|
-
var
|
|
12478
|
+
var import_react83 = require("react");
|
|
12750
12479
|
var PathSeparators2 = /* @__PURE__ */ new Set(["/", "-", "."]);
|
|
12751
12480
|
var isPathSeparator2 = (char) => PathSeparators2.has(char);
|
|
12752
12481
|
var isParentPath2 = (parentPath, childPath) => childPath.startsWith(parentPath) && isPathSeparator2(childPath[parentPath.length]);
|
|
@@ -12770,7 +12499,7 @@ var useItemsWithIds = (sourceProp, idRoot = "root", {
|
|
|
12770
12499
|
return 0;
|
|
12771
12500
|
}
|
|
12772
12501
|
};
|
|
12773
|
-
const isExpanded2 = (0,
|
|
12502
|
+
const isExpanded2 = (0, import_react83.useCallback)(
|
|
12774
12503
|
(path) => {
|
|
12775
12504
|
if (Array.isArray(revealSelected)) {
|
|
12776
12505
|
return revealSelected.some((id) => isParentPath2(path, id));
|
|
@@ -12779,7 +12508,7 @@ var useItemsWithIds = (sourceProp, idRoot = "root", {
|
|
|
12779
12508
|
},
|
|
12780
12509
|
[defaultExpanded, revealSelected]
|
|
12781
12510
|
);
|
|
12782
|
-
const normalizeItems = (0,
|
|
12511
|
+
const normalizeItems = (0, import_react83.useCallback)(
|
|
12783
12512
|
(items, indexer, level = 1, path = "", results = [], flattenedSource2 = []) => {
|
|
12784
12513
|
let count2 = 0;
|
|
12785
12514
|
items.forEach((item, i, all) => {
|
|
@@ -12823,10 +12552,10 @@ var useItemsWithIds = (sourceProp, idRoot = "root", {
|
|
|
12823
12552
|
},
|
|
12824
12553
|
[collapsibleHeaders, idRoot, isExpanded2]
|
|
12825
12554
|
);
|
|
12826
|
-
const [count, sourceWithIds, flattenedSource] = (0,
|
|
12555
|
+
const [count, sourceWithIds, flattenedSource] = (0, import_react83.useMemo)(() => {
|
|
12827
12556
|
return normalizeItems(sourceProp, { index: 0 });
|
|
12828
12557
|
}, [normalizeItems, sourceProp]);
|
|
12829
|
-
const sourceItemById = (0,
|
|
12558
|
+
const sourceItemById = (0, import_react83.useCallback)(
|
|
12830
12559
|
(id, target = sourceWithIds) => {
|
|
12831
12560
|
const sourceWithId = target.find(
|
|
12832
12561
|
(i) => {
|
|
@@ -12846,8 +12575,8 @@ var useItemsWithIds = (sourceProp, idRoot = "root", {
|
|
|
12846
12575
|
};
|
|
12847
12576
|
|
|
12848
12577
|
// src/tree/use-selection.ts
|
|
12849
|
-
var
|
|
12850
|
-
var
|
|
12578
|
+
var import_react84 = require("react");
|
|
12579
|
+
var import_core35 = require("@salt-ds/core");
|
|
12851
12580
|
var SINGLE = "single";
|
|
12852
12581
|
var CHECKBOX2 = "checkbox";
|
|
12853
12582
|
var MULTI = "multi";
|
|
@@ -12868,17 +12597,17 @@ var useSelection4 = ({
|
|
|
12868
12597
|
const singleSelect = selection === SINGLE;
|
|
12869
12598
|
const multiSelect = selection === MULTI || selection.startsWith(CHECKBOX2);
|
|
12870
12599
|
const extendedSelect = selection === EXTENDED;
|
|
12871
|
-
const lastActive = (0,
|
|
12872
|
-
const isSelectionEvent = (0,
|
|
12600
|
+
const lastActive = (0, import_react84.useRef)(-1);
|
|
12601
|
+
const isSelectionEvent = (0, import_react84.useCallback)(
|
|
12873
12602
|
(evt) => selectionKeys.includes(evt.key),
|
|
12874
12603
|
[selectionKeys]
|
|
12875
12604
|
);
|
|
12876
|
-
const [selected, setSelected] = (0,
|
|
12605
|
+
const [selected, setSelected] = (0, import_core35.useControlled)({
|
|
12877
12606
|
controlled: selectedProp,
|
|
12878
12607
|
default: defaultSelected != null ? defaultSelected : [],
|
|
12879
12608
|
name: "selected"
|
|
12880
12609
|
});
|
|
12881
|
-
const selectItemAtIndex = (0,
|
|
12610
|
+
const selectItemAtIndex = (0, import_react84.useCallback)(
|
|
12882
12611
|
(evt, idx, id, rangeSelect, preserveExistingSelection = false) => {
|
|
12883
12612
|
const { current: active } = lastActive;
|
|
12884
12613
|
const isSelected2 = selected == null ? void 0 : selected.includes(id);
|
|
@@ -12919,7 +12648,7 @@ var useSelection4 = ({
|
|
|
12919
12648
|
singleSelect
|
|
12920
12649
|
]
|
|
12921
12650
|
);
|
|
12922
|
-
const handleKeyDown = (0,
|
|
12651
|
+
const handleKeyDown = (0, import_react84.useCallback)(
|
|
12923
12652
|
(evt) => {
|
|
12924
12653
|
if (~highlightedIdx && isSelectionEvent(evt)) {
|
|
12925
12654
|
evt.preventDefault();
|
|
@@ -12944,7 +12673,7 @@ var useSelection4 = ({
|
|
|
12944
12673
|
selectItemAtIndex
|
|
12945
12674
|
]
|
|
12946
12675
|
);
|
|
12947
|
-
const handleKeyboardNavigation = (0,
|
|
12676
|
+
const handleKeyboardNavigation = (0, import_react84.useCallback)(
|
|
12948
12677
|
(evt, currentIndex) => {
|
|
12949
12678
|
if (extendedSelect && evt.shiftKey) {
|
|
12950
12679
|
const item = treeNodes[currentIndex];
|
|
@@ -12957,7 +12686,7 @@ var useSelection4 = ({
|
|
|
12957
12686
|
onKeyDown: handleKeyDown,
|
|
12958
12687
|
onKeyboardNavigation: handleKeyboardNavigation
|
|
12959
12688
|
};
|
|
12960
|
-
const handleClick = (0,
|
|
12689
|
+
const handleClick = (0, import_react84.useCallback)(
|
|
12961
12690
|
(evt) => {
|
|
12962
12691
|
if (highlightedIdx !== -1) {
|
|
12963
12692
|
const item = treeNodes[highlightedIdx];
|
|
@@ -12991,14 +12720,14 @@ var useSelection4 = ({
|
|
|
12991
12720
|
};
|
|
12992
12721
|
|
|
12993
12722
|
// src/tree/use-viewport-tracking.ts
|
|
12994
|
-
var
|
|
12723
|
+
var import_react85 = require("react");
|
|
12995
12724
|
var HeightOnly4 = ["height", "scrollHeight"];
|
|
12996
12725
|
var useViewportTracking2 = (root, highlightedIdx, stickyHeaders = false) => {
|
|
12997
|
-
const scrollTop = (0,
|
|
12998
|
-
const scrolling = (0,
|
|
12999
|
-
const rootHeight = (0,
|
|
13000
|
-
const rootScrollHeight = (0,
|
|
13001
|
-
const scrollIntoView = (0,
|
|
12726
|
+
const scrollTop = (0, import_react85.useRef)(0);
|
|
12727
|
+
const scrolling = (0, import_react85.useRef)(false);
|
|
12728
|
+
const rootHeight = (0, import_react85.useRef)(0);
|
|
12729
|
+
const rootScrollHeight = (0, import_react85.useRef)(0);
|
|
12730
|
+
const scrollIntoView = (0, import_react85.useCallback)(
|
|
13002
12731
|
(el) => {
|
|
13003
12732
|
const targetEl = el.ariaExpanded ? el.firstChild : el;
|
|
13004
12733
|
const headerHeight = stickyHeaders ? 30 : 0;
|
|
@@ -13019,10 +12748,10 @@ var useViewportTracking2 = (root, highlightedIdx, stickyHeaders = false) => {
|
|
|
13019
12748
|
},
|
|
13020
12749
|
[root, stickyHeaders]
|
|
13021
12750
|
);
|
|
13022
|
-
const scrollHandler = (0,
|
|
12751
|
+
const scrollHandler = (0, import_react85.useCallback)((e) => {
|
|
13023
12752
|
scrollTop.current = e.target.scrollTop;
|
|
13024
12753
|
}, []);
|
|
13025
|
-
(0,
|
|
12754
|
+
(0, import_react85.useEffect)(() => {
|
|
13026
12755
|
const { current: rootEl } = root;
|
|
13027
12756
|
if (rootEl) {
|
|
13028
12757
|
rootEl.addEventListener("scroll", scrollHandler);
|
|
@@ -13033,7 +12762,7 @@ var useViewportTracking2 = (root, highlightedIdx, stickyHeaders = false) => {
|
|
|
13033
12762
|
}
|
|
13034
12763
|
};
|
|
13035
12764
|
}, [root, scrollHandler]);
|
|
13036
|
-
(0,
|
|
12765
|
+
(0, import_react85.useLayoutEffect)(() => {
|
|
13037
12766
|
if (highlightedIdx !== -1 && rootScrollHeight.current > rootHeight.current) {
|
|
13038
12767
|
if (root.current) {
|
|
13039
12768
|
const item = root.current.querySelector(`
|
|
@@ -13050,9 +12779,9 @@ var useViewportTracking2 = (root, highlightedIdx, stickyHeaders = false) => {
|
|
|
13050
12779
|
}
|
|
13051
12780
|
}
|
|
13052
12781
|
}, [highlightedIdx, root, scrollIntoView]);
|
|
13053
|
-
(0,
|
|
12782
|
+
(0, import_react85.useEffect)(() => {
|
|
13054
12783
|
}, [stickyHeaders]);
|
|
13055
|
-
const onResize = (0,
|
|
12784
|
+
const onResize = (0, import_react85.useCallback)(({ height, scrollHeight }) => {
|
|
13056
12785
|
rootHeight.current = height;
|
|
13057
12786
|
rootScrollHeight.current = scrollHeight;
|
|
13058
12787
|
}, []);
|
|
@@ -13061,10 +12790,10 @@ var useViewportTracking2 = (root, highlightedIdx, stickyHeaders = false) => {
|
|
|
13061
12790
|
};
|
|
13062
12791
|
|
|
13063
12792
|
// src/tree/useTree.ts
|
|
13064
|
-
var
|
|
12793
|
+
var import_react90 = require("react");
|
|
13065
12794
|
|
|
13066
12795
|
// src/tree/use-keyboard-navigation.ts
|
|
13067
|
-
var
|
|
12796
|
+
var import_react86 = require("react");
|
|
13068
12797
|
|
|
13069
12798
|
// src/tree/hierarchical-data-utils.ts
|
|
13070
12799
|
var getNodeParentPath = ({ id }) => {
|
|
@@ -13131,7 +12860,7 @@ var replaceNode = (nodes, id, props) => {
|
|
|
13131
12860
|
};
|
|
13132
12861
|
|
|
13133
12862
|
// src/tree/use-keyboard-navigation.ts
|
|
13134
|
-
var
|
|
12863
|
+
var import_core36 = require("@salt-ds/core");
|
|
13135
12864
|
|
|
13136
12865
|
// src/tree/key-code.ts
|
|
13137
12866
|
function union2(set1, ...sets) {
|
|
@@ -13214,26 +12943,26 @@ var useKeyboardNavigation4 = ({
|
|
|
13214
12943
|
onKeyboardNavigation,
|
|
13215
12944
|
selected = []
|
|
13216
12945
|
}) => {
|
|
13217
|
-
const { bwd: ArrowBwd, fwd: ArrowFwd } = (0,
|
|
12946
|
+
const { bwd: ArrowBwd, fwd: ArrowFwd } = (0, import_react86.useMemo)(
|
|
13218
12947
|
() => ({
|
|
13219
12948
|
bwd: ArrowUp4,
|
|
13220
12949
|
fwd: ArrowDown4
|
|
13221
12950
|
}),
|
|
13222
12951
|
[]
|
|
13223
12952
|
);
|
|
13224
|
-
const [highlightedIdx, setHighlightedIdx, isControlledHighlighting] = (0,
|
|
12953
|
+
const [highlightedIdx, setHighlightedIdx, isControlledHighlighting] = (0, import_core36.useControlled)({
|
|
13225
12954
|
controlled: highlightedIdxProp,
|
|
13226
12955
|
default: defaultHighlightedIdx,
|
|
13227
12956
|
name: "highlightedIdx"
|
|
13228
12957
|
});
|
|
13229
|
-
const setHighlightedIndex = (0,
|
|
12958
|
+
const setHighlightedIndex = (0, import_react86.useCallback)(
|
|
13230
12959
|
(idx) => {
|
|
13231
12960
|
onHighlight == null ? void 0 : onHighlight(idx);
|
|
13232
12961
|
setHighlightedIdx(idx);
|
|
13233
12962
|
},
|
|
13234
12963
|
[onHighlight, setHighlightedIdx]
|
|
13235
12964
|
);
|
|
13236
|
-
const nextFocusableItemIdx = (0,
|
|
12965
|
+
const nextFocusableItemIdx = (0, import_react86.useCallback)(
|
|
13237
12966
|
(key = ArrowFwd, idx = key === ArrowFwd ? -1 : treeNodes.length) => {
|
|
13238
12967
|
let nextIdx = nextItemIdx4(treeNodes.length, key, idx);
|
|
13239
12968
|
while (nextIdx !== -1 && (key === ArrowFwd && nextIdx < treeNodes.length || key === ArrowBwd && nextIdx > 0) && !isFocusable3(treeNodes[nextIdx])) {
|
|
@@ -13243,10 +12972,10 @@ var useKeyboardNavigation4 = ({
|
|
|
13243
12972
|
},
|
|
13244
12973
|
[ArrowBwd, ArrowFwd, treeNodes]
|
|
13245
12974
|
);
|
|
13246
|
-
const keyBoardNavigation = (0,
|
|
13247
|
-
const ignoreFocus = (0,
|
|
12975
|
+
const keyBoardNavigation = (0, import_react86.useRef)(true);
|
|
12976
|
+
const ignoreFocus = (0, import_react86.useRef)(false);
|
|
13248
12977
|
const setIgnoreFocus = (value) => ignoreFocus.current = value;
|
|
13249
|
-
const handleFocus = (0,
|
|
12978
|
+
const handleFocus = (0, import_react86.useCallback)(() => {
|
|
13250
12979
|
if (ignoreFocus.current) {
|
|
13251
12980
|
ignoreFocus.current = false;
|
|
13252
12981
|
} else if (selected.length > 0) {
|
|
@@ -13259,7 +12988,7 @@ var useKeyboardNavigation4 = ({
|
|
|
13259
12988
|
setHighlightedIndex(nextFocusableItemIdx());
|
|
13260
12989
|
}
|
|
13261
12990
|
}, [treeNodes, nextFocusableItemIdx, selected, setHighlightedIndex]);
|
|
13262
|
-
const navigateChildItems = (0,
|
|
12991
|
+
const navigateChildItems = (0, import_react86.useCallback)(
|
|
13263
12992
|
(e) => {
|
|
13264
12993
|
const nextIdx = nextFocusableItemIdx(e.key, highlightedIdx);
|
|
13265
12994
|
if (nextIdx !== highlightedIdx) {
|
|
@@ -13274,7 +13003,7 @@ var useKeyboardNavigation4 = ({
|
|
|
13274
13003
|
setHighlightedIndex
|
|
13275
13004
|
]
|
|
13276
13005
|
);
|
|
13277
|
-
const handleKeyDown = (0,
|
|
13006
|
+
const handleKeyDown = (0, import_react86.useCallback)(
|
|
13278
13007
|
(e) => {
|
|
13279
13008
|
if (treeNodes.length > 0 && isNavigationKey4(e, "vertical")) {
|
|
13280
13009
|
e.preventDefault();
|
|
@@ -13285,7 +13014,7 @@ var useKeyboardNavigation4 = ({
|
|
|
13285
13014
|
},
|
|
13286
13015
|
[treeNodes, navigateChildItems]
|
|
13287
13016
|
);
|
|
13288
|
-
const listProps = (0,
|
|
13017
|
+
const listProps = (0, import_react86.useMemo)(
|
|
13289
13018
|
() => ({
|
|
13290
13019
|
onBlur: () => {
|
|
13291
13020
|
setHighlightedIndex(-1);
|
|
@@ -13323,7 +13052,7 @@ var useKeyboardNavigation4 = ({
|
|
|
13323
13052
|
};
|
|
13324
13053
|
|
|
13325
13054
|
// src/tree/use-hierarchical-data.ts
|
|
13326
|
-
var
|
|
13055
|
+
var import_react87 = require("react");
|
|
13327
13056
|
var populateIndices = (nodes, results = [], idx = { value: 0 }) => {
|
|
13328
13057
|
let skipToNextHeader = false;
|
|
13329
13058
|
for (const node of nodes) {
|
|
@@ -13345,10 +13074,10 @@ var populateIndices = (nodes, results = [], idx = { value: 0 }) => {
|
|
|
13345
13074
|
return results;
|
|
13346
13075
|
};
|
|
13347
13076
|
var useHierarchicalData = (source) => {
|
|
13348
|
-
const externalSource = (0,
|
|
13349
|
-
const statefulSource = (0,
|
|
13350
|
-
const indexPositions = (0,
|
|
13351
|
-
const [, forceUpdate] = (0,
|
|
13077
|
+
const externalSource = (0, import_react87.useRef)(source);
|
|
13078
|
+
const statefulSource = (0, import_react87.useRef)(source);
|
|
13079
|
+
const indexPositions = (0, import_react87.useRef)(populateIndices(source));
|
|
13080
|
+
const [, forceUpdate] = (0, import_react87.useState)({});
|
|
13352
13081
|
if (source !== externalSource.current) {
|
|
13353
13082
|
externalSource.current = source;
|
|
13354
13083
|
statefulSource.current = source;
|
|
@@ -13368,7 +13097,7 @@ var useHierarchicalData = (source) => {
|
|
|
13368
13097
|
};
|
|
13369
13098
|
|
|
13370
13099
|
// src/tree/use-collapsible-groups.ts
|
|
13371
|
-
var
|
|
13100
|
+
var import_react88 = require("react");
|
|
13372
13101
|
var NO_HANDLERS4 = {};
|
|
13373
13102
|
var isToggleElement = (element) => element && element.hasAttribute("aria-expanded");
|
|
13374
13103
|
var useCollapsibleGroups2 = ({
|
|
@@ -13378,23 +13107,23 @@ var useCollapsibleGroups2 = ({
|
|
|
13378
13107
|
setVisibleData,
|
|
13379
13108
|
source
|
|
13380
13109
|
}) => {
|
|
13381
|
-
const fullSource = (0,
|
|
13382
|
-
const stateSource = (0,
|
|
13383
|
-
const setSource = (0,
|
|
13110
|
+
const fullSource = (0, import_react88.useRef)(source);
|
|
13111
|
+
const stateSource = (0, import_react88.useRef)(fullSource.current);
|
|
13112
|
+
const setSource = (0, import_react88.useCallback)(
|
|
13384
13113
|
(value) => {
|
|
13385
13114
|
setVisibleData(stateSource.current = value);
|
|
13386
13115
|
},
|
|
13387
13116
|
[setVisibleData]
|
|
13388
13117
|
);
|
|
13389
|
-
const expandNode = (0,
|
|
13118
|
+
const expandNode = (0, import_react88.useCallback)(
|
|
13390
13119
|
(nodeList, { id }) => replaceNode(nodeList, id, { expanded: true }),
|
|
13391
13120
|
[]
|
|
13392
13121
|
);
|
|
13393
|
-
const collapseNode = (0,
|
|
13122
|
+
const collapseNode = (0, import_react88.useCallback)(
|
|
13394
13123
|
(nodeList, { id }) => replaceNode(nodeList, id, { expanded: false }),
|
|
13395
13124
|
[]
|
|
13396
13125
|
);
|
|
13397
|
-
const handleKeyDown = (0,
|
|
13126
|
+
const handleKeyDown = (0, import_react88.useCallback)(
|
|
13398
13127
|
(e) => {
|
|
13399
13128
|
if (e.key === ArrowRight4 || e.key === Enter2) {
|
|
13400
13129
|
const node = treeNodes[highlightedIdx];
|
|
@@ -13420,7 +13149,7 @@ var useCollapsibleGroups2 = ({
|
|
|
13420
13149
|
const listHandlers = collapsibleHeaders ? {
|
|
13421
13150
|
onKeyDown: handleKeyDown
|
|
13422
13151
|
} : NO_HANDLERS4;
|
|
13423
|
-
const handleClick = (0,
|
|
13152
|
+
const handleClick = (0, import_react88.useCallback)(
|
|
13424
13153
|
(evt) => {
|
|
13425
13154
|
const el = closestListItem2(evt.target);
|
|
13426
13155
|
if (isToggleElement(el)) {
|
|
@@ -13446,14 +13175,14 @@ var useCollapsibleGroups2 = ({
|
|
|
13446
13175
|
};
|
|
13447
13176
|
|
|
13448
13177
|
// src/tree/use-tree-keyboard-navigation.ts
|
|
13449
|
-
var
|
|
13178
|
+
var import_react89 = require("react");
|
|
13450
13179
|
var useTreeKeyboardNavigation = ({
|
|
13451
13180
|
highlightedIdx,
|
|
13452
13181
|
hiliteItemAtIndex,
|
|
13453
13182
|
indexPositions,
|
|
13454
13183
|
source
|
|
13455
13184
|
}) => {
|
|
13456
|
-
const handleKeyDown = (0,
|
|
13185
|
+
const handleKeyDown = (0, import_react89.useCallback)(
|
|
13457
13186
|
(e) => {
|
|
13458
13187
|
if (e.key === ArrowLeft4) {
|
|
13459
13188
|
const node = indexPositions[highlightedIdx];
|
|
@@ -13490,7 +13219,7 @@ var useTree = ({
|
|
|
13490
13219
|
selected: selectedProp,
|
|
13491
13220
|
selection
|
|
13492
13221
|
}) => {
|
|
13493
|
-
const lastSelection = (0,
|
|
13222
|
+
const lastSelection = (0, import_react90.useRef)(EMPTY_ARRAY2);
|
|
13494
13223
|
const dataHook = useHierarchicalData(sourceWithIds);
|
|
13495
13224
|
const handleKeyboardNavigation = (evt, nextIdx) => {
|
|
13496
13225
|
var _a2, _b;
|
|
@@ -13523,7 +13252,7 @@ var useTree = ({
|
|
|
13523
13252
|
hiliteItemAtIndex: keyboardHook.hiliteItemAtIndex,
|
|
13524
13253
|
indexPositions: dataHook.indexPositions
|
|
13525
13254
|
});
|
|
13526
|
-
const handleClick = (0,
|
|
13255
|
+
const handleClick = (0, import_react90.useCallback)(
|
|
13527
13256
|
(evt) => {
|
|
13528
13257
|
var _a2, _b, _c;
|
|
13529
13258
|
(_a2 = collapsibleHook.listItemHandlers) == null ? void 0 : _a2.onClick(evt);
|
|
@@ -13533,7 +13262,7 @@ var useTree = ({
|
|
|
13533
13262
|
},
|
|
13534
13263
|
[collapsibleHook, selectionHook]
|
|
13535
13264
|
);
|
|
13536
|
-
const handleKeyDown = (0,
|
|
13265
|
+
const handleKeyDown = (0, import_react90.useCallback)(
|
|
13537
13266
|
(evt) => {
|
|
13538
13267
|
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
13539
13268
|
(_b = (_a2 = keyboardHook.listProps).onKeyDown) == null ? void 0 : _b.call(_a2, evt);
|
|
@@ -13583,14 +13312,14 @@ var useTree = ({
|
|
|
13583
13312
|
};
|
|
13584
13313
|
|
|
13585
13314
|
// src/tree/Tree.tsx
|
|
13586
|
-
var
|
|
13587
|
-
var
|
|
13588
|
-
var
|
|
13315
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
13316
|
+
var import_react92 = require("react");
|
|
13317
|
+
var classBase30 = "vuuTree";
|
|
13589
13318
|
var isExpanded = (node) => node.expanded === true;
|
|
13590
13319
|
var TreeNode = ({ children, idx, ...props }) => {
|
|
13591
|
-
return /* @__PURE__ */ (0,
|
|
13320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("li", { ...props, children });
|
|
13592
13321
|
};
|
|
13593
|
-
var Tree = (0,
|
|
13322
|
+
var Tree = (0, import_react91.forwardRef)(function Tree2({
|
|
13594
13323
|
allowDragDrop,
|
|
13595
13324
|
className,
|
|
13596
13325
|
defaultSelected,
|
|
@@ -13605,8 +13334,8 @@ var Tree = (0, import_react98.forwardRef)(function Tree2({
|
|
|
13605
13334
|
...htmlAttributes
|
|
13606
13335
|
}, forwardedRef) {
|
|
13607
13336
|
var _a2;
|
|
13608
|
-
const id = (0,
|
|
13609
|
-
const rootRef = (0,
|
|
13337
|
+
const id = (0, import_core37.useIdMemo)(idProp);
|
|
13338
|
+
const rootRef = (0, import_react91.useRef)(null);
|
|
13610
13339
|
const [, sourceWithIds, sourceItemById] = useItemsWithIds(source, id, {
|
|
13611
13340
|
revealSelected: revealSelected ? (_a2 = selectedProp != null ? selectedProp : defaultSelected) != null ? _a2 : false : void 0
|
|
13612
13341
|
});
|
|
@@ -13649,14 +13378,14 @@ var Tree = (0, import_react98.forwardRef)(function Tree2({
|
|
|
13649
13378
|
const allowGroupSelect = groupSelectionEnabled2(groupSelection);
|
|
13650
13379
|
function addLeafNode(list, item, idx) {
|
|
13651
13380
|
list.push(
|
|
13652
|
-
/* @__PURE__ */ (0,
|
|
13381
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
13653
13382
|
TreeNode,
|
|
13654
13383
|
{
|
|
13655
13384
|
...propsCommonToAllListItems,
|
|
13656
13385
|
...getListItemProps(item, idx, highlightedIdx, selected, focusVisible),
|
|
13657
13386
|
children: [
|
|
13658
|
-
item.icon ? /* @__PURE__ */ (0,
|
|
13659
|
-
/* @__PURE__ */ (0,
|
|
13387
|
+
item.icon ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: `${classBase30}Node-icon`, "data-icon": item.icon }) : null,
|
|
13388
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { children: item.label })
|
|
13660
13389
|
]
|
|
13661
13390
|
}
|
|
13662
13391
|
)
|
|
@@ -13667,16 +13396,16 @@ var Tree = (0, import_react98.forwardRef)(function Tree2({
|
|
|
13667
13396
|
const { value: i } = idx;
|
|
13668
13397
|
idx.value += 1;
|
|
13669
13398
|
list.push(
|
|
13670
|
-
/* @__PURE__ */ (0,
|
|
13399
|
+
/* @__PURE__ */ (0, import_react92.createElement)(
|
|
13671
13400
|
TreeNode,
|
|
13672
13401
|
{
|
|
13673
13402
|
...listItemHandlers,
|
|
13674
13403
|
"aria-expanded": child.expanded,
|
|
13675
13404
|
"aria-level": child.level,
|
|
13676
13405
|
"aria-selected": selected.includes(id2) || void 0,
|
|
13677
|
-
className: (0,
|
|
13406
|
+
className: (0, import_clsx35.default)(`${classBase30}Node`, {
|
|
13678
13407
|
focusVisible: focusVisible === i,
|
|
13679
|
-
[`${
|
|
13408
|
+
[`${classBase30}Node-toggle`]: !allowGroupSelect
|
|
13680
13409
|
}),
|
|
13681
13410
|
"data-idx": i,
|
|
13682
13411
|
"data-highlighted": i === highlightedIdx || void 0,
|
|
@@ -13684,20 +13413,20 @@ var Tree = (0, import_react98.forwardRef)(function Tree2({
|
|
|
13684
13413
|
id: id2,
|
|
13685
13414
|
key: `header-${i}`
|
|
13686
13415
|
},
|
|
13687
|
-
allowGroupSelect ? /* @__PURE__ */ (0,
|
|
13688
|
-
/* @__PURE__ */ (0,
|
|
13416
|
+
allowGroupSelect ? /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: `${classBase30}Node-label`, children: [
|
|
13417
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: `${classBase30}Node-toggle` }),
|
|
13689
13418
|
title
|
|
13690
|
-
] }) : /* @__PURE__ */ (0,
|
|
13691
|
-
child.icon ? /* @__PURE__ */ (0,
|
|
13419
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: `${classBase30}Node-label`, children: [
|
|
13420
|
+
child.icon ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
13692
13421
|
"span",
|
|
13693
13422
|
{
|
|
13694
|
-
className: `${
|
|
13423
|
+
className: `${classBase30}Node-icon`,
|
|
13695
13424
|
"data-icon": child.icon
|
|
13696
13425
|
}
|
|
13697
13426
|
) : null,
|
|
13698
|
-
/* @__PURE__ */ (0,
|
|
13427
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { children: title })
|
|
13699
13428
|
] }),
|
|
13700
|
-
/* @__PURE__ */ (0,
|
|
13429
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("ul", { role: "group", children: isExpanded(child) ? renderSourceContent(child.childNodes, idx) : "" })
|
|
13701
13430
|
)
|
|
13702
13431
|
);
|
|
13703
13432
|
}
|
|
@@ -13714,14 +13443,14 @@ var Tree = (0, import_react98.forwardRef)(function Tree2({
|
|
|
13714
13443
|
return listItems;
|
|
13715
13444
|
}
|
|
13716
13445
|
}
|
|
13717
|
-
return /* @__PURE__ */ (0,
|
|
13446
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
13718
13447
|
"ul",
|
|
13719
13448
|
{
|
|
13720
13449
|
...htmlAttributes,
|
|
13721
13450
|
...listProps,
|
|
13722
|
-
className: (0,
|
|
13451
|
+
className: (0, import_clsx35.default)(classBase30, className),
|
|
13723
13452
|
id: `Tree-${id}`,
|
|
13724
|
-
ref: (0,
|
|
13453
|
+
ref: (0, import_core37.useForkRef)(rootRef, forwardedRef),
|
|
13725
13454
|
role: "tree",
|
|
13726
13455
|
tabIndex: 0,
|
|
13727
13456
|
children: renderSourceContent(visibleData)
|
|
@@ -13735,7 +13464,7 @@ var getListItemProps = (item, idx, highlightedIdx, selected, focusVisible, class
|
|
|
13735
13464
|
"aria-selected": selected.includes(item.id) || void 0,
|
|
13736
13465
|
"data-idx": idx.value,
|
|
13737
13466
|
"data-highlighted": idx.value === highlightedIdx || void 0,
|
|
13738
|
-
className: (0,
|
|
13467
|
+
className: (0, import_clsx35.default)("vuuTreeNode", className, {
|
|
13739
13468
|
focusVisible: focusVisible === idx.value
|
|
13740
13469
|
})
|
|
13741
13470
|
});
|