@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/esm/index.js
CHANGED
|
@@ -743,10 +743,6 @@ function useResizeObserver(ref, dimensions2, onResize, reportInitialSize = false
|
|
|
743
743
|
}
|
|
744
744
|
if (target) {
|
|
745
745
|
if (observedMap.has(target)) {
|
|
746
|
-
console.log(
|
|
747
|
-
"useResizeObserver attemping to observe same element twice",
|
|
748
|
-
{ target }
|
|
749
|
-
);
|
|
750
746
|
}
|
|
751
747
|
registerObserver();
|
|
752
748
|
}
|
|
@@ -887,9 +883,6 @@ var useDropdownBase = ({
|
|
|
887
883
|
var _a2;
|
|
888
884
|
const justFocused = useRef6(null);
|
|
889
885
|
const popperRef = useRef6(null);
|
|
890
|
-
const popperCallbackRef = useCallback5((element) => {
|
|
891
|
-
popperRef.current = element;
|
|
892
|
-
}, []);
|
|
893
886
|
const [isOpen, setIsOpen] = useControlled2({
|
|
894
887
|
controlled: isOpenProp,
|
|
895
888
|
default: Boolean(defaultIsOpen),
|
|
@@ -905,11 +898,45 @@ var useDropdownBase = ({
|
|
|
905
898
|
}, [onOpenChange, setIsOpen]);
|
|
906
899
|
const hideDropdown = useCallback5(
|
|
907
900
|
(reason) => {
|
|
901
|
+
console.log(`hide dropdown ${reason}`);
|
|
908
902
|
setIsOpen(false);
|
|
909
903
|
onOpenChange == null ? void 0 : onOpenChange(false, reason);
|
|
910
904
|
},
|
|
911
905
|
[onOpenChange, setIsOpen]
|
|
912
906
|
);
|
|
907
|
+
const handleComponentFocusOut = useCallback5(
|
|
908
|
+
(evt) => {
|
|
909
|
+
var _a3;
|
|
910
|
+
const target = evt.relatedTarget;
|
|
911
|
+
if (target === null) {
|
|
912
|
+
requestAnimationFrame(() => {
|
|
913
|
+
var _a4;
|
|
914
|
+
if (!((_a4 = popperRef.current) == null ? void 0 : _a4.contains(document.activeElement))) {
|
|
915
|
+
hideDropdown("Tab");
|
|
916
|
+
}
|
|
917
|
+
});
|
|
918
|
+
} else if (!((_a3 = popperRef.current) == null ? void 0 : _a3.contains(target))) {
|
|
919
|
+
if (!targetWithinSubPopup(popperRef.current, target)) {
|
|
920
|
+
hideDropdown("Tab");
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
},
|
|
924
|
+
[hideDropdown]
|
|
925
|
+
);
|
|
926
|
+
const popperCallbackRef = useCallback5(
|
|
927
|
+
(element) => {
|
|
928
|
+
if (element) {
|
|
929
|
+
element.addEventListener("focusout", handleComponentFocusOut);
|
|
930
|
+
} else if (popperRef.current) {
|
|
931
|
+
popperRef.current.removeEventListener(
|
|
932
|
+
"focusout",
|
|
933
|
+
handleComponentFocusOut
|
|
934
|
+
);
|
|
935
|
+
}
|
|
936
|
+
popperRef.current = element;
|
|
937
|
+
},
|
|
938
|
+
[handleComponentFocusOut]
|
|
939
|
+
);
|
|
913
940
|
useClickAway({
|
|
914
941
|
popperRef,
|
|
915
942
|
rootRef,
|
|
@@ -2547,9 +2574,9 @@ var getNonWrappedAndWrappedItems = (container, orientation) => {
|
|
|
2547
2574
|
}
|
|
2548
2575
|
return [nonWrappedItems, wrappedItems];
|
|
2549
2576
|
};
|
|
2550
|
-
var applyOverflowClassToWrappedItems = (container, overflowedItems,
|
|
2577
|
+
var applyOverflowClassToWrappedItems = (container, overflowedItems, classBase31) => {
|
|
2551
2578
|
let ignoreOverflow = false;
|
|
2552
|
-
const className =
|
|
2579
|
+
const className = classBase31 ? `${classBase31}-overflowed` : "overflow";
|
|
2553
2580
|
if (overflowedItems.find(({ index }) => index === "overflow")) {
|
|
2554
2581
|
if (overflowedItems.length === 1) {
|
|
2555
2582
|
ignoreOverflow = true;
|
|
@@ -9134,7 +9161,8 @@ var useCombobox = ({
|
|
|
9134
9161
|
const handleInputKeyDown = useCallback33(
|
|
9135
9162
|
(e) => {
|
|
9136
9163
|
var _a3, _b;
|
|
9137
|
-
if (e.key === "Enter" && value !== void 0 && value !== "" && allowEnterCommitsText
|
|
9164
|
+
if (e.key === "Enter" && value !== void 0 && value !== "" && // TODO this whole allowEnterCommitsText isquestionable
|
|
9165
|
+
allowEnterCommitsText) {
|
|
9138
9166
|
setIsOpen(false);
|
|
9139
9167
|
}
|
|
9140
9168
|
(_b = (_a3 = InputProps4.inputProps) == null ? void 0 : _a3.onKeyDown) == null ? void 0 : _b.call(_a3, e);
|
|
@@ -9244,7 +9272,9 @@ var useCombobox = ({
|
|
|
9244
9272
|
};
|
|
9245
9273
|
|
|
9246
9274
|
// src/combo-box/ComboBox.tsx
|
|
9275
|
+
import cx13 from "clsx";
|
|
9247
9276
|
import { jsx as jsx25, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
9277
|
+
var classBase11 = "vuuCombobox";
|
|
9248
9278
|
var ComboBox = forwardRef16(function Combobox({
|
|
9249
9279
|
InputProps: InputPropsProp,
|
|
9250
9280
|
ListProps: ListProps3,
|
|
@@ -9255,6 +9285,7 @@ var ComboBox = forwardRef16(function Combobox({
|
|
|
9255
9285
|
allowEnterCommitsText,
|
|
9256
9286
|
allowFreeText,
|
|
9257
9287
|
children,
|
|
9288
|
+
className,
|
|
9258
9289
|
defaultIsOpen,
|
|
9259
9290
|
defaultSelected,
|
|
9260
9291
|
defaultValue,
|
|
@@ -9368,6 +9399,7 @@ var ComboBox = forwardRef16(function Combobox({
|
|
|
9368
9399
|
{
|
|
9369
9400
|
...props,
|
|
9370
9401
|
PopupProps,
|
|
9402
|
+
className: cx13(classBase11, className),
|
|
9371
9403
|
id,
|
|
9372
9404
|
isOpen: isOpen && collectionHook.data.length > 0,
|
|
9373
9405
|
onOpenChange,
|
|
@@ -9408,12 +9440,12 @@ var ComboBox = forwardRef16(function Combobox({
|
|
|
9408
9440
|
|
|
9409
9441
|
// src/cycle-state-button/CycleStateButton.tsx
|
|
9410
9442
|
import { Button as Button3 } from "@salt-ds/core";
|
|
9411
|
-
import
|
|
9443
|
+
import cx14 from "clsx";
|
|
9412
9444
|
import { forwardRef as forwardRef17, useCallback as useCallback35 } from "react";
|
|
9413
9445
|
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
9414
|
-
var
|
|
9446
|
+
var classBase12 = "vuuCycleStateButton";
|
|
9415
9447
|
var getNextValue = (value, valueList) => {
|
|
9416
|
-
const index = valueList.indexOf(value.toUpperCase());
|
|
9448
|
+
const index = valueList.map((v) => v.toUpperCase()).indexOf(value.toUpperCase());
|
|
9417
9449
|
if (index === valueList.length - 1) {
|
|
9418
9450
|
return valueList[0];
|
|
9419
9451
|
} else {
|
|
@@ -9422,6 +9454,7 @@ var getNextValue = (value, valueList) => {
|
|
|
9422
9454
|
};
|
|
9423
9455
|
var CycleStateButton = forwardRef17(function CycleStateButton2({
|
|
9424
9456
|
className,
|
|
9457
|
+
onChange,
|
|
9425
9458
|
onCommit,
|
|
9426
9459
|
value = "",
|
|
9427
9460
|
values,
|
|
@@ -9430,22 +9463,23 @@ var CycleStateButton = forwardRef17(function CycleStateButton2({
|
|
|
9430
9463
|
const handleClick = useCallback35(
|
|
9431
9464
|
(evt) => {
|
|
9432
9465
|
const nextValue = getNextValue(value, values);
|
|
9433
|
-
|
|
9466
|
+
onChange == null ? void 0 : onChange(nextValue);
|
|
9467
|
+
onCommit == null ? void 0 : onCommit(evt, nextValue).then((response) => {
|
|
9434
9468
|
if (response !== true) {
|
|
9435
9469
|
console.error(response);
|
|
9436
9470
|
}
|
|
9437
9471
|
});
|
|
9438
9472
|
},
|
|
9439
|
-
[onCommit, value, values]
|
|
9473
|
+
[onChange, onCommit, value, values]
|
|
9440
9474
|
);
|
|
9441
9475
|
return /* @__PURE__ */ jsx26(
|
|
9442
9476
|
Button3,
|
|
9443
9477
|
{
|
|
9444
9478
|
...buttonProps,
|
|
9445
|
-
className:
|
|
9446
|
-
|
|
9479
|
+
className: cx14(
|
|
9480
|
+
classBase12,
|
|
9447
9481
|
className,
|
|
9448
|
-
`${
|
|
9482
|
+
`${classBase12}-${value.toLowerCase()}`
|
|
9449
9483
|
),
|
|
9450
9484
|
onClick: handleClick,
|
|
9451
9485
|
ref: forwardedRef,
|
|
@@ -9464,7 +9498,7 @@ import {
|
|
|
9464
9498
|
|
|
9465
9499
|
// src/date-popup/DatePopup.tsx
|
|
9466
9500
|
import { useForkRef as useForkRef8 } from "@salt-ds/core";
|
|
9467
|
-
import
|
|
9501
|
+
import cx15 from "clsx";
|
|
9468
9502
|
import { forwardRef as forwardRef18 } from "react";
|
|
9469
9503
|
|
|
9470
9504
|
// src/date-popup/useDatePopup.ts
|
|
@@ -9544,7 +9578,7 @@ var useDatePopup = ({
|
|
|
9544
9578
|
|
|
9545
9579
|
// src/date-popup/DatePopup.tsx
|
|
9546
9580
|
import { jsx as jsx27, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
9547
|
-
var
|
|
9581
|
+
var classBase13 = "vuuDatePopup";
|
|
9548
9582
|
var tz = $14e0f24ef4ac5c92$export$aa8b41735afcabd2();
|
|
9549
9583
|
var today = $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3(tz);
|
|
9550
9584
|
var DatePopup = forwardRef18(
|
|
@@ -9577,7 +9611,7 @@ var DatePopup = forwardRef18(
|
|
|
9577
9611
|
DropdownBase,
|
|
9578
9612
|
{
|
|
9579
9613
|
...htmlAttributes,
|
|
9580
|
-
className:
|
|
9614
|
+
className: classBase13,
|
|
9581
9615
|
isOpen,
|
|
9582
9616
|
placement: "below",
|
|
9583
9617
|
onOpenChange: handleOpenChange,
|
|
@@ -9589,7 +9623,7 @@ var DatePopup = forwardRef18(
|
|
|
9589
9623
|
icon: "date",
|
|
9590
9624
|
ref: useForkRef8(forwardedRef, triggererRef),
|
|
9591
9625
|
variant: "secondary",
|
|
9592
|
-
className:
|
|
9626
|
+
className: cx15({ "saltButton-active": isOpen })
|
|
9593
9627
|
}
|
|
9594
9628
|
),
|
|
9595
9629
|
/* @__PURE__ */ jsx27(
|
|
@@ -9601,7 +9635,7 @@ var DatePopup = forwardRef18(
|
|
|
9601
9635
|
selectionVariant: "default",
|
|
9602
9636
|
onSelectedDateChange,
|
|
9603
9637
|
onVisibleMonthChange,
|
|
9604
|
-
className: `${
|
|
9638
|
+
className: `${classBase13}-calendar`
|
|
9605
9639
|
}
|
|
9606
9640
|
)
|
|
9607
9641
|
]
|
|
@@ -9628,8 +9662,9 @@ function useDatePicker({ onBlur }) {
|
|
|
9628
9662
|
|
|
9629
9663
|
// src/date-input/DateInput.tsx
|
|
9630
9664
|
import { jsx as jsx28, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
9631
|
-
var
|
|
9665
|
+
var classBase14 = "vuuDateInput";
|
|
9632
9666
|
var DateInput = ({
|
|
9667
|
+
inputProps,
|
|
9633
9668
|
selectedDate,
|
|
9634
9669
|
onChange,
|
|
9635
9670
|
onBlur,
|
|
@@ -9645,31 +9680,37 @@ var DateInput = ({
|
|
|
9645
9680
|
if (v === "")
|
|
9646
9681
|
return;
|
|
9647
9682
|
else
|
|
9648
|
-
onChange(toCalendarDate(new Date(v)));
|
|
9683
|
+
onChange(toCalendarDate(new Date(v)), "input");
|
|
9649
9684
|
},
|
|
9650
9685
|
[onChange]
|
|
9651
9686
|
);
|
|
9652
9687
|
const onKeyDown = useCallback38((e) => {
|
|
9653
9688
|
if (e.key === "Tab" && !e.shiftKey) {
|
|
9654
|
-
console.log({ button: popupRef.current });
|
|
9655
9689
|
requestAnimationFrame(() => {
|
|
9656
9690
|
var _a3;
|
|
9657
9691
|
(_a3 = popupRef.current) == null ? void 0 : _a3.focus();
|
|
9658
9692
|
});
|
|
9659
9693
|
}
|
|
9660
9694
|
}, []);
|
|
9695
|
+
const onChangeCalendar = useCallback38(
|
|
9696
|
+
(date) => {
|
|
9697
|
+
onChange(date, "calendar");
|
|
9698
|
+
},
|
|
9699
|
+
[onChange]
|
|
9700
|
+
);
|
|
9661
9701
|
return /* @__PURE__ */ jsxs12(
|
|
9662
9702
|
"div",
|
|
9663
9703
|
{
|
|
9664
9704
|
...htmlAttributes,
|
|
9665
|
-
className: clsx7(
|
|
9705
|
+
className: clsx7(classBase14, className),
|
|
9666
9706
|
onBlur: handleOnBlur,
|
|
9667
9707
|
children: [
|
|
9668
9708
|
/* @__PURE__ */ jsx28(
|
|
9669
9709
|
"input",
|
|
9670
9710
|
{
|
|
9711
|
+
...inputProps,
|
|
9671
9712
|
"aria-label": "date-input",
|
|
9672
|
-
className: clsx7("saltInput-input",
|
|
9713
|
+
className: clsx7("saltInput-input", classBase14),
|
|
9673
9714
|
type: "date",
|
|
9674
9715
|
value: (_a2 = selectedDate == null ? void 0 : selectedDate.toString()) != null ? _a2 : "",
|
|
9675
9716
|
onChange: onInputChange,
|
|
@@ -9682,7 +9723,7 @@ var DateInput = ({
|
|
|
9682
9723
|
{
|
|
9683
9724
|
"data-embedded": true,
|
|
9684
9725
|
onBlur,
|
|
9685
|
-
onChange,
|
|
9726
|
+
onChange: onChangeCalendar,
|
|
9686
9727
|
ref: popupRef,
|
|
9687
9728
|
selectedDate,
|
|
9688
9729
|
selectionVariant: "default"
|
|
@@ -9695,10 +9736,10 @@ var DateInput = ({
|
|
|
9695
9736
|
|
|
9696
9737
|
// src/date-input/DateRangeInput.tsx
|
|
9697
9738
|
import { toCalendarDate as toCalendarDate2 } from "@vuu-ui/vuu-utils";
|
|
9698
|
-
import
|
|
9739
|
+
import cx16 from "clsx";
|
|
9699
9740
|
import { useCallback as useCallback39 } from "react";
|
|
9700
9741
|
import { jsx as jsx29, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
9701
|
-
var
|
|
9742
|
+
var classBase15 = "vuuDateInput";
|
|
9702
9743
|
var DateRangeInput = ({
|
|
9703
9744
|
selectedDateRange,
|
|
9704
9745
|
onChange,
|
|
@@ -9725,13 +9766,13 @@ var DateRangeInput = ({
|
|
|
9725
9766
|
return /* @__PURE__ */ jsxs13(
|
|
9726
9767
|
"div",
|
|
9727
9768
|
{
|
|
9728
|
-
className:
|
|
9769
|
+
className: cx16("saltInput saltInput-primary", classBase15, className),
|
|
9729
9770
|
onBlur: handleOnBlur,
|
|
9730
9771
|
children: [
|
|
9731
9772
|
/* @__PURE__ */ jsx29(
|
|
9732
9773
|
"input",
|
|
9733
9774
|
{
|
|
9734
|
-
className:
|
|
9775
|
+
className: cx16("saltInput-input", classBase15, className),
|
|
9735
9776
|
type: "date",
|
|
9736
9777
|
value: (_b = (_a2 = selectedDateRange == null ? void 0 : selectedDateRange["startDate"]) == null ? void 0 : _a2.toString()) != null ? _b : "",
|
|
9737
9778
|
onChange: getHandleInputChange("startDate"),
|
|
@@ -9743,7 +9784,7 @@ var DateRangeInput = ({
|
|
|
9743
9784
|
/* @__PURE__ */ jsx29(
|
|
9744
9785
|
"input",
|
|
9745
9786
|
{
|
|
9746
|
-
className:
|
|
9787
|
+
className: cx16("saltInput-input", classBase15, className),
|
|
9747
9788
|
type: "date",
|
|
9748
9789
|
value: (_d = (_c = selectedDateRange == null ? void 0 : selectedDateRange["endDate"]) == null ? void 0 : _c.toString()) != null ? _d : "",
|
|
9749
9790
|
onChange: getHandleInputChange("endDate"),
|
|
@@ -9765,324 +9806,6 @@ var DateRangeInput = ({
|
|
|
9765
9806
|
);
|
|
9766
9807
|
};
|
|
9767
9808
|
|
|
9768
|
-
// src/date-picker/DatePicker.tsx
|
|
9769
|
-
import { useCallback as useCallback43, useMemo as useMemo15 } from "react";
|
|
9770
|
-
import { clsx as clsx10 } from "clsx";
|
|
9771
|
-
|
|
9772
|
-
// src/date-picker/input/DatePickerInput.tsx
|
|
9773
|
-
import { useCallback as useCallback40 } from "react";
|
|
9774
|
-
import { toCalendarDate as toCalendarDate3 } from "@vuu-ui/vuu-utils";
|
|
9775
|
-
import { clsx as clsx8 } from "clsx";
|
|
9776
|
-
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
9777
|
-
var baseClass2 = "vuuDatePickerInput";
|
|
9778
|
-
var DatePickerInput = (props) => {
|
|
9779
|
-
var _a2;
|
|
9780
|
-
const { value, onChange, className } = props;
|
|
9781
|
-
const onInputChange = useCallback40(
|
|
9782
|
-
(e) => {
|
|
9783
|
-
const v = e.target.value;
|
|
9784
|
-
if (v === "")
|
|
9785
|
-
return;
|
|
9786
|
-
else
|
|
9787
|
-
onChange(toCalendarDate3(new Date(v)));
|
|
9788
|
-
},
|
|
9789
|
-
[onChange]
|
|
9790
|
-
);
|
|
9791
|
-
return /* @__PURE__ */ jsx30(
|
|
9792
|
-
"input",
|
|
9793
|
-
{
|
|
9794
|
-
className: clsx8("saltInput-input", baseClass2, className),
|
|
9795
|
-
type: "date",
|
|
9796
|
-
value: (_a2 = value == null ? void 0 : value.toString()) != null ? _a2 : "",
|
|
9797
|
-
onChange: onInputChange,
|
|
9798
|
-
"aria-label": "date-input",
|
|
9799
|
-
max: "9999-12-31"
|
|
9800
|
-
}
|
|
9801
|
-
);
|
|
9802
|
-
};
|
|
9803
|
-
|
|
9804
|
-
// src/date-picker/internal/CalendarIconButton.tsx
|
|
9805
|
-
import { Button as Button4 } from "@salt-ds/core";
|
|
9806
|
-
import { CalendarIcon } from "@salt-ds/icons";
|
|
9807
|
-
import { forwardRef as forwardRef19 } from "react";
|
|
9808
|
-
import clsx9 from "clsx";
|
|
9809
|
-
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
9810
|
-
var baseClass3 = "vuuDatePicker-calendarIconButton";
|
|
9811
|
-
var CalendarIconButton = forwardRef19(function CalendarIconButton2({ className, ...rest }, ref) {
|
|
9812
|
-
return /* @__PURE__ */ jsx31(
|
|
9813
|
-
Button4,
|
|
9814
|
-
{
|
|
9815
|
-
className: clsx9(baseClass3, className),
|
|
9816
|
-
variant: "secondary",
|
|
9817
|
-
"aria-label": "calendar-icon-button",
|
|
9818
|
-
ref,
|
|
9819
|
-
...rest,
|
|
9820
|
-
children: /* @__PURE__ */ jsx31(CalendarIcon, {})
|
|
9821
|
-
}
|
|
9822
|
-
);
|
|
9823
|
-
});
|
|
9824
|
-
|
|
9825
|
-
// src/date-picker/useBaseDatePicker.ts
|
|
9826
|
-
import { useCallback as useCallback41, useState as useState18 } from "react";
|
|
9827
|
-
function useBaseDatePicker(props) {
|
|
9828
|
-
var _a2;
|
|
9829
|
-
const { onBlur } = props;
|
|
9830
|
-
const [visibleMonth, setVisibleMonth] = useState18(
|
|
9831
|
-
props.variant === "default" ? props.selectedDate : (_a2 = props.selectedDate) == null ? void 0 : _a2.startDate
|
|
9832
|
-
);
|
|
9833
|
-
const handleOnBlur = useCallback41(
|
|
9834
|
-
(e) => {
|
|
9835
|
-
if (!e.currentTarget.contains(e.relatedTarget)) {
|
|
9836
|
-
onBlur == null ? void 0 : onBlur();
|
|
9837
|
-
}
|
|
9838
|
-
},
|
|
9839
|
-
[onBlur]
|
|
9840
|
-
);
|
|
9841
|
-
return {
|
|
9842
|
-
handleOnBlur,
|
|
9843
|
-
visibleMonth,
|
|
9844
|
-
handleVisibleMonthChange: setVisibleMonth
|
|
9845
|
-
};
|
|
9846
|
-
}
|
|
9847
|
-
|
|
9848
|
-
// src/date-picker/useBaseDatePickerDropdown.ts
|
|
9849
|
-
import { useCallback as useCallback42, useRef as useRef33, useState as useState19 } from "react";
|
|
9850
|
-
function useBaseDatePickerDropdown({
|
|
9851
|
-
onVisibleMonthChange,
|
|
9852
|
-
onSelectedDateChange,
|
|
9853
|
-
shouldCloseOnSelectionChange
|
|
9854
|
-
}) {
|
|
9855
|
-
const [isOpen, setIsOpen] = useState19(false);
|
|
9856
|
-
const triggererRef = useRef33(null);
|
|
9857
|
-
const handleDateSelection = useCallback42(
|
|
9858
|
-
(_, d) => {
|
|
9859
|
-
var _a2;
|
|
9860
|
-
onSelectedDateChange(d);
|
|
9861
|
-
if (shouldCloseOnSelectionChange(d))
|
|
9862
|
-
setIsOpen(false);
|
|
9863
|
-
(_a2 = triggererRef.current) == null ? void 0 : _a2.focus();
|
|
9864
|
-
},
|
|
9865
|
-
[onSelectedDateChange, shouldCloseOnSelectionChange]
|
|
9866
|
-
);
|
|
9867
|
-
const handleVisibleMonthChange = useCallback42(
|
|
9868
|
-
(_, d) => {
|
|
9869
|
-
var _a2;
|
|
9870
|
-
onVisibleMonthChange(d);
|
|
9871
|
-
(_a2 = triggererRef.current) == null ? void 0 : _a2.focus();
|
|
9872
|
-
},
|
|
9873
|
-
[onVisibleMonthChange]
|
|
9874
|
-
);
|
|
9875
|
-
return {
|
|
9876
|
-
isOpen,
|
|
9877
|
-
handleOpenChange: setIsOpen,
|
|
9878
|
-
triggererRef,
|
|
9879
|
-
handleVisibleMonthChange,
|
|
9880
|
-
handleDateSelection
|
|
9881
|
-
};
|
|
9882
|
-
}
|
|
9883
|
-
|
|
9884
|
-
// src/date-picker/DatePicker.tsx
|
|
9885
|
-
import { jsx as jsx32, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
9886
|
-
var baseClass4 = "vuuDatePicker";
|
|
9887
|
-
var DatePicker = (props) => {
|
|
9888
|
-
const { selectedDate, onSelectedDateChange, onBlur, className } = props;
|
|
9889
|
-
const { visibleMonth, handleVisibleMonthChange, handleOnBlur } = useBaseDatePicker({ variant: "default", selectedDate, onBlur });
|
|
9890
|
-
const handleInputChange = useCallback43(
|
|
9891
|
-
(d) => {
|
|
9892
|
-
onSelectedDateChange(d);
|
|
9893
|
-
handleVisibleMonthChange(d);
|
|
9894
|
-
},
|
|
9895
|
-
[onSelectedDateChange, handleVisibleMonthChange]
|
|
9896
|
-
);
|
|
9897
|
-
return /* @__PURE__ */ jsxs14(
|
|
9898
|
-
"div",
|
|
9899
|
-
{
|
|
9900
|
-
className: clsx10("saltInput saltInput-primary", baseClass4, className),
|
|
9901
|
-
onBlur: handleOnBlur,
|
|
9902
|
-
children: [
|
|
9903
|
-
/* @__PURE__ */ jsx32(DatePickerInput, { value: selectedDate, onChange: handleInputChange }),
|
|
9904
|
-
/* @__PURE__ */ jsx32(
|
|
9905
|
-
DatePickerDropdown,
|
|
9906
|
-
{
|
|
9907
|
-
visibleMonth,
|
|
9908
|
-
onVisibleMonthChange: handleVisibleMonthChange,
|
|
9909
|
-
...props
|
|
9910
|
-
}
|
|
9911
|
-
)
|
|
9912
|
-
]
|
|
9913
|
-
}
|
|
9914
|
-
);
|
|
9915
|
-
};
|
|
9916
|
-
var DatePickerDropdown = (props) => {
|
|
9917
|
-
const {
|
|
9918
|
-
closeOnSelection,
|
|
9919
|
-
onSelectedDateChange,
|
|
9920
|
-
onVisibleMonthChange,
|
|
9921
|
-
className,
|
|
9922
|
-
...rest
|
|
9923
|
-
} = props;
|
|
9924
|
-
const shouldCloseOnSelectionChange = useCallback43(
|
|
9925
|
-
() => !!closeOnSelection,
|
|
9926
|
-
[closeOnSelection]
|
|
9927
|
-
);
|
|
9928
|
-
const {
|
|
9929
|
-
triggererRef,
|
|
9930
|
-
isOpen,
|
|
9931
|
-
handleOpenChange,
|
|
9932
|
-
handleVisibleMonthChange,
|
|
9933
|
-
handleDateSelection
|
|
9934
|
-
} = useBaseDatePickerDropdown({
|
|
9935
|
-
onVisibleMonthChange,
|
|
9936
|
-
onSelectedDateChange,
|
|
9937
|
-
shouldCloseOnSelectionChange
|
|
9938
|
-
});
|
|
9939
|
-
const defaultSelectedDate = useMemo15(() => $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3($14e0f24ef4ac5c92$export$aa8b41735afcabd2()), []);
|
|
9940
|
-
return /* @__PURE__ */ jsxs14(
|
|
9941
|
-
DropdownBase,
|
|
9942
|
-
{
|
|
9943
|
-
placement: "below",
|
|
9944
|
-
isOpen,
|
|
9945
|
-
onOpenChange: handleOpenChange,
|
|
9946
|
-
className,
|
|
9947
|
-
children: [
|
|
9948
|
-
/* @__PURE__ */ jsx32(CalendarIconButton, { ref: triggererRef }),
|
|
9949
|
-
/* @__PURE__ */ jsx32(
|
|
9950
|
-
Calendar,
|
|
9951
|
-
{
|
|
9952
|
-
selectionVariant: "default",
|
|
9953
|
-
onVisibleMonthChange: handleVisibleMonthChange,
|
|
9954
|
-
onSelectedDateChange: handleDateSelection,
|
|
9955
|
-
defaultSelectedDate,
|
|
9956
|
-
className: `${baseClass4}-calendar`,
|
|
9957
|
-
...rest
|
|
9958
|
-
}
|
|
9959
|
-
)
|
|
9960
|
-
]
|
|
9961
|
-
}
|
|
9962
|
-
);
|
|
9963
|
-
};
|
|
9964
|
-
|
|
9965
|
-
// src/date-picker/DateRangePicker.tsx
|
|
9966
|
-
import { useCallback as useCallback45, useMemo as useMemo16 } from "react";
|
|
9967
|
-
import { clsx as clsx12 } from "clsx";
|
|
9968
|
-
|
|
9969
|
-
// src/date-picker/input/DateRangePickerInput.tsx
|
|
9970
|
-
import { useCallback as useCallback44 } from "react";
|
|
9971
|
-
import { clsx as clsx11 } from "clsx";
|
|
9972
|
-
import { jsx as jsx33, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
9973
|
-
var baseClass5 = "vuuDateRangePickerInput";
|
|
9974
|
-
var DateRangePickerInput = (props) => {
|
|
9975
|
-
const { value, onChange, className } = props;
|
|
9976
|
-
const getHandleInputChange = useCallback44(
|
|
9977
|
-
(k) => (d) => {
|
|
9978
|
-
onChange({ ...value, [k]: d });
|
|
9979
|
-
},
|
|
9980
|
-
[value, onChange]
|
|
9981
|
-
);
|
|
9982
|
-
return /* @__PURE__ */ jsxs15("div", { className: clsx11(baseClass5, className), children: [
|
|
9983
|
-
/* @__PURE__ */ jsx33(
|
|
9984
|
-
DatePickerInput,
|
|
9985
|
-
{
|
|
9986
|
-
value: value == null ? void 0 : value["startDate"],
|
|
9987
|
-
onChange: getHandleInputChange("startDate")
|
|
9988
|
-
}
|
|
9989
|
-
),
|
|
9990
|
-
/* @__PURE__ */ jsx33("span", { children: "\u2014" }),
|
|
9991
|
-
/* @__PURE__ */ jsx33(
|
|
9992
|
-
DatePickerInput,
|
|
9993
|
-
{
|
|
9994
|
-
value: value == null ? void 0 : value["endDate"],
|
|
9995
|
-
onChange: getHandleInputChange("endDate")
|
|
9996
|
-
}
|
|
9997
|
-
)
|
|
9998
|
-
] });
|
|
9999
|
-
};
|
|
10000
|
-
|
|
10001
|
-
// src/date-picker/DateRangePicker.tsx
|
|
10002
|
-
import { jsx as jsx34, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
10003
|
-
var baseClass6 = "vuuDatePicker";
|
|
10004
|
-
var DateRangePicker = (props) => {
|
|
10005
|
-
const { selectedDate, onSelectedDateChange, className, onBlur } = props;
|
|
10006
|
-
const { visibleMonth, handleVisibleMonthChange, handleOnBlur } = useBaseDatePicker({ variant: "range", selectedDate, onBlur });
|
|
10007
|
-
const handleInputChange = useCallback45(
|
|
10008
|
-
(r) => {
|
|
10009
|
-
var _a2;
|
|
10010
|
-
onSelectedDateChange(r);
|
|
10011
|
-
handleVisibleMonthChange((_a2 = r.endDate) != null ? _a2 : r.startDate);
|
|
10012
|
-
},
|
|
10013
|
-
[onSelectedDateChange, handleVisibleMonthChange]
|
|
10014
|
-
);
|
|
10015
|
-
return /* @__PURE__ */ jsxs16(
|
|
10016
|
-
"div",
|
|
10017
|
-
{
|
|
10018
|
-
className: clsx12("saltInput saltInput-primary", baseClass6, className),
|
|
10019
|
-
onBlur: handleOnBlur,
|
|
10020
|
-
children: [
|
|
10021
|
-
/* @__PURE__ */ jsx34(DateRangePickerInput, { value: selectedDate, onChange: handleInputChange }),
|
|
10022
|
-
/* @__PURE__ */ jsx34(
|
|
10023
|
-
DateRangePickerDropdown,
|
|
10024
|
-
{
|
|
10025
|
-
...props,
|
|
10026
|
-
visibleMonth,
|
|
10027
|
-
onVisibleMonthChange: handleVisibleMonthChange
|
|
10028
|
-
}
|
|
10029
|
-
)
|
|
10030
|
-
]
|
|
10031
|
-
}
|
|
10032
|
-
);
|
|
10033
|
-
};
|
|
10034
|
-
var DateRangePickerDropdown = (props) => {
|
|
10035
|
-
const {
|
|
10036
|
-
onVisibleMonthChange,
|
|
10037
|
-
onSelectedDateChange,
|
|
10038
|
-
closeOnSelection,
|
|
10039
|
-
className,
|
|
10040
|
-
...rest
|
|
10041
|
-
} = props;
|
|
10042
|
-
const shouldCloseOnSelectionChange = useCallback45(
|
|
10043
|
-
(r) => !!(closeOnSelection && r.endDate),
|
|
10044
|
-
[closeOnSelection]
|
|
10045
|
-
);
|
|
10046
|
-
const {
|
|
10047
|
-
triggererRef,
|
|
10048
|
-
isOpen,
|
|
10049
|
-
handleOpenChange,
|
|
10050
|
-
handleVisibleMonthChange,
|
|
10051
|
-
handleDateSelection
|
|
10052
|
-
} = useBaseDatePickerDropdown({
|
|
10053
|
-
onVisibleMonthChange,
|
|
10054
|
-
onSelectedDateChange,
|
|
10055
|
-
shouldCloseOnSelectionChange
|
|
10056
|
-
});
|
|
10057
|
-
const defaultSelectedDate = useMemo16(
|
|
10058
|
-
() => ({ startDate: $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3($14e0f24ef4ac5c92$export$aa8b41735afcabd2()) }),
|
|
10059
|
-
[]
|
|
10060
|
-
);
|
|
10061
|
-
return /* @__PURE__ */ jsxs16(
|
|
10062
|
-
DropdownBase,
|
|
10063
|
-
{
|
|
10064
|
-
placement: "below",
|
|
10065
|
-
isOpen,
|
|
10066
|
-
className,
|
|
10067
|
-
onOpenChange: handleOpenChange,
|
|
10068
|
-
children: [
|
|
10069
|
-
/* @__PURE__ */ jsx34(CalendarIconButton, { ref: triggererRef }),
|
|
10070
|
-
/* @__PURE__ */ jsx34(
|
|
10071
|
-
Calendar,
|
|
10072
|
-
{
|
|
10073
|
-
selectionVariant: "range",
|
|
10074
|
-
onVisibleMonthChange: handleVisibleMonthChange,
|
|
10075
|
-
onSelectedDateChange: handleDateSelection,
|
|
10076
|
-
defaultSelectedDate,
|
|
10077
|
-
className: `${baseClass6}-calendar`,
|
|
10078
|
-
...rest
|
|
10079
|
-
}
|
|
10080
|
-
)
|
|
10081
|
-
]
|
|
10082
|
-
}
|
|
10083
|
-
);
|
|
10084
|
-
};
|
|
10085
|
-
|
|
10086
9809
|
// src/editable/editable-utils.ts
|
|
10087
9810
|
import { getEditRuleValidator } from "@vuu-ui/vuu-utils";
|
|
10088
9811
|
var buildValidationChecker = (rules) => (value) => applyRules(rules, value);
|
|
@@ -10120,9 +9843,9 @@ function applyRules(rules, value) {
|
|
|
10120
9843
|
import { useLayoutEffectSkipFirst as useLayoutEffectSkipFirst4 } from "@vuu-ui/vuu-utils";
|
|
10121
9844
|
import { dispatchCustomEvent as dispatchCustomEvent3 } from "@vuu-ui/vuu-utils";
|
|
10122
9845
|
import {
|
|
10123
|
-
useCallback as
|
|
10124
|
-
useRef as
|
|
10125
|
-
useState as
|
|
9846
|
+
useCallback as useCallback40,
|
|
9847
|
+
useRef as useRef33,
|
|
9848
|
+
useState as useState18
|
|
10126
9849
|
} from "react";
|
|
10127
9850
|
var WarnCommit = () => {
|
|
10128
9851
|
console.warn(
|
|
@@ -10136,15 +9859,15 @@ var useEditableText = ({
|
|
|
10136
9859
|
onCommit,
|
|
10137
9860
|
type
|
|
10138
9861
|
}) => {
|
|
10139
|
-
const [message, setMessage] =
|
|
10140
|
-
const [value, setValue] =
|
|
10141
|
-
const initialValueRef =
|
|
10142
|
-
const isDirtyRef =
|
|
10143
|
-
const hasCommittedRef =
|
|
9862
|
+
const [message, setMessage] = useState18();
|
|
9863
|
+
const [value, setValue] = useState18(initialValue);
|
|
9864
|
+
const initialValueRef = useRef33(initialValue);
|
|
9865
|
+
const isDirtyRef = useRef33(false);
|
|
9866
|
+
const hasCommittedRef = useRef33(false);
|
|
10144
9867
|
useLayoutEffectSkipFirst4(() => {
|
|
10145
9868
|
setValue(initialValue);
|
|
10146
9869
|
}, [initialValue]);
|
|
10147
|
-
const commit =
|
|
9870
|
+
const commit = useCallback40(
|
|
10148
9871
|
(target) => {
|
|
10149
9872
|
if (isDirtyRef.current) {
|
|
10150
9873
|
hasCommittedRef.current = true;
|
|
@@ -10170,7 +9893,7 @@ var useEditableText = ({
|
|
|
10170
9893
|
},
|
|
10171
9894
|
[clientSideEditValidationCheck, onCommit, value]
|
|
10172
9895
|
);
|
|
10173
|
-
const handleKeyDown =
|
|
9896
|
+
const handleKeyDown = useCallback40(
|
|
10174
9897
|
(evt) => {
|
|
10175
9898
|
if (evt.key === "Enter") {
|
|
10176
9899
|
commit(evt.target);
|
|
@@ -10186,7 +9909,7 @@ var useEditableText = ({
|
|
|
10186
9909
|
},
|
|
10187
9910
|
[commit]
|
|
10188
9911
|
);
|
|
10189
|
-
const handleBlur =
|
|
9912
|
+
const handleBlur = useCallback40(
|
|
10190
9913
|
(evt) => {
|
|
10191
9914
|
if (isDirtyRef.current) {
|
|
10192
9915
|
commit(evt.target);
|
|
@@ -10194,7 +9917,7 @@ var useEditableText = ({
|
|
|
10194
9917
|
},
|
|
10195
9918
|
[commit]
|
|
10196
9919
|
);
|
|
10197
|
-
const handleChange =
|
|
9920
|
+
const handleChange = useCallback40(
|
|
10198
9921
|
(evt) => {
|
|
10199
9922
|
let typedValue = evt.target.value;
|
|
10200
9923
|
if (type === "number" && !isNaN(parseFloat(typedValue))) {
|
|
@@ -10223,20 +9946,25 @@ var useEditableText = ({
|
|
|
10223
9946
|
};
|
|
10224
9947
|
|
|
10225
9948
|
// src/editable-label/EditableLabel.tsx
|
|
10226
|
-
import
|
|
9949
|
+
import cx17 from "clsx";
|
|
10227
9950
|
import {
|
|
10228
|
-
useCallback as
|
|
9951
|
+
useCallback as useCallback41,
|
|
10229
9952
|
useLayoutEffect as useLayoutEffect3,
|
|
10230
|
-
forwardRef as
|
|
10231
|
-
useRef as
|
|
9953
|
+
forwardRef as forwardRef19,
|
|
9954
|
+
useRef as useRef34,
|
|
9955
|
+
useImperativeHandle as useImperativeHandle2
|
|
10232
9956
|
} from "react";
|
|
10233
9957
|
import { Input as Input2, useControlled as useControlled8 } from "@salt-ds/core";
|
|
10234
|
-
import { jsx as
|
|
10235
|
-
var
|
|
10236
|
-
var
|
|
9958
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
9959
|
+
var classBase16 = "vuuEditableLabel";
|
|
9960
|
+
var NullEditAPI = {
|
|
9961
|
+
beginEdit: () => void 0
|
|
9962
|
+
};
|
|
9963
|
+
var EditableLabel = forwardRef19(function EditableLabel2({
|
|
10237
9964
|
className: classNameProp,
|
|
10238
9965
|
defaultEditing,
|
|
10239
9966
|
defaultValue,
|
|
9967
|
+
editLabelApiRef,
|
|
10240
9968
|
editing: editingProp,
|
|
10241
9969
|
onChange,
|
|
10242
9970
|
onEnterEditMode,
|
|
@@ -10244,8 +9972,8 @@ var EditableLabel = forwardRef20(function EditableLabel2({
|
|
|
10244
9972
|
value: valueProp,
|
|
10245
9973
|
...restProps
|
|
10246
9974
|
}, forwardedRef) {
|
|
10247
|
-
const inputRef =
|
|
10248
|
-
const editingRef =
|
|
9975
|
+
const inputRef = useRef34(null);
|
|
9976
|
+
const editingRef = useRef34(false);
|
|
10249
9977
|
const [value, setValue] = useControlled8({
|
|
10250
9978
|
controlled: valueProp,
|
|
10251
9979
|
default: defaultValue != null ? defaultValue : "",
|
|
@@ -10258,13 +9986,13 @@ var EditableLabel = forwardRef20(function EditableLabel2({
|
|
|
10258
9986
|
name: "EditableLabel",
|
|
10259
9987
|
state: "editing"
|
|
10260
9988
|
});
|
|
10261
|
-
const setEditing =
|
|
9989
|
+
const setEditing = useCallback41(
|
|
10262
9990
|
(value2) => {
|
|
10263
9991
|
_setEditing(editingRef.current = value2);
|
|
10264
9992
|
},
|
|
10265
9993
|
[_setEditing]
|
|
10266
9994
|
);
|
|
10267
|
-
const initialValue =
|
|
9995
|
+
const initialValue = useRef34(value);
|
|
10268
9996
|
useLayoutEffect3(() => {
|
|
10269
9997
|
if (editing) {
|
|
10270
9998
|
if (inputRef.current !== null) {
|
|
@@ -10273,10 +10001,17 @@ var EditableLabel = forwardRef20(function EditableLabel2({
|
|
|
10273
10001
|
}
|
|
10274
10002
|
}
|
|
10275
10003
|
}, [editing, inputRef]);
|
|
10276
|
-
const
|
|
10004
|
+
const beginEdit = useCallback41(() => {
|
|
10277
10005
|
setEditing(true);
|
|
10278
|
-
onEnterEditMode
|
|
10006
|
+
onEnterEditMode == null ? void 0 : onEnterEditMode();
|
|
10279
10007
|
}, [onEnterEditMode, setEditing]);
|
|
10008
|
+
useImperativeHandle2(
|
|
10009
|
+
editLabelApiRef,
|
|
10010
|
+
() => ({
|
|
10011
|
+
beginEdit
|
|
10012
|
+
}),
|
|
10013
|
+
[beginEdit]
|
|
10014
|
+
);
|
|
10280
10015
|
const exitEditMode = ({
|
|
10281
10016
|
cancelEdit = false,
|
|
10282
10017
|
allowDeactivation = false
|
|
@@ -10297,9 +10032,6 @@ var EditableLabel = forwardRef20(function EditableLabel2({
|
|
|
10297
10032
|
setValue(value2);
|
|
10298
10033
|
onChange && onChange(value2);
|
|
10299
10034
|
};
|
|
10300
|
-
const handleDoubleClick = () => {
|
|
10301
|
-
enterEditMode();
|
|
10302
|
-
};
|
|
10303
10035
|
const handleBlur = () => {
|
|
10304
10036
|
if (editingRef.current) {
|
|
10305
10037
|
exitEditMode({ allowDeactivation: true });
|
|
@@ -10315,21 +10047,20 @@ var EditableLabel = forwardRef20(function EditableLabel2({
|
|
|
10315
10047
|
exitEditMode({ cancelEdit: true });
|
|
10316
10048
|
}
|
|
10317
10049
|
};
|
|
10318
|
-
const className =
|
|
10319
|
-
[`${
|
|
10050
|
+
const className = cx17(classBase16, classNameProp, {
|
|
10051
|
+
[`${classBase16}-editing`]: editing
|
|
10320
10052
|
});
|
|
10321
|
-
return /* @__PURE__ */
|
|
10053
|
+
return /* @__PURE__ */ jsx30(
|
|
10322
10054
|
"div",
|
|
10323
10055
|
{
|
|
10324
10056
|
...restProps,
|
|
10325
10057
|
className,
|
|
10326
|
-
onDoubleClick: handleDoubleClick,
|
|
10327
10058
|
"data-text": value,
|
|
10328
10059
|
ref: forwardedRef,
|
|
10329
|
-
children: editing ? /* @__PURE__ */
|
|
10060
|
+
children: editing ? /* @__PURE__ */ jsx30(
|
|
10330
10061
|
Input2,
|
|
10331
10062
|
{
|
|
10332
|
-
inputProps: { className: `${
|
|
10063
|
+
inputProps: { className: `${classBase16}-input`, spellCheck: false },
|
|
10333
10064
|
value,
|
|
10334
10065
|
onBlur: handleBlur,
|
|
10335
10066
|
onChange: handleChange,
|
|
@@ -10339,30 +10070,30 @@ var EditableLabel = forwardRef20(function EditableLabel2({
|
|
|
10339
10070
|
textAlign: "left",
|
|
10340
10071
|
variant: "secondary"
|
|
10341
10072
|
}
|
|
10342
|
-
) : /* @__PURE__ */
|
|
10073
|
+
) : /* @__PURE__ */ jsx30("span", { className: `${classBase16}-label`, children: value })
|
|
10343
10074
|
}
|
|
10344
10075
|
);
|
|
10345
10076
|
});
|
|
10346
10077
|
|
|
10347
10078
|
// src/expando-input/ExpandoInput.tsx
|
|
10348
|
-
import
|
|
10349
|
-
import { forwardRef as
|
|
10079
|
+
import cx19 from "clsx";
|
|
10080
|
+
import { forwardRef as forwardRef21 } from "react";
|
|
10350
10081
|
|
|
10351
10082
|
// src/vuu-input/VuuInput.tsx
|
|
10352
10083
|
import { Tooltip as Tooltip3, useTooltip } from "@vuu-ui/vuu-popups";
|
|
10353
10084
|
import { isValidNumber as isValidNumber4, useId as useId7 } from "@vuu-ui/vuu-utils";
|
|
10354
10085
|
import { Input as Input3 } from "@salt-ds/core";
|
|
10355
|
-
import
|
|
10086
|
+
import cx18 from "clsx";
|
|
10356
10087
|
import {
|
|
10357
|
-
forwardRef as
|
|
10358
|
-
useCallback as
|
|
10088
|
+
forwardRef as forwardRef20,
|
|
10089
|
+
useCallback as useCallback42
|
|
10359
10090
|
} from "react";
|
|
10360
|
-
import { Fragment as Fragment3, jsx as
|
|
10361
|
-
var
|
|
10091
|
+
import { Fragment as Fragment3, jsx as jsx31, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
10092
|
+
var classBase17 = "vuuInput";
|
|
10362
10093
|
var constantInputProps = {
|
|
10363
10094
|
autoComplete: "off"
|
|
10364
10095
|
};
|
|
10365
|
-
var VuuInput =
|
|
10096
|
+
var VuuInput = forwardRef20(function VuuInput2({
|
|
10366
10097
|
className,
|
|
10367
10098
|
errorMessage,
|
|
10368
10099
|
id: idProp,
|
|
@@ -10376,7 +10107,7 @@ var VuuInput = forwardRef21(function VuuInput2({
|
|
|
10376
10107
|
id,
|
|
10377
10108
|
tooltipContent: errorMessage
|
|
10378
10109
|
});
|
|
10379
|
-
const commitValue =
|
|
10110
|
+
const commitValue = useCallback42(
|
|
10380
10111
|
(evt, value) => {
|
|
10381
10112
|
if (type === "number") {
|
|
10382
10113
|
const numericValue = parseFloat(value);
|
|
@@ -10393,7 +10124,7 @@ var VuuInput = forwardRef21(function VuuInput2({
|
|
|
10393
10124
|
},
|
|
10394
10125
|
[onCommit, type]
|
|
10395
10126
|
);
|
|
10396
|
-
const handleKeyDown =
|
|
10127
|
+
const handleKeyDown = useCallback42(
|
|
10397
10128
|
(evt) => {
|
|
10398
10129
|
if (evt.key === "Enter") {
|
|
10399
10130
|
evt.preventDefault();
|
|
@@ -10405,23 +10136,23 @@ var VuuInput = forwardRef21(function VuuInput2({
|
|
|
10405
10136
|
},
|
|
10406
10137
|
[commitValue, onKeyDown]
|
|
10407
10138
|
);
|
|
10408
|
-
const handleBlur =
|
|
10139
|
+
const handleBlur = useCallback42(
|
|
10409
10140
|
(evt) => {
|
|
10410
10141
|
const { value } = evt.target;
|
|
10411
10142
|
commitValue(evt, value);
|
|
10412
10143
|
},
|
|
10413
10144
|
[commitValue]
|
|
10414
10145
|
);
|
|
10415
|
-
const endAdornment = errorMessage ? /* @__PURE__ */
|
|
10146
|
+
const endAdornment = errorMessage ? /* @__PURE__ */ jsx31(
|
|
10416
10147
|
"span",
|
|
10417
10148
|
{
|
|
10418
10149
|
...anchorProps,
|
|
10419
|
-
className: `${
|
|
10150
|
+
className: `${classBase17}-errorIcon`,
|
|
10420
10151
|
"data-icon": "error"
|
|
10421
10152
|
}
|
|
10422
10153
|
) : void 0;
|
|
10423
|
-
return /* @__PURE__ */
|
|
10424
|
-
/* @__PURE__ */
|
|
10154
|
+
return /* @__PURE__ */ jsxs14(Fragment3, { children: [
|
|
10155
|
+
/* @__PURE__ */ jsx31(
|
|
10425
10156
|
Input3,
|
|
10426
10157
|
{
|
|
10427
10158
|
...props,
|
|
@@ -10431,23 +10162,23 @@ var VuuInput = forwardRef21(function VuuInput2({
|
|
|
10431
10162
|
...constantInputProps,
|
|
10432
10163
|
...props.inputProps
|
|
10433
10164
|
},
|
|
10434
|
-
className:
|
|
10435
|
-
[`${
|
|
10165
|
+
className: cx18(classBase17, className, {
|
|
10166
|
+
[`${classBase17}-errror`]: errorMessage
|
|
10436
10167
|
}),
|
|
10437
10168
|
onBlur: handleBlur,
|
|
10438
10169
|
ref: forwardedRef,
|
|
10439
10170
|
onKeyDown: handleKeyDown
|
|
10440
10171
|
}
|
|
10441
10172
|
),
|
|
10442
|
-
tooltipProps ? /* @__PURE__ */
|
|
10173
|
+
tooltipProps ? /* @__PURE__ */ jsx31(Tooltip3, { ...tooltipProps, status: "error" }) : null
|
|
10443
10174
|
] });
|
|
10444
10175
|
});
|
|
10445
10176
|
|
|
10446
10177
|
// src/expando-input/ExpandoInput.tsx
|
|
10447
|
-
import { jsx as
|
|
10448
|
-
var
|
|
10178
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
10179
|
+
var classBase18 = "vuuExpandoInput";
|
|
10449
10180
|
var noop = () => void 0;
|
|
10450
|
-
var ExpandoInput =
|
|
10181
|
+
var ExpandoInput = forwardRef21(function ExpandoInput2({
|
|
10451
10182
|
className: classNameProp,
|
|
10452
10183
|
errorMessage,
|
|
10453
10184
|
value,
|
|
@@ -10455,19 +10186,19 @@ var ExpandoInput = forwardRef22(function ExpandoInput2({
|
|
|
10455
10186
|
onCommit = noop,
|
|
10456
10187
|
...props
|
|
10457
10188
|
}, forwardedRef) {
|
|
10458
|
-
return /* @__PURE__ */
|
|
10189
|
+
return /* @__PURE__ */ jsx32(
|
|
10459
10190
|
"div",
|
|
10460
10191
|
{
|
|
10461
|
-
className:
|
|
10462
|
-
[`${
|
|
10192
|
+
className: cx19(classBase18, classNameProp, {
|
|
10193
|
+
[`${classBase18}-error`]: errorMessage
|
|
10463
10194
|
}),
|
|
10464
10195
|
"data-text": value,
|
|
10465
|
-
children: /* @__PURE__ */
|
|
10196
|
+
children: /* @__PURE__ */ jsx32(
|
|
10466
10197
|
VuuInput,
|
|
10467
10198
|
{
|
|
10468
10199
|
...props,
|
|
10469
10200
|
errorMessage,
|
|
10470
|
-
inputProps: { ...inputProps, className: `${
|
|
10201
|
+
inputProps: { ...inputProps, className: `${classBase18}-input` },
|
|
10471
10202
|
onCommit,
|
|
10472
10203
|
ref: forwardedRef,
|
|
10473
10204
|
style: { padding: 0 },
|
|
@@ -10481,17 +10212,17 @@ var ExpandoInput = forwardRef22(function ExpandoInput2({
|
|
|
10481
10212
|
});
|
|
10482
10213
|
|
|
10483
10214
|
// src/inputs/Checkbox.tsx
|
|
10484
|
-
import { jsx as
|
|
10215
|
+
import { jsx as jsx33, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
10485
10216
|
var Checkbox = (props) => {
|
|
10486
10217
|
const { onToggle, checked, label } = props;
|
|
10487
|
-
return /* @__PURE__ */
|
|
10218
|
+
return /* @__PURE__ */ jsxs15(
|
|
10488
10219
|
"div",
|
|
10489
10220
|
{
|
|
10490
10221
|
className: "vuuCheckbox",
|
|
10491
10222
|
onClick: onToggle,
|
|
10492
10223
|
onKeyUp: (e) => e.key === " " && onToggle(),
|
|
10493
10224
|
children: [
|
|
10494
|
-
/* @__PURE__ */
|
|
10225
|
+
/* @__PURE__ */ jsx33(CheckboxIcon, { tabIndex: 0, checked }),
|
|
10495
10226
|
label
|
|
10496
10227
|
]
|
|
10497
10228
|
}
|
|
@@ -10499,13 +10230,13 @@ var Checkbox = (props) => {
|
|
|
10499
10230
|
};
|
|
10500
10231
|
|
|
10501
10232
|
// src/inputs/RadioButton.tsx
|
|
10502
|
-
import { jsx as
|
|
10233
|
+
import { jsx as jsx34, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
10503
10234
|
var RadioButton = (props) => {
|
|
10504
10235
|
const { onClick, checked, label, groupName } = props;
|
|
10505
|
-
return /* @__PURE__ */
|
|
10506
|
-
/* @__PURE__ */
|
|
10507
|
-
/* @__PURE__ */
|
|
10508
|
-
/* @__PURE__ */
|
|
10236
|
+
return /* @__PURE__ */ jsxs16("div", { className: "vuuRadioButton", onClick, children: [
|
|
10237
|
+
/* @__PURE__ */ jsxs16("div", { className: "radio", children: [
|
|
10238
|
+
/* @__PURE__ */ jsx34("input", { type: "radio", name: groupName }),
|
|
10239
|
+
/* @__PURE__ */ jsx34(RadioIcon, { checked })
|
|
10509
10240
|
] }),
|
|
10510
10241
|
label
|
|
10511
10242
|
] });
|
|
@@ -10515,12 +10246,12 @@ var RadioButton = (props) => {
|
|
|
10515
10246
|
import { Table } from "@vuu-ui/vuu-table";
|
|
10516
10247
|
import { useId as useId8 } from "@vuu-ui/vuu-utils";
|
|
10517
10248
|
import { Input as Input4 } from "@salt-ds/core";
|
|
10518
|
-
import { forwardRef as
|
|
10249
|
+
import { forwardRef as forwardRef22, useMemo as useMemo16 } from "react";
|
|
10519
10250
|
|
|
10520
10251
|
// src/instrument-picker/SearchCell.tsx
|
|
10521
10252
|
import { registerComponent } from "@vuu-ui/vuu-utils";
|
|
10522
|
-
import { jsx as
|
|
10523
|
-
var
|
|
10253
|
+
import { jsx as jsx35, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
10254
|
+
var classBase19 = "vuuSearchCell";
|
|
10524
10255
|
var SearchCell = ({
|
|
10525
10256
|
column,
|
|
10526
10257
|
columnMap,
|
|
@@ -10528,8 +10259,8 @@ var SearchCell = ({
|
|
|
10528
10259
|
}) => {
|
|
10529
10260
|
const key = columnMap[column.name];
|
|
10530
10261
|
const value = row[key];
|
|
10531
|
-
return /* @__PURE__ */
|
|
10532
|
-
/* @__PURE__ */
|
|
10262
|
+
return /* @__PURE__ */ jsxs17("div", { className: classBase19, tabIndex: -1, children: [
|
|
10263
|
+
/* @__PURE__ */ jsx35("span", { "data-icon": "draggable" }),
|
|
10533
10264
|
value
|
|
10534
10265
|
] });
|
|
10535
10266
|
};
|
|
@@ -10539,7 +10270,7 @@ registerComponent("search-cell", SearchCell, "cell-renderer", {
|
|
|
10539
10270
|
|
|
10540
10271
|
// src/instrument-picker/useInstrumentPicker.ts
|
|
10541
10272
|
import { useControlledTableNavigation } from "@vuu-ui/vuu-table";
|
|
10542
|
-
import { useCallback as
|
|
10273
|
+
import { useCallback as useCallback43, useMemo as useMemo15, useState as useState19 } from "react";
|
|
10543
10274
|
var defaultItemToString = (row) => Object.values(row.data).join(" ");
|
|
10544
10275
|
var useInstrumentPicker = ({
|
|
10545
10276
|
dataSource,
|
|
@@ -10550,26 +10281,26 @@ var useInstrumentPicker = ({
|
|
|
10550
10281
|
onSelect,
|
|
10551
10282
|
searchColumns
|
|
10552
10283
|
}) => {
|
|
10553
|
-
const [value, setValue] =
|
|
10284
|
+
const [value, setValue] = useState19("");
|
|
10554
10285
|
const [isOpen, setIsOpen] = useControlled({
|
|
10555
10286
|
controlled: isOpenProp,
|
|
10556
10287
|
default: defaultIsOpen != null ? defaultIsOpen : false,
|
|
10557
10288
|
name: "useDropdownList"
|
|
10558
10289
|
});
|
|
10559
10290
|
const { highlightedIndexRef, onKeyDown, tableRef } = useControlledTableNavigation(-1, dataSource.size);
|
|
10560
|
-
const baseFilterPattern =
|
|
10291
|
+
const baseFilterPattern = useMemo15(
|
|
10561
10292
|
// TODO make this contains once server supports it
|
|
10562
10293
|
() => searchColumns.map((col) => `${col} starts "__VALUE__"`).join(" or "),
|
|
10563
10294
|
[searchColumns]
|
|
10564
10295
|
);
|
|
10565
|
-
const handleOpenChange =
|
|
10296
|
+
const handleOpenChange = useCallback43(
|
|
10566
10297
|
(open, closeReason) => {
|
|
10567
10298
|
setIsOpen(open);
|
|
10568
10299
|
onOpenChange == null ? void 0 : onOpenChange(open, closeReason);
|
|
10569
10300
|
},
|
|
10570
10301
|
[onOpenChange, setIsOpen]
|
|
10571
10302
|
);
|
|
10572
|
-
const handleInputChange =
|
|
10303
|
+
const handleInputChange = useCallback43(
|
|
10573
10304
|
(evt) => {
|
|
10574
10305
|
const { value: value2 } = evt.target;
|
|
10575
10306
|
setValue(value2);
|
|
@@ -10587,7 +10318,7 @@ var useInstrumentPicker = ({
|
|
|
10587
10318
|
},
|
|
10588
10319
|
[baseFilterPattern, dataSource, setIsOpen]
|
|
10589
10320
|
);
|
|
10590
|
-
const handleSelectRow =
|
|
10321
|
+
const handleSelectRow = useCallback43(
|
|
10591
10322
|
(row) => {
|
|
10592
10323
|
const value2 = row === null ? "" : itemToString2(row);
|
|
10593
10324
|
setValue(value2);
|
|
@@ -10618,12 +10349,12 @@ var useInstrumentPicker = ({
|
|
|
10618
10349
|
};
|
|
10619
10350
|
|
|
10620
10351
|
// src/instrument-picker/InstrumentPicker.tsx
|
|
10621
|
-
import { jsx as
|
|
10622
|
-
var
|
|
10352
|
+
import { jsx as jsx36, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
10353
|
+
var classBase20 = "vuuInstrumentPicker";
|
|
10623
10354
|
if (typeof SearchCell !== "function") {
|
|
10624
10355
|
console.warn("Instrument Picker: SearchCell module not loaded ");
|
|
10625
10356
|
}
|
|
10626
|
-
var InstrumentPicker =
|
|
10357
|
+
var InstrumentPicker = forwardRef22(function InstrumentPicker2({
|
|
10627
10358
|
TableProps: { dataSource, ...TableProps3 },
|
|
10628
10359
|
className,
|
|
10629
10360
|
columnMap,
|
|
@@ -10655,7 +10386,7 @@ var InstrumentPicker = forwardRef23(function InstrumentPicker2({
|
|
|
10655
10386
|
onSelect,
|
|
10656
10387
|
searchColumns
|
|
10657
10388
|
});
|
|
10658
|
-
const endAdornment =
|
|
10389
|
+
const endAdornment = useMemo16(() => /* @__PURE__ */ jsx36("span", { "data-icon": "chevron-down" }), []);
|
|
10659
10390
|
const tableProps = {
|
|
10660
10391
|
...TableProps3,
|
|
10661
10392
|
config: {
|
|
@@ -10663,7 +10394,7 @@ var InstrumentPicker = forwardRef23(function InstrumentPicker2({
|
|
|
10663
10394
|
zebraStripes: false
|
|
10664
10395
|
}
|
|
10665
10396
|
};
|
|
10666
|
-
return /* @__PURE__ */
|
|
10397
|
+
return /* @__PURE__ */ jsxs18(
|
|
10667
10398
|
DropdownBase,
|
|
10668
10399
|
{
|
|
10669
10400
|
...htmlAttributes,
|
|
@@ -10676,7 +10407,7 @@ var InstrumentPicker = forwardRef23(function InstrumentPicker2({
|
|
|
10676
10407
|
ref: forwardedRef,
|
|
10677
10408
|
width,
|
|
10678
10409
|
children: [
|
|
10679
|
-
/* @__PURE__ */
|
|
10410
|
+
/* @__PURE__ */ jsx36(
|
|
10680
10411
|
Input4,
|
|
10681
10412
|
{
|
|
10682
10413
|
...inputProps,
|
|
@@ -10685,14 +10416,14 @@ var InstrumentPicker = forwardRef23(function InstrumentPicker2({
|
|
|
10685
10416
|
value
|
|
10686
10417
|
}
|
|
10687
10418
|
),
|
|
10688
|
-
/* @__PURE__ */
|
|
10419
|
+
/* @__PURE__ */ jsx36(
|
|
10689
10420
|
Table,
|
|
10690
10421
|
{
|
|
10691
10422
|
rowHeight: 25,
|
|
10692
10423
|
renderBufferSize: 100,
|
|
10693
10424
|
...tableProps,
|
|
10694
10425
|
...tableHandlers,
|
|
10695
|
-
className: `${
|
|
10426
|
+
className: `${classBase20}-list`,
|
|
10696
10427
|
height: 200,
|
|
10697
10428
|
highlightedIndex,
|
|
10698
10429
|
dataSource,
|
|
@@ -10713,13 +10444,13 @@ import {
|
|
|
10713
10444
|
useControlledTableNavigation as useControlledTableNavigation2
|
|
10714
10445
|
} from "@vuu-ui/vuu-table";
|
|
10715
10446
|
import { Input as Input5 } from "@salt-ds/core";
|
|
10716
|
-
import
|
|
10717
|
-
import { useCallback as
|
|
10447
|
+
import cx20 from "clsx";
|
|
10448
|
+
import { useCallback as useCallback45 } from "react";
|
|
10718
10449
|
|
|
10719
10450
|
// src/instrument-search/SearchCell.tsx
|
|
10720
10451
|
import { registerComponent as registerComponent2 } from "@vuu-ui/vuu-utils";
|
|
10721
|
-
import { jsx as
|
|
10722
|
-
var
|
|
10452
|
+
import { jsx as jsx37, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
10453
|
+
var classBase21 = "vuuSearchCell";
|
|
10723
10454
|
var SearchCell2 = ({
|
|
10724
10455
|
column,
|
|
10725
10456
|
columnMap,
|
|
@@ -10727,8 +10458,8 @@ var SearchCell2 = ({
|
|
|
10727
10458
|
}) => {
|
|
10728
10459
|
const key = columnMap[column.name];
|
|
10729
10460
|
const value = row[key];
|
|
10730
|
-
return /* @__PURE__ */
|
|
10731
|
-
/* @__PURE__ */
|
|
10461
|
+
return /* @__PURE__ */ jsxs19("div", { className: classBase21, tabIndex: -1, children: [
|
|
10462
|
+
/* @__PURE__ */ jsx37("span", { "data-icon": "draggable" }),
|
|
10732
10463
|
value
|
|
10733
10464
|
] });
|
|
10734
10465
|
};
|
|
@@ -10737,18 +10468,18 @@ registerComponent2("search-cell", SearchCell2, "cell-renderer", {
|
|
|
10737
10468
|
});
|
|
10738
10469
|
|
|
10739
10470
|
// src/instrument-search/useInstrumentSearch.ts
|
|
10740
|
-
import { useCallback as
|
|
10471
|
+
import { useCallback as useCallback44, useMemo as useMemo17, useState as useState20 } from "react";
|
|
10741
10472
|
var useInstrumentSearch = ({
|
|
10742
10473
|
dataSource,
|
|
10743
10474
|
searchColumns = ["description"]
|
|
10744
10475
|
}) => {
|
|
10745
|
-
const [searchState, setSearchState] =
|
|
10746
|
-
const baseFilterPattern =
|
|
10476
|
+
const [searchState, setSearchState] = useState20({ searchText: "", filter: "" });
|
|
10477
|
+
const baseFilterPattern = useMemo17(
|
|
10747
10478
|
// TODO make this contains once server supports it
|
|
10748
10479
|
() => searchColumns.map((col) => `${col} starts "__VALUE__"`).join(" or "),
|
|
10749
10480
|
[searchColumns]
|
|
10750
10481
|
);
|
|
10751
|
-
const handleChange =
|
|
10482
|
+
const handleChange = useCallback44(
|
|
10752
10483
|
(evt) => {
|
|
10753
10484
|
const { value } = evt.target;
|
|
10754
10485
|
const filter = baseFilterPattern.replaceAll("__VALUE__", value);
|
|
@@ -10772,8 +10503,8 @@ var useInstrumentSearch = ({
|
|
|
10772
10503
|
};
|
|
10773
10504
|
|
|
10774
10505
|
// src/instrument-search/InstrumentSearch.tsx
|
|
10775
|
-
import { jsx as
|
|
10776
|
-
var
|
|
10506
|
+
import { jsx as jsx38, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
10507
|
+
var classBase22 = "vuuInstrumentSearch";
|
|
10777
10508
|
if (typeof SearchCell2 !== "function") {
|
|
10778
10509
|
console.warn("Instrument Search: SearchCell module not loaded ");
|
|
10779
10510
|
}
|
|
@@ -10793,7 +10524,7 @@ var defaultTableConfig = {
|
|
|
10793
10524
|
],
|
|
10794
10525
|
rowSeparators: true
|
|
10795
10526
|
};
|
|
10796
|
-
var searchIcon = /* @__PURE__ */
|
|
10527
|
+
var searchIcon = /* @__PURE__ */ jsx38("span", { "data-icon": "search" });
|
|
10797
10528
|
var InstrumentSearch = ({
|
|
10798
10529
|
TableProps: TableProps3,
|
|
10799
10530
|
autoFocus = false,
|
|
@@ -10809,14 +10540,14 @@ var InstrumentSearch = ({
|
|
|
10809
10540
|
searchColumns
|
|
10810
10541
|
});
|
|
10811
10542
|
const { highlightedIndexRef, onHighlight, onKeyDown, tableRef } = useControlledTableNavigation2(-1, (_a2 = dataSource == null ? void 0 : dataSource.size) != null ? _a2 : 0);
|
|
10812
|
-
const searchCallbackRef =
|
|
10543
|
+
const searchCallbackRef = useCallback45((el) => {
|
|
10813
10544
|
setTimeout(() => {
|
|
10814
10545
|
var _a3;
|
|
10815
10546
|
(_a3 = el == null ? void 0 : el.querySelector("input")) == null ? void 0 : _a3.focus();
|
|
10816
10547
|
}, 100);
|
|
10817
10548
|
}, []);
|
|
10818
|
-
return /* @__PURE__ */
|
|
10819
|
-
/* @__PURE__ */
|
|
10549
|
+
return /* @__PURE__ */ jsxs20("div", { ...htmlAttributes, className: cx20(classBase22, className), children: [
|
|
10550
|
+
/* @__PURE__ */ jsx38("div", { className: `${classBase22}-inputField`, children: /* @__PURE__ */ jsx38(
|
|
10820
10551
|
Input5,
|
|
10821
10552
|
{
|
|
10822
10553
|
inputProps: { onKeyDown },
|
|
@@ -10827,7 +10558,7 @@ var InstrumentSearch = ({
|
|
|
10827
10558
|
onChange
|
|
10828
10559
|
}
|
|
10829
10560
|
) }),
|
|
10830
|
-
dataSource ? /* @__PURE__ */
|
|
10561
|
+
dataSource ? /* @__PURE__ */ jsx38(
|
|
10831
10562
|
Table2,
|
|
10832
10563
|
{
|
|
10833
10564
|
disableFocus: true,
|
|
@@ -10837,7 +10568,7 @@ var InstrumentSearch = ({
|
|
|
10837
10568
|
highlightedIndex: highlightedIndexRef.current,
|
|
10838
10569
|
renderBufferSize: 100,
|
|
10839
10570
|
...TableProps3,
|
|
10840
|
-
className: `${
|
|
10571
|
+
className: `${classBase22}-list`,
|
|
10841
10572
|
dataSource,
|
|
10842
10573
|
navigationStyle: "row",
|
|
10843
10574
|
onHighlight,
|
|
@@ -10856,10 +10587,10 @@ import {
|
|
|
10856
10587
|
isValidNumber as isValidNumber5,
|
|
10857
10588
|
numericFormatter
|
|
10858
10589
|
} from "@vuu-ui/vuu-utils";
|
|
10859
|
-
import { memo, useMemo as
|
|
10860
|
-
import
|
|
10861
|
-
import { jsx as
|
|
10862
|
-
var
|
|
10590
|
+
import { memo, useMemo as useMemo18, useRef as useRef35 } from "react";
|
|
10591
|
+
import cx21 from "clsx";
|
|
10592
|
+
import { jsx as jsx39, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
10593
|
+
var classBase23 = "vuuPriceTicker";
|
|
10863
10594
|
var getValueFormatter = (decimals) => numericFormatter({
|
|
10864
10595
|
type: {
|
|
10865
10596
|
name: "number",
|
|
@@ -10878,14 +10609,14 @@ var PriceTicker = memo(
|
|
|
10878
10609
|
showArrow,
|
|
10879
10610
|
...htmlAttributes
|
|
10880
10611
|
}) => {
|
|
10881
|
-
const ref =
|
|
10612
|
+
const ref = useRef35(INITIAL_VALUE);
|
|
10882
10613
|
const [prevValue, prevDirection] = ref.current;
|
|
10883
|
-
const formatNumber =
|
|
10614
|
+
const formatNumber = useMemo18(() => getValueFormatter(decimals), [decimals]);
|
|
10884
10615
|
const direction = isValidNumber5(prevValue) ? getMovingValueDirection(price, prevDirection, prevValue, decimals) : "";
|
|
10885
10616
|
ref.current = [price, direction];
|
|
10886
|
-
return /* @__PURE__ */
|
|
10617
|
+
return /* @__PURE__ */ jsxs21("div", { ...htmlAttributes, className: cx21(classBase23, className, direction), children: [
|
|
10887
10618
|
formatNumber(price),
|
|
10888
|
-
showArrow ? /* @__PURE__ */
|
|
10619
|
+
showArrow ? /* @__PURE__ */ jsx39("span", { "data-icon": "price-arrow" }) : null
|
|
10889
10620
|
] });
|
|
10890
10621
|
}
|
|
10891
10622
|
);
|
|
@@ -10893,14 +10624,14 @@ PriceTicker.displayName = "PriceTicker";
|
|
|
10893
10624
|
|
|
10894
10625
|
// src/split-button/SplitButton.tsx
|
|
10895
10626
|
import { PopupMenu as PopupMenu2 } from "@vuu-ui/vuu-popups";
|
|
10896
|
-
import { Button as
|
|
10897
|
-
import { forwardRef as
|
|
10627
|
+
import { Button as Button4, useForkRef as useForkRef9 } from "@salt-ds/core";
|
|
10628
|
+
import { forwardRef as forwardRef23 } from "react";
|
|
10898
10629
|
|
|
10899
10630
|
// src/split-button/useSplitButton.ts
|
|
10900
10631
|
import { dispatchMouseEvent as dispatchMouseEvent2 } from "@vuu-ui/vuu-utils";
|
|
10901
10632
|
import {
|
|
10902
|
-
useCallback as
|
|
10903
|
-
useRef as
|
|
10633
|
+
useCallback as useCallback46,
|
|
10634
|
+
useRef as useRef36
|
|
10904
10635
|
} from "react";
|
|
10905
10636
|
var focusTargetIsEditableLabel = (target) => {
|
|
10906
10637
|
if (target.tagName === "INPUT") {
|
|
@@ -10911,12 +10642,12 @@ var focusTargetIsEditableLabel = (target) => {
|
|
|
10911
10642
|
var useSplitButton = ({
|
|
10912
10643
|
ButtonProps: ButtonPropsProp,
|
|
10913
10644
|
PopupMenuProps: PopupMenuProps3,
|
|
10914
|
-
classBase:
|
|
10645
|
+
classBase: classBase31,
|
|
10915
10646
|
onClick
|
|
10916
10647
|
}) => {
|
|
10917
|
-
const buttonRef =
|
|
10918
|
-
const rootRef =
|
|
10919
|
-
const onMenuClose =
|
|
10648
|
+
const buttonRef = useRef36(null);
|
|
10649
|
+
const rootRef = useRef36(null);
|
|
10650
|
+
const onMenuClose = useCallback46((reason) => {
|
|
10920
10651
|
var _a2;
|
|
10921
10652
|
if ((reason == null ? void 0 : reason.type) !== "tab-away") {
|
|
10922
10653
|
const buttonMain = (_a2 = rootRef.current) == null ? void 0 : _a2.querySelector(
|
|
@@ -10928,11 +10659,11 @@ var useSplitButton = ({
|
|
|
10928
10659
|
const menuProps = {
|
|
10929
10660
|
...PopupMenuProps3,
|
|
10930
10661
|
anchorElement: rootRef,
|
|
10931
|
-
menuClassName: `${
|
|
10662
|
+
menuClassName: `${classBase31}-menu`,
|
|
10932
10663
|
onMenuClose,
|
|
10933
10664
|
popupPlacement: "below-full-width"
|
|
10934
10665
|
};
|
|
10935
|
-
const handleRootFocus =
|
|
10666
|
+
const handleRootFocus = useCallback46((evt) => {
|
|
10936
10667
|
const { current: splitButton } = rootRef;
|
|
10937
10668
|
if (!(splitButton == null ? void 0 : splitButton.classList.contains("vuuFocusVisible"))) {
|
|
10938
10669
|
splitButton == null ? void 0 : splitButton.classList.add("vuuFocusVisible");
|
|
@@ -10944,7 +10675,7 @@ var useSplitButton = ({
|
|
|
10944
10675
|
}
|
|
10945
10676
|
}
|
|
10946
10677
|
}, []);
|
|
10947
|
-
const handleRootBlur =
|
|
10678
|
+
const handleRootBlur = useCallback46((evt) => {
|
|
10948
10679
|
const { current: splitButton } = rootRef;
|
|
10949
10680
|
const target = evt.relatedTarget;
|
|
10950
10681
|
if (!(splitButton == null ? void 0 : splitButton.contains(target))) {
|
|
@@ -10953,19 +10684,19 @@ var useSplitButton = ({
|
|
|
10953
10684
|
}
|
|
10954
10685
|
}
|
|
10955
10686
|
}, []);
|
|
10956
|
-
const handleButtonKeyDown =
|
|
10687
|
+
const handleButtonKeyDown = useCallback46(
|
|
10957
10688
|
(evt) => {
|
|
10958
10689
|
var _a2;
|
|
10959
10690
|
if (evt.key === "ArrowDown") {
|
|
10960
10691
|
const popupTrigger = (_a2 = rootRef.current) == null ? void 0 : _a2.querySelector(
|
|
10961
|
-
`.${
|
|
10692
|
+
`.${classBase31}-trigger`
|
|
10962
10693
|
);
|
|
10963
10694
|
if (popupTrigger) {
|
|
10964
10695
|
dispatchMouseEvent2(popupTrigger, "click");
|
|
10965
10696
|
}
|
|
10966
10697
|
}
|
|
10967
10698
|
},
|
|
10968
|
-
[
|
|
10699
|
+
[classBase31]
|
|
10969
10700
|
);
|
|
10970
10701
|
const ButtonProps6 = {
|
|
10971
10702
|
...ButtonPropsProp,
|
|
@@ -10983,10 +10714,10 @@ var useSplitButton = ({
|
|
|
10983
10714
|
};
|
|
10984
10715
|
|
|
10985
10716
|
// src/split-button/SplitButton.tsx
|
|
10986
|
-
import
|
|
10987
|
-
import { jsx as
|
|
10988
|
-
var
|
|
10989
|
-
var SplitButton =
|
|
10717
|
+
import cx22 from "clsx";
|
|
10718
|
+
import { jsx as jsx40, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
10719
|
+
var classBase24 = "vuuSplitButton";
|
|
10720
|
+
var SplitButton = forwardRef23(
|
|
10990
10721
|
function SplitButton2({
|
|
10991
10722
|
ButtonProps: ButtonPropsProp,
|
|
10992
10723
|
PopupMenuProps: PopupMenuPropsProp,
|
|
@@ -11002,39 +10733,39 @@ var SplitButton = forwardRef24(
|
|
|
11002
10733
|
const { ButtonProps: ButtonProps6, buttonRef, rootRef, PopupMenuProps: PopupMenuProps3, ...rootProps } = useSplitButton({
|
|
11003
10734
|
ButtonProps: ButtonPropsProp,
|
|
11004
10735
|
PopupMenuProps: PopupMenuPropsProp,
|
|
11005
|
-
classBase:
|
|
10736
|
+
classBase: classBase24,
|
|
11006
10737
|
onClick,
|
|
11007
10738
|
segmented
|
|
11008
10739
|
});
|
|
11009
|
-
return /* @__PURE__ */
|
|
10740
|
+
return /* @__PURE__ */ jsxs22(
|
|
11010
10741
|
"div",
|
|
11011
10742
|
{
|
|
11012
10743
|
...htmlAttributes,
|
|
11013
10744
|
...rootProps,
|
|
11014
|
-
className:
|
|
11015
|
-
[`${
|
|
11016
|
-
[`${
|
|
10745
|
+
className: cx22(classBase24, `${classBase24}-${variant}`, className, {
|
|
10746
|
+
[`${classBase24}-disabled`]: disabled,
|
|
10747
|
+
[`${classBase24}-segmented`]: segmented
|
|
11017
10748
|
}),
|
|
11018
10749
|
ref: useForkRef9(forwardedRef, rootRef),
|
|
11019
10750
|
"data-showcase-center": true,
|
|
11020
10751
|
tabIndex: -1,
|
|
11021
10752
|
children: [
|
|
11022
|
-
/* @__PURE__ */
|
|
11023
|
-
|
|
10753
|
+
/* @__PURE__ */ jsx40(
|
|
10754
|
+
Button4,
|
|
11024
10755
|
{
|
|
11025
10756
|
...ButtonProps6,
|
|
11026
|
-
className: `${
|
|
10757
|
+
className: `${classBase24}-main`,
|
|
11027
10758
|
disabled,
|
|
11028
10759
|
ref: buttonRef,
|
|
11029
10760
|
variant,
|
|
11030
10761
|
children
|
|
11031
10762
|
}
|
|
11032
10763
|
),
|
|
11033
|
-
/* @__PURE__ */
|
|
10764
|
+
/* @__PURE__ */ jsx40(
|
|
11034
10765
|
PopupMenu2,
|
|
11035
10766
|
{
|
|
11036
10767
|
...PopupMenuProps3,
|
|
11037
|
-
className: `${
|
|
10768
|
+
className: `${classBase24}-trigger`,
|
|
11038
10769
|
disabled,
|
|
11039
10770
|
icon: (_a2 = PopupMenuProps3 == null ? void 0 : PopupMenuProps3.icon) != null ? _a2 : "chevron-down",
|
|
11040
10771
|
tabIndex: segmented ? 0 : -1,
|
|
@@ -11048,17 +10779,17 @@ var SplitButton = forwardRef24(
|
|
|
11048
10779
|
);
|
|
11049
10780
|
|
|
11050
10781
|
// src/split-button/SplitStateButton.tsx
|
|
11051
|
-
import
|
|
11052
|
-
import { forwardRef as
|
|
11053
|
-
import { jsx as
|
|
11054
|
-
var
|
|
11055
|
-
var SplitStateButton =
|
|
11056
|
-
return /* @__PURE__ */
|
|
10782
|
+
import cx23 from "clsx";
|
|
10783
|
+
import { forwardRef as forwardRef24 } from "react";
|
|
10784
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
10785
|
+
var classBase25 = "vuuSplitStateButton";
|
|
10786
|
+
var SplitStateButton = forwardRef24(function SplitStateButton2({ className, selected, ...splitButtonProps }, forwardedRef) {
|
|
10787
|
+
return /* @__PURE__ */ jsx41(
|
|
11057
10788
|
SplitButton,
|
|
11058
10789
|
{
|
|
11059
10790
|
...splitButtonProps,
|
|
11060
10791
|
"aria-checked": selected,
|
|
11061
|
-
className:
|
|
10792
|
+
className: cx23(classBase25, className),
|
|
11062
10793
|
ref: forwardedRef
|
|
11063
10794
|
}
|
|
11064
10795
|
);
|
|
@@ -11066,14 +10797,14 @@ var SplitStateButton = forwardRef25(function SplitStateButton2({ className, sele
|
|
|
11066
10797
|
|
|
11067
10798
|
// src/tabstrip/Tabstrip.tsx
|
|
11068
10799
|
import { asReactElements as asReactElements2, useId as useId9 } from "@vuu-ui/vuu-utils";
|
|
11069
|
-
import
|
|
11070
|
-
import
|
|
10800
|
+
import cx24 from "clsx";
|
|
10801
|
+
import React3, { useMemo as useMemo20, useRef as useRef40 } from "react";
|
|
11071
10802
|
|
|
11072
10803
|
// src/tabstrip/useTabstrip.ts
|
|
11073
10804
|
import { dispatchMouseEvent as dispatchMouseEvent4 } from "@vuu-ui/vuu-utils";
|
|
11074
10805
|
import {
|
|
11075
|
-
useCallback as
|
|
11076
|
-
useRef as
|
|
10806
|
+
useCallback as useCallback50,
|
|
10807
|
+
useRef as useRef39
|
|
11077
10808
|
} from "react";
|
|
11078
10809
|
|
|
11079
10810
|
// src/tabstrip/TabMenuOptions.ts
|
|
@@ -11107,22 +10838,22 @@ var getIndexOfEditedItem = (container) => getIndexOfItem(container, ".vuuEditabl
|
|
|
11107
10838
|
|
|
11108
10839
|
// src/tabstrip/useAnimatedSelectionThumb.ts
|
|
11109
10840
|
import { isValidNumber as isValidNumber6, MEASURES as MEASURES2 } from "@vuu-ui/vuu-utils";
|
|
11110
|
-
import { useCallback as
|
|
10841
|
+
import { useCallback as useCallback47, useMemo as useMemo19, useRef as useRef37 } from "react";
|
|
11111
10842
|
var useAnimatedSelectionThumb = (containerRef, activeTabIndex, orientation = "horizontal") => {
|
|
11112
|
-
const animationSuspendedRef =
|
|
11113
|
-
const suspendAnimation =
|
|
10843
|
+
const animationSuspendedRef = useRef37(false);
|
|
10844
|
+
const suspendAnimation = useCallback47(() => {
|
|
11114
10845
|
animationSuspendedRef.current = true;
|
|
11115
10846
|
}, []);
|
|
11116
|
-
const resumeAnimation =
|
|
10847
|
+
const resumeAnimation = useCallback47(() => {
|
|
11117
10848
|
animationSuspendedRef.current = false;
|
|
11118
10849
|
}, []);
|
|
11119
|
-
const onTransitionEnd =
|
|
10850
|
+
const onTransitionEnd = useCallback47(() => {
|
|
11120
10851
|
var _a2, _b;
|
|
11121
10852
|
(_a2 = containerRef.current) == null ? void 0 : _a2.style.setProperty("--tab-thumb-transition", "none");
|
|
11122
10853
|
(_b = containerRef.current) == null ? void 0 : _b.removeEventListener("transitionend", onTransitionEnd);
|
|
11123
10854
|
}, [containerRef]);
|
|
11124
|
-
const lastSelectedRef =
|
|
11125
|
-
return
|
|
10855
|
+
const lastSelectedRef = useRef37(-1);
|
|
10856
|
+
return useMemo19(() => {
|
|
11126
10857
|
var _a2, _b;
|
|
11127
10858
|
let offset = 0;
|
|
11128
10859
|
let size = 0;
|
|
@@ -11196,9 +10927,9 @@ import {
|
|
|
11196
10927
|
getFocusableElement
|
|
11197
10928
|
} from "@vuu-ui/vuu-utils";
|
|
11198
10929
|
import {
|
|
11199
|
-
useCallback as
|
|
11200
|
-
useRef as
|
|
11201
|
-
useState as
|
|
10930
|
+
useCallback as useCallback48,
|
|
10931
|
+
useRef as useRef38,
|
|
10932
|
+
useState as useState21
|
|
11202
10933
|
} from "react";
|
|
11203
10934
|
import {
|
|
11204
10935
|
ArrowDown as ArrowDown2,
|
|
@@ -11256,23 +10987,23 @@ var useKeyboardNavigation2 = ({
|
|
|
11256
10987
|
selectedIndex: selectedTabIndex = 0
|
|
11257
10988
|
}) => {
|
|
11258
10989
|
const manualActivation = keyBoardActivation === "manual";
|
|
11259
|
-
const mouseClickPending =
|
|
11260
|
-
const focusedRef =
|
|
11261
|
-
const [hasFocus, setHasFocus] =
|
|
11262
|
-
const [, forceRefresh] =
|
|
10990
|
+
const mouseClickPending = useRef38(false);
|
|
10991
|
+
const focusedRef = useRef38(-1);
|
|
10992
|
+
const [hasFocus, setHasFocus] = useState21(false);
|
|
10993
|
+
const [, forceRefresh] = useState21({});
|
|
11263
10994
|
const [highlightedIdx, _setHighlightedIdx] = useControlled9({
|
|
11264
10995
|
controlled: highlightedIdxProp,
|
|
11265
10996
|
default: defaultHighlightedIdx,
|
|
11266
10997
|
name: "UseKeyboardNavigation"
|
|
11267
10998
|
});
|
|
11268
|
-
const setHighlightedIdx =
|
|
10999
|
+
const setHighlightedIdx = useCallback48(
|
|
11269
11000
|
(value) => {
|
|
11270
11001
|
_setHighlightedIdx(focusedRef.current = value);
|
|
11271
11002
|
},
|
|
11272
11003
|
[_setHighlightedIdx]
|
|
11273
11004
|
);
|
|
11274
|
-
const keyboardNavigation =
|
|
11275
|
-
const focusTab =
|
|
11005
|
+
const keyboardNavigation = useRef38(false);
|
|
11006
|
+
const focusTab = useCallback48(
|
|
11276
11007
|
(tabIndex, immediateFocus = false, withKeyboard, delay = 70) => {
|
|
11277
11008
|
setHighlightedIdx(tabIndex);
|
|
11278
11009
|
if (withKeyboard === true && !keyboardNavigation.current) {
|
|
@@ -11312,14 +11043,14 @@ var useKeyboardNavigation2 = ({
|
|
|
11312
11043
|
}
|
|
11313
11044
|
}
|
|
11314
11045
|
};
|
|
11315
|
-
const getIndexCount =
|
|
11046
|
+
const getIndexCount = useCallback48(
|
|
11316
11047
|
() => {
|
|
11317
11048
|
var _a2, _b;
|
|
11318
11049
|
return (_b = (_a2 = containerRef.current) == null ? void 0 : _a2.querySelectorAll(`[data-index]`).length) != null ? _b : 0;
|
|
11319
11050
|
},
|
|
11320
11051
|
[containerRef]
|
|
11321
11052
|
);
|
|
11322
|
-
const nextFocusableItemIdx =
|
|
11053
|
+
const nextFocusableItemIdx = useCallback48(
|
|
11323
11054
|
(direction = "fwd", idx) => {
|
|
11324
11055
|
const indexCount = getIndexCount();
|
|
11325
11056
|
const index = typeof idx === "number" ? idx : indexCount;
|
|
@@ -11339,7 +11070,7 @@ var useKeyboardNavigation2 = ({
|
|
|
11339
11070
|
},
|
|
11340
11071
|
[containerRef, getIndexCount]
|
|
11341
11072
|
);
|
|
11342
|
-
const navigateChildItems =
|
|
11073
|
+
const navigateChildItems = useCallback48(
|
|
11343
11074
|
(e, forceFocusVisible = false) => {
|
|
11344
11075
|
const direction = navigation[orientation][e.key];
|
|
11345
11076
|
const nextIdx = nextFocusableItemIdx(direction, highlightedIdx);
|
|
@@ -11361,14 +11092,14 @@ var useKeyboardNavigation2 = ({
|
|
|
11361
11092
|
orientation
|
|
11362
11093
|
]
|
|
11363
11094
|
);
|
|
11364
|
-
const highlightedTabHasMenu =
|
|
11095
|
+
const highlightedTabHasMenu = useCallback48(() => {
|
|
11365
11096
|
const el = getElementByPosition(containerRef.current, highlightedIdx);
|
|
11366
11097
|
if (el) {
|
|
11367
11098
|
return el.querySelector(".vuuPopupMenu") != null;
|
|
11368
11099
|
}
|
|
11369
11100
|
return false;
|
|
11370
11101
|
}, [containerRef, highlightedIdx]);
|
|
11371
|
-
const activateTabMenu =
|
|
11102
|
+
const activateTabMenu = useCallback48(() => {
|
|
11372
11103
|
const el = getElementByPosition(containerRef.current, highlightedIdx);
|
|
11373
11104
|
const menuEl = el == null ? void 0 : el.querySelector(".vuuPopupMenu");
|
|
11374
11105
|
if (menuEl) {
|
|
@@ -11376,7 +11107,7 @@ var useKeyboardNavigation2 = ({
|
|
|
11376
11107
|
}
|
|
11377
11108
|
return false;
|
|
11378
11109
|
}, [containerRef, highlightedIdx]);
|
|
11379
|
-
const handleKeyDown =
|
|
11110
|
+
const handleKeyDown = useCallback48(
|
|
11380
11111
|
(e) => {
|
|
11381
11112
|
if (getIndexCount() > 0 && isNavigationKey2(e.key, orientation)) {
|
|
11382
11113
|
e.preventDefault();
|
|
@@ -11401,7 +11132,7 @@ var useKeyboardNavigation2 = ({
|
|
|
11401
11132
|
const handleItemClick = (_, tabIndex) => {
|
|
11402
11133
|
setHighlightedIdx(tabIndex);
|
|
11403
11134
|
};
|
|
11404
|
-
const handleFocus =
|
|
11135
|
+
const handleFocus = useCallback48(() => {
|
|
11405
11136
|
if (!hasFocus) {
|
|
11406
11137
|
setHasFocus(true);
|
|
11407
11138
|
if (!mouseClickPending.current) {
|
|
@@ -11411,7 +11142,7 @@ var useKeyboardNavigation2 = ({
|
|
|
11411
11142
|
}
|
|
11412
11143
|
}
|
|
11413
11144
|
}, [hasFocus]);
|
|
11414
|
-
const handleContainerMouseDown =
|
|
11145
|
+
const handleContainerMouseDown = useCallback48(() => {
|
|
11415
11146
|
if (!hasFocus) {
|
|
11416
11147
|
mouseClickPending.current = true;
|
|
11417
11148
|
}
|
|
@@ -11449,7 +11180,7 @@ var useKeyboardNavigation2 = ({
|
|
|
11449
11180
|
|
|
11450
11181
|
// src/tabstrip/useSelection.ts
|
|
11451
11182
|
import { useControlled as useControlled10 } from "@salt-ds/core";
|
|
11452
|
-
import { useCallback as
|
|
11183
|
+
import { useCallback as useCallback49 } from "react";
|
|
11453
11184
|
var defaultSelectionKeys2 = ["Enter", " "];
|
|
11454
11185
|
var isTabElement = (el) => el && el.matches('[class*="vuuTab "]');
|
|
11455
11186
|
var useSelection2 = ({
|
|
@@ -11464,18 +11195,18 @@ var useSelection2 = ({
|
|
|
11464
11195
|
name: "Tabstrip",
|
|
11465
11196
|
state: "value"
|
|
11466
11197
|
});
|
|
11467
|
-
const isSelectionEvent =
|
|
11198
|
+
const isSelectionEvent = useCallback49(
|
|
11468
11199
|
(evt) => defaultSelectionKeys2.includes(evt.key),
|
|
11469
11200
|
[]
|
|
11470
11201
|
);
|
|
11471
|
-
const selectItem =
|
|
11202
|
+
const selectItem = useCallback49(
|
|
11472
11203
|
(tabIndex) => {
|
|
11473
11204
|
setSelected(tabIndex);
|
|
11474
11205
|
onSelectionChange == null ? void 0 : onSelectionChange(tabIndex);
|
|
11475
11206
|
},
|
|
11476
11207
|
[onSelectionChange, setSelected]
|
|
11477
11208
|
);
|
|
11478
|
-
const handleKeyDown =
|
|
11209
|
+
const handleKeyDown = useCallback49(
|
|
11479
11210
|
(e) => {
|
|
11480
11211
|
const targetElement = e.target;
|
|
11481
11212
|
if (isSelectionEvent(e) && highlightedIdx !== selected && isTabElement(targetElement)) {
|
|
@@ -11486,7 +11217,7 @@ var useSelection2 = ({
|
|
|
11486
11217
|
},
|
|
11487
11218
|
[isSelectionEvent, highlightedIdx, selected, selectItem]
|
|
11488
11219
|
);
|
|
11489
|
-
const onClick =
|
|
11220
|
+
const onClick = useCallback49(
|
|
11490
11221
|
(e, tabIndex) => {
|
|
11491
11222
|
if (tabIndex !== selected) {
|
|
11492
11223
|
selectItem(tabIndex);
|
|
@@ -11526,7 +11257,7 @@ var useTabstrip = ({
|
|
|
11526
11257
|
orientation,
|
|
11527
11258
|
keyBoardActivation
|
|
11528
11259
|
}) => {
|
|
11529
|
-
const lastSelection =
|
|
11260
|
+
const lastSelection = useRef39(activeTabIndexProp);
|
|
11530
11261
|
const {
|
|
11531
11262
|
focusTab: keyboardHookFocusTab,
|
|
11532
11263
|
highlightedIdx,
|
|
@@ -11556,7 +11287,7 @@ var useTabstrip = ({
|
|
|
11556
11287
|
animateSelectionThumb ? selectionHookSelected : -1,
|
|
11557
11288
|
orientation
|
|
11558
11289
|
);
|
|
11559
|
-
const handleDrop =
|
|
11290
|
+
const handleDrop = useCallback50(
|
|
11560
11291
|
({ fromIndex, toIndex }) => {
|
|
11561
11292
|
const { current: selected } = lastSelection;
|
|
11562
11293
|
console.log(
|
|
@@ -11598,7 +11329,7 @@ var useTabstrip = ({
|
|
|
11598
11329
|
orientation: "horizontal",
|
|
11599
11330
|
itemQuery: ".vuuOverflowContainer-item"
|
|
11600
11331
|
});
|
|
11601
|
-
const handleExitEditMode =
|
|
11332
|
+
const handleExitEditMode = useCallback50(
|
|
11602
11333
|
(originalValue, editedValue, allowDeactivation, tabIndex) => {
|
|
11603
11334
|
console.log(
|
|
11604
11335
|
`handleExitEditMode ${originalValue} ${editedValue} ${allowDeactivation} ${tabIndex}`
|
|
@@ -11610,7 +11341,7 @@ var useTabstrip = ({
|
|
|
11610
11341
|
},
|
|
11611
11342
|
[keyboardHookFocusTab, onExitEditMode]
|
|
11612
11343
|
);
|
|
11613
|
-
const handleClick =
|
|
11344
|
+
const handleClick = useCallback50(
|
|
11614
11345
|
(evt, tabIndex) => {
|
|
11615
11346
|
keyboardHookHandleClick(evt, tabIndex);
|
|
11616
11347
|
selectionHookHandleClick(evt, tabIndex);
|
|
@@ -11618,7 +11349,7 @@ var useTabstrip = ({
|
|
|
11618
11349
|
// [dragDropHook.isDragging, keyboardHook, selectionHook]
|
|
11619
11350
|
[keyboardHookHandleClick, selectionHookHandleClick]
|
|
11620
11351
|
);
|
|
11621
|
-
const getEditableLabel =
|
|
11352
|
+
const getEditableLabel = useCallback50(
|
|
11622
11353
|
(tabIndex = highlightedIdx) => {
|
|
11623
11354
|
const targetEl = getElementWithIndex(containerRef.current, tabIndex);
|
|
11624
11355
|
if (targetEl) {
|
|
@@ -11627,7 +11358,7 @@ var useTabstrip = ({
|
|
|
11627
11358
|
},
|
|
11628
11359
|
[containerRef, highlightedIdx]
|
|
11629
11360
|
);
|
|
11630
|
-
const tabInEditMode =
|
|
11361
|
+
const tabInEditMode = useCallback50(
|
|
11631
11362
|
(tabIndex = highlightedIdx) => {
|
|
11632
11363
|
const editableLabel = getEditableLabel(tabIndex);
|
|
11633
11364
|
if (editableLabel) {
|
|
@@ -11637,7 +11368,7 @@ var useTabstrip = ({
|
|
|
11637
11368
|
},
|
|
11638
11369
|
[getEditableLabel, highlightedIdx]
|
|
11639
11370
|
);
|
|
11640
|
-
const editTab =
|
|
11371
|
+
const editTab = useCallback50(
|
|
11641
11372
|
(tabIndex = highlightedIdx) => {
|
|
11642
11373
|
const editableLabelEl = getEditableLabel(tabIndex);
|
|
11643
11374
|
if (editableLabelEl) {
|
|
@@ -11646,7 +11377,7 @@ var useTabstrip = ({
|
|
|
11646
11377
|
},
|
|
11647
11378
|
[getEditableLabel, highlightedIdx]
|
|
11648
11379
|
);
|
|
11649
|
-
const handleKeyDown =
|
|
11380
|
+
const handleKeyDown = useCallback50(
|
|
11650
11381
|
(evt) => {
|
|
11651
11382
|
keyboardHookHandleKeyDown(evt);
|
|
11652
11383
|
if (!evt.defaultPrevented) {
|
|
@@ -11658,7 +11389,7 @@ var useTabstrip = ({
|
|
|
11658
11389
|
},
|
|
11659
11390
|
[editTab, keyboardHookHandleKeyDown, selectionHookHandleKeyDown]
|
|
11660
11391
|
);
|
|
11661
|
-
const handleCloseTabFromMenu =
|
|
11392
|
+
const handleCloseTabFromMenu = useCallback50(
|
|
11662
11393
|
(tabIndex) => {
|
|
11663
11394
|
const selectedTabIndex = getIndexOfSelectedTab(containerRef.current);
|
|
11664
11395
|
const newActiveTabIndex = selectedTabIndex > tabIndex ? selectedTabIndex - 1 : selectedTabIndex === tabIndex ? 0 : selectedTabIndex;
|
|
@@ -11671,14 +11402,14 @@ var useTabstrip = ({
|
|
|
11671
11402
|
},
|
|
11672
11403
|
[containerRef, onCloseTab, resumeAnimation, suspendAnimation]
|
|
11673
11404
|
);
|
|
11674
|
-
const handleRenameTabFromMenu =
|
|
11405
|
+
const handleRenameTabFromMenu = useCallback50(
|
|
11675
11406
|
(tabIndex) => {
|
|
11676
11407
|
editTab(tabIndex);
|
|
11677
11408
|
return true;
|
|
11678
11409
|
},
|
|
11679
11410
|
[editTab]
|
|
11680
11411
|
);
|
|
11681
|
-
const handleTabMenuAction =
|
|
11412
|
+
const handleTabMenuAction = useCallback50(
|
|
11682
11413
|
(action) => {
|
|
11683
11414
|
if (isTabMenuOptions(action.options)) {
|
|
11684
11415
|
switch (action.menuId) {
|
|
@@ -11694,7 +11425,7 @@ var useTabstrip = ({
|
|
|
11694
11425
|
},
|
|
11695
11426
|
[handleCloseTabFromMenu, handleRenameTabFromMenu]
|
|
11696
11427
|
);
|
|
11697
|
-
const handleTabMenuClose =
|
|
11428
|
+
const handleTabMenuClose = useCallback50(() => {
|
|
11698
11429
|
if (!tabInEditMode()) {
|
|
11699
11430
|
keyboardHookFocusTab(highlightedIdx);
|
|
11700
11431
|
} else {
|
|
@@ -11706,7 +11437,7 @@ var useTabstrip = ({
|
|
|
11706
11437
|
keyboardHookSetHighlightedIndex,
|
|
11707
11438
|
tabInEditMode
|
|
11708
11439
|
]);
|
|
11709
|
-
const onSwitchWrappedItemIntoView =
|
|
11440
|
+
const onSwitchWrappedItemIntoView = useCallback50(
|
|
11710
11441
|
(item) => {
|
|
11711
11442
|
const index = parseInt(item.index);
|
|
11712
11443
|
if (!isNaN(index)) {
|
|
@@ -11719,7 +11450,7 @@ var useTabstrip = ({
|
|
|
11719
11450
|
onFocus: keyboardHook.onFocus,
|
|
11720
11451
|
onKeyDown: handleKeyDown
|
|
11721
11452
|
};
|
|
11722
|
-
const handleAddTabClick =
|
|
11453
|
+
const handleAddTabClick = useCallback50(() => {
|
|
11723
11454
|
onAddTab == null ? void 0 : onAddTab();
|
|
11724
11455
|
requestAnimationFrame(() => {
|
|
11725
11456
|
const selectedTabIndex = getIndexOfSelectedTab(containerRef.current);
|
|
@@ -11752,9 +11483,9 @@ var useTabstrip = ({
|
|
|
11752
11483
|
};
|
|
11753
11484
|
|
|
11754
11485
|
// src/tabstrip/Tabstrip.tsx
|
|
11755
|
-
import { Fragment as Fragment4, jsx as
|
|
11486
|
+
import { Fragment as Fragment4, jsx as jsx42, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
11756
11487
|
import { createElement as createElement2 } from "react";
|
|
11757
|
-
var
|
|
11488
|
+
var classBase26 = "vuuTabstrip";
|
|
11758
11489
|
var Tabstrip = ({
|
|
11759
11490
|
activeTabIndex: activeTabIndexProp,
|
|
11760
11491
|
allowAddTab,
|
|
@@ -11779,7 +11510,7 @@ var Tabstrip = ({
|
|
|
11779
11510
|
variant = "secondary",
|
|
11780
11511
|
...htmlAttributes
|
|
11781
11512
|
}) => {
|
|
11782
|
-
const rootRef =
|
|
11513
|
+
const rootRef = useRef40(null);
|
|
11783
11514
|
const {
|
|
11784
11515
|
activeTabIndex,
|
|
11785
11516
|
focusVisible,
|
|
@@ -11802,12 +11533,12 @@ var Tabstrip = ({
|
|
|
11802
11533
|
orientation
|
|
11803
11534
|
});
|
|
11804
11535
|
const id = useId9(idProp);
|
|
11805
|
-
const className =
|
|
11536
|
+
const className = cx24(classBase26, classNameProp);
|
|
11806
11537
|
const style = styleProp || containerStyle ? {
|
|
11807
11538
|
...styleProp,
|
|
11808
11539
|
...containerStyle
|
|
11809
11540
|
} : void 0;
|
|
11810
|
-
const tabs =
|
|
11541
|
+
const tabs = useMemo20(
|
|
11811
11542
|
() => asReactElements2(children).map((child, index) => {
|
|
11812
11543
|
const {
|
|
11813
11544
|
id: tabId = `${id}-tab-${index}`,
|
|
@@ -11818,10 +11549,10 @@ var Tabstrip = ({
|
|
|
11818
11549
|
showMenuButton = showTabMenuButton
|
|
11819
11550
|
} = child.props;
|
|
11820
11551
|
const selected = index === activeTabIndex;
|
|
11821
|
-
return
|
|
11552
|
+
return React3.cloneElement(child, {
|
|
11822
11553
|
...tabProps,
|
|
11823
11554
|
...tabstripHook.navigationProps,
|
|
11824
|
-
className:
|
|
11555
|
+
className: cx24(className2, tabClassName),
|
|
11825
11556
|
closeable,
|
|
11826
11557
|
"data-overflow-priority": selected ? "1" : void 0,
|
|
11827
11558
|
dragging: draggedItemIndex === index,
|
|
@@ -11830,7 +11561,7 @@ var Tabstrip = ({
|
|
|
11830
11561
|
id: tabId,
|
|
11831
11562
|
index,
|
|
11832
11563
|
key: index,
|
|
11833
|
-
location:
|
|
11564
|
+
location: cx24(location, tabLocation),
|
|
11834
11565
|
selected,
|
|
11835
11566
|
showMenuButton,
|
|
11836
11567
|
tabIndex: selected ? 0 : -1
|
|
@@ -11841,7 +11572,7 @@ var Tabstrip = ({
|
|
|
11841
11572
|
{
|
|
11842
11573
|
...tabstripHook.navigationProps,
|
|
11843
11574
|
"aria-label": "Create Tab",
|
|
11844
|
-
className: `${
|
|
11575
|
+
className: `${classBase26}-addTabButton`,
|
|
11845
11576
|
"data-embedded": true,
|
|
11846
11577
|
icon: "add",
|
|
11847
11578
|
"data-overflow-priority": "1",
|
|
@@ -11869,13 +11600,13 @@ var Tabstrip = ({
|
|
|
11869
11600
|
location
|
|
11870
11601
|
]
|
|
11871
11602
|
);
|
|
11872
|
-
return /* @__PURE__ */
|
|
11873
|
-
/* @__PURE__ */
|
|
11603
|
+
return /* @__PURE__ */ jsxs23(Fragment4, { children: [
|
|
11604
|
+
/* @__PURE__ */ jsx42(
|
|
11874
11605
|
OverflowContainer,
|
|
11875
11606
|
{
|
|
11876
11607
|
...htmlAttributes,
|
|
11877
11608
|
...tabstripHook.containerProps,
|
|
11878
|
-
className:
|
|
11609
|
+
className: cx24(className, `${classBase26}-${variant}`),
|
|
11879
11610
|
id,
|
|
11880
11611
|
orientation,
|
|
11881
11612
|
overflowIcon: "more-horiz",
|
|
@@ -11891,19 +11622,19 @@ var Tabstrip = ({
|
|
|
11891
11622
|
|
|
11892
11623
|
// src/tabstrip/Tab.tsx
|
|
11893
11624
|
import { useForkRef as useForkRef10 } from "@salt-ds/core";
|
|
11894
|
-
import
|
|
11625
|
+
import cx26 from "clsx";
|
|
11895
11626
|
import {
|
|
11896
|
-
forwardRef as
|
|
11897
|
-
useCallback as
|
|
11898
|
-
useRef as
|
|
11627
|
+
forwardRef as forwardRef25,
|
|
11628
|
+
useCallback as useCallback51,
|
|
11629
|
+
useRef as useRef41
|
|
11899
11630
|
} from "react";
|
|
11900
11631
|
|
|
11901
11632
|
// src/tabstrip/TabMenu.tsx
|
|
11902
11633
|
import { PopupMenu as PopupMenu3 } from "@vuu-ui/vuu-popups";
|
|
11903
|
-
import { useMemo as
|
|
11904
|
-
import
|
|
11905
|
-
import { jsx as
|
|
11906
|
-
var
|
|
11634
|
+
import { useMemo as useMemo21 } from "react";
|
|
11635
|
+
import cx25 from "clsx";
|
|
11636
|
+
import { jsx as jsx43 } from "react/jsx-runtime";
|
|
11637
|
+
var classBase27 = "vuuTabMenu";
|
|
11907
11638
|
var TabMenu = ({
|
|
11908
11639
|
allowClose,
|
|
11909
11640
|
allowRename,
|
|
@@ -11914,7 +11645,7 @@ var TabMenu = ({
|
|
|
11914
11645
|
onMenuClose,
|
|
11915
11646
|
index
|
|
11916
11647
|
}) => {
|
|
11917
|
-
const [menuBuilder, menuOptions] =
|
|
11648
|
+
const [menuBuilder, menuOptions] = useMemo21(
|
|
11918
11649
|
() => [
|
|
11919
11650
|
(_location, options) => {
|
|
11920
11651
|
const menuItems = [];
|
|
@@ -11940,15 +11671,15 @@ var TabMenu = ({
|
|
|
11940
11671
|
index
|
|
11941
11672
|
]
|
|
11942
11673
|
);
|
|
11943
|
-
return /* @__PURE__ */
|
|
11674
|
+
return /* @__PURE__ */ jsx43(
|
|
11944
11675
|
PopupMenu3,
|
|
11945
11676
|
{
|
|
11946
11677
|
"aria-label": "context menu",
|
|
11947
|
-
className:
|
|
11678
|
+
className: classBase27,
|
|
11948
11679
|
"data-embedded": true,
|
|
11949
11680
|
menuBuilder,
|
|
11950
11681
|
menuActionHandler: onMenuAction,
|
|
11951
|
-
menuLocation:
|
|
11682
|
+
menuLocation: cx25("tab", location),
|
|
11952
11683
|
menuOptions,
|
|
11953
11684
|
onMenuClose,
|
|
11954
11685
|
tabIndex: -1
|
|
@@ -11957,10 +11688,10 @@ var TabMenu = ({
|
|
|
11957
11688
|
};
|
|
11958
11689
|
|
|
11959
11690
|
// src/tabstrip/Tab.tsx
|
|
11960
|
-
import { jsx as
|
|
11961
|
-
var
|
|
11691
|
+
import { jsx as jsx44, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
11692
|
+
var classBase28 = "vuuTab";
|
|
11962
11693
|
var noop2 = () => void 0;
|
|
11963
|
-
var Tab =
|
|
11694
|
+
var Tab = forwardRef25(function Tab2({
|
|
11964
11695
|
ariaControls,
|
|
11965
11696
|
children,
|
|
11966
11697
|
className,
|
|
@@ -11989,10 +11720,10 @@ var Tab = forwardRef26(function Tab2({
|
|
|
11989
11720
|
if (showMenuButton && typeof onMenuAction !== "function") {
|
|
11990
11721
|
throw Error("Tab onMenuAction must be provided if showMenuButton is set");
|
|
11991
11722
|
}
|
|
11992
|
-
const rootRef =
|
|
11993
|
-
const editableRef =
|
|
11723
|
+
const rootRef = useRef41(null);
|
|
11724
|
+
const editableRef = useRef41(null);
|
|
11994
11725
|
const setForkRef = useForkRef10(ref, rootRef);
|
|
11995
|
-
const handleClick =
|
|
11726
|
+
const handleClick = useCallback51(
|
|
11996
11727
|
(e) => {
|
|
11997
11728
|
if (!editing) {
|
|
11998
11729
|
e.preventDefault();
|
|
@@ -12017,7 +11748,7 @@ var Tab = forwardRef26(function Tab2({
|
|
|
12017
11748
|
};
|
|
12018
11749
|
const getLabel = () => {
|
|
12019
11750
|
if (editable) {
|
|
12020
|
-
return /* @__PURE__ */
|
|
11751
|
+
return /* @__PURE__ */ jsx44(
|
|
12021
11752
|
EditableLabel,
|
|
12022
11753
|
{
|
|
12023
11754
|
editing,
|
|
@@ -12042,18 +11773,18 @@ var Tab = forwardRef26(function Tab2({
|
|
|
12042
11773
|
}
|
|
12043
11774
|
onFocusProp == null ? void 0 : onFocusProp(evt);
|
|
12044
11775
|
};
|
|
12045
|
-
return /* @__PURE__ */
|
|
11776
|
+
return /* @__PURE__ */ jsxs24(
|
|
12046
11777
|
"div",
|
|
12047
11778
|
{
|
|
12048
11779
|
...props,
|
|
12049
11780
|
"aria-controls": ariaControls,
|
|
12050
11781
|
"aria-selected": selected,
|
|
12051
|
-
className:
|
|
12052
|
-
[`${
|
|
11782
|
+
className: cx26(classBase28, className, {
|
|
11783
|
+
[`${classBase28}-closeable`]: closeable,
|
|
12053
11784
|
"vuuDraggable-dragAway": dragging,
|
|
12054
|
-
[`${
|
|
12055
|
-
[`${
|
|
12056
|
-
[`${
|
|
11785
|
+
[`${classBase28}-editing`]: editing,
|
|
11786
|
+
[`${classBase28}-selected`]: selected || void 0,
|
|
11787
|
+
[`${classBase28}-vertical`]: orientation === "vertical",
|
|
12057
11788
|
[`vuuFocusVisible`]: focusVisible
|
|
12058
11789
|
}),
|
|
12059
11790
|
onClick: handleClick,
|
|
@@ -12063,15 +11794,15 @@ var Tab = forwardRef26(function Tab2({
|
|
|
12063
11794
|
role: "tab",
|
|
12064
11795
|
tabIndex,
|
|
12065
11796
|
children: [
|
|
12066
|
-
/* @__PURE__ */
|
|
11797
|
+
/* @__PURE__ */ jsx44("div", { className: `${classBase28}-main`, children: /* @__PURE__ */ jsx44(
|
|
12067
11798
|
"span",
|
|
12068
11799
|
{
|
|
12069
|
-
className: `${
|
|
11800
|
+
className: `${classBase28}-text`,
|
|
12070
11801
|
"data-text": editable ? void 0 : label,
|
|
12071
11802
|
children: children != null ? children : getLabel()
|
|
12072
11803
|
}
|
|
12073
11804
|
) }),
|
|
12074
|
-
showMenuButton ? /* @__PURE__ */
|
|
11805
|
+
showMenuButton ? /* @__PURE__ */ jsx44(
|
|
12075
11806
|
TabMenu,
|
|
12076
11807
|
{
|
|
12077
11808
|
allowClose: closeable,
|
|
@@ -12091,14 +11822,14 @@ var Tab = forwardRef26(function Tab2({
|
|
|
12091
11822
|
|
|
12092
11823
|
// src/toolbar/Toolbar.tsx
|
|
12093
11824
|
import { asReactElements as asReactElements3, useId as useId10 } from "@vuu-ui/vuu-utils";
|
|
12094
|
-
import
|
|
12095
|
-
import
|
|
11825
|
+
import cx27 from "clsx";
|
|
11826
|
+
import React4, { useMemo as useMemo22, useRef as useRef44 } from "react";
|
|
12096
11827
|
|
|
12097
11828
|
// src/toolbar/useToolbar.ts
|
|
12098
11829
|
import { isValidNumber as isValidNumber7 } from "@vuu-ui/vuu-utils";
|
|
12099
11830
|
import {
|
|
12100
|
-
useCallback as
|
|
12101
|
-
useRef as
|
|
11831
|
+
useCallback as useCallback54,
|
|
11832
|
+
useRef as useRef43
|
|
12102
11833
|
} from "react";
|
|
12103
11834
|
|
|
12104
11835
|
// src/toolbar/useKeyboardNavigation.ts
|
|
@@ -12110,9 +11841,9 @@ import {
|
|
|
12110
11841
|
getFocusableElement as getFocusableElement2
|
|
12111
11842
|
} from "@vuu-ui/vuu-utils";
|
|
12112
11843
|
import {
|
|
12113
|
-
useCallback as
|
|
12114
|
-
useRef as
|
|
12115
|
-
useState as
|
|
11844
|
+
useCallback as useCallback52,
|
|
11845
|
+
useRef as useRef42,
|
|
11846
|
+
useState as useState22
|
|
12116
11847
|
} from "react";
|
|
12117
11848
|
import {
|
|
12118
11849
|
ArrowDown as ArrowDown3,
|
|
@@ -12219,22 +11950,22 @@ var useKeyboardNavigation3 = ({
|
|
|
12219
11950
|
onNavigateOutOfBounds,
|
|
12220
11951
|
orientation
|
|
12221
11952
|
}) => {
|
|
12222
|
-
const mouseClickPending =
|
|
12223
|
-
const focusedRef =
|
|
12224
|
-
const [hasFocus, setHasFocus] =
|
|
11953
|
+
const mouseClickPending = useRef42(false);
|
|
11954
|
+
const focusedRef = useRef42(-1);
|
|
11955
|
+
const [hasFocus, setHasFocus] = useState22(false);
|
|
12225
11956
|
const [highlightedIdx, _setHighlightedIdx] = useControlled11({
|
|
12226
11957
|
controlled: highlightedIdxProp,
|
|
12227
11958
|
default: defaultHighlightedIdx,
|
|
12228
11959
|
name: "UseKeyboardNavigation"
|
|
12229
11960
|
});
|
|
12230
|
-
const setHighlightedIdx =
|
|
11961
|
+
const setHighlightedIdx = useCallback52(
|
|
12231
11962
|
(value) => {
|
|
12232
11963
|
_setHighlightedIdx(focusedRef.current = value);
|
|
12233
11964
|
},
|
|
12234
11965
|
[_setHighlightedIdx]
|
|
12235
11966
|
);
|
|
12236
|
-
const keyboardNavigation =
|
|
12237
|
-
const focusItem =
|
|
11967
|
+
const keyboardNavigation = useRef42(false);
|
|
11968
|
+
const focusItem = useCallback52(
|
|
12238
11969
|
(itemIndex, immediateFocus = false, withKeyboard, delay = 70) => {
|
|
12239
11970
|
console.log(`focus item ${itemIndex}`);
|
|
12240
11971
|
setHighlightedIdx(itemIndex);
|
|
@@ -12276,14 +12007,14 @@ var useKeyboardNavigation3 = ({
|
|
|
12276
12007
|
}
|
|
12277
12008
|
}
|
|
12278
12009
|
};
|
|
12279
|
-
const getIndexCount =
|
|
12010
|
+
const getIndexCount = useCallback52(
|
|
12280
12011
|
() => {
|
|
12281
12012
|
var _a2, _b;
|
|
12282
12013
|
return (_b = (_a2 = containerRef.current) == null ? void 0 : _a2.querySelectorAll(`[data-index]`).length) != null ? _b : 0;
|
|
12283
12014
|
},
|
|
12284
12015
|
[containerRef]
|
|
12285
12016
|
);
|
|
12286
|
-
const nextFocusableItemIdx =
|
|
12017
|
+
const nextFocusableItemIdx = useCallback52(
|
|
12287
12018
|
(direction = "fwd", idx) => {
|
|
12288
12019
|
var _a2;
|
|
12289
12020
|
const indexCount = getIndexCount();
|
|
@@ -12311,7 +12042,7 @@ var useKeyboardNavigation3 = ({
|
|
|
12311
12042
|
},
|
|
12312
12043
|
[containerRef, getIndexCount]
|
|
12313
12044
|
);
|
|
12314
|
-
const navigateChildItems =
|
|
12045
|
+
const navigateChildItems = useCallback52(
|
|
12315
12046
|
(e) => {
|
|
12316
12047
|
const direction = navigation2[orientation][e.key];
|
|
12317
12048
|
const nextIdx = nextFocusableItemIdx(direction, highlightedIdx);
|
|
@@ -12331,21 +12062,21 @@ var useKeyboardNavigation3 = ({
|
|
|
12331
12062
|
onNavigateOutOfBounds
|
|
12332
12063
|
]
|
|
12333
12064
|
);
|
|
12334
|
-
const highlightedItemHasMenu =
|
|
12065
|
+
const highlightedItemHasMenu = useCallback52(() => {
|
|
12335
12066
|
const el = getElementByPosition2(containerRef.current, highlightedIdx);
|
|
12336
12067
|
if (el) {
|
|
12337
12068
|
return el.querySelector(".vuuPopupMenu") != null;
|
|
12338
12069
|
}
|
|
12339
12070
|
return false;
|
|
12340
12071
|
}, [containerRef, highlightedIdx]);
|
|
12341
|
-
const highlightedItemInEditState =
|
|
12072
|
+
const highlightedItemInEditState = useCallback52(() => {
|
|
12342
12073
|
const el = getElementByPosition2(containerRef.current, highlightedIdx);
|
|
12343
12074
|
if (el) {
|
|
12344
12075
|
return el.querySelector(".vuuEditableLabel-input") != null;
|
|
12345
12076
|
}
|
|
12346
12077
|
return false;
|
|
12347
12078
|
}, [containerRef, highlightedIdx]);
|
|
12348
|
-
const activateItemMenu =
|
|
12079
|
+
const activateItemMenu = useCallback52(() => {
|
|
12349
12080
|
const el = getElementByPosition2(containerRef.current, highlightedIdx);
|
|
12350
12081
|
const menuEl = el == null ? void 0 : el.querySelector(".vuuPopupMenu");
|
|
12351
12082
|
if (menuEl) {
|
|
@@ -12353,7 +12084,7 @@ var useKeyboardNavigation3 = ({
|
|
|
12353
12084
|
}
|
|
12354
12085
|
return false;
|
|
12355
12086
|
}, [containerRef, highlightedIdx]);
|
|
12356
|
-
const handleKeyDown =
|
|
12087
|
+
const handleKeyDown = useCallback52(
|
|
12357
12088
|
(e) => {
|
|
12358
12089
|
if (getIndexCount() > 0 && isNavigationKey3(e.key, orientation)) {
|
|
12359
12090
|
e.preventDefault();
|
|
@@ -12379,7 +12110,7 @@ var useKeyboardNavigation3 = ({
|
|
|
12379
12110
|
const handleItemClick = (_, itemIndex) => {
|
|
12380
12111
|
setHighlightedIdx(itemIndex);
|
|
12381
12112
|
};
|
|
12382
|
-
const handleFocus =
|
|
12113
|
+
const handleFocus = useCallback52(() => {
|
|
12383
12114
|
if (!hasFocus) {
|
|
12384
12115
|
setHasFocus(true);
|
|
12385
12116
|
if (!mouseClickPending.current) {
|
|
@@ -12389,13 +12120,13 @@ var useKeyboardNavigation3 = ({
|
|
|
12389
12120
|
}
|
|
12390
12121
|
}
|
|
12391
12122
|
}, [hasFocus]);
|
|
12392
|
-
const handleContainerMouseDown =
|
|
12123
|
+
const handleContainerMouseDown = useCallback52(() => {
|
|
12393
12124
|
if (!hasFocus) {
|
|
12394
12125
|
mouseClickPending.current = true;
|
|
12395
12126
|
}
|
|
12396
12127
|
keyboardNavigation.current = false;
|
|
12397
12128
|
}, [hasFocus]);
|
|
12398
|
-
const handleOverflowMenuClose =
|
|
12129
|
+
const handleOverflowMenuClose = useCallback52(
|
|
12399
12130
|
(closeReason) => {
|
|
12400
12131
|
if ((closeReason == null ? void 0 : closeReason.type) === "escape") {
|
|
12401
12132
|
const index = getIndexOfOverflowItem(containerRef.current);
|
|
@@ -12440,7 +12171,7 @@ var useKeyboardNavigation3 = ({
|
|
|
12440
12171
|
|
|
12441
12172
|
// src/toolbar/useSelection.ts
|
|
12442
12173
|
import { isSelectableElement as isSelectableElement2, getClosestIndexItem } from "@vuu-ui/vuu-utils";
|
|
12443
|
-
import { useCallback as
|
|
12174
|
+
import { useCallback as useCallback53 } from "react";
|
|
12444
12175
|
var defaultSelectionKeys3 = ["Enter", " "];
|
|
12445
12176
|
var NO_SELECTION_HANDLERS = {};
|
|
12446
12177
|
var useSelection3 = ({
|
|
@@ -12456,11 +12187,11 @@ var useSelection3 = ({
|
|
|
12456
12187
|
name: "useSelection",
|
|
12457
12188
|
state: "selected"
|
|
12458
12189
|
});
|
|
12459
|
-
const isSelectionEvent =
|
|
12190
|
+
const isSelectionEvent = useCallback53(
|
|
12460
12191
|
(evt) => defaultSelectionKeys3.includes(evt.key),
|
|
12461
12192
|
[]
|
|
12462
12193
|
);
|
|
12463
|
-
const selectItem =
|
|
12194
|
+
const selectItem = useCallback53(
|
|
12464
12195
|
(itemIndex, specialKey = false) => {
|
|
12465
12196
|
const newSelected = allowMultipleSelection(selectionStrategy, specialKey) ? selected.concat(itemIndex) : [itemIndex];
|
|
12466
12197
|
setSelected(newSelected);
|
|
@@ -12468,7 +12199,7 @@ var useSelection3 = ({
|
|
|
12468
12199
|
},
|
|
12469
12200
|
[onSelectionChange, selected, selectionStrategy, setSelected]
|
|
12470
12201
|
);
|
|
12471
|
-
const deselectItem =
|
|
12202
|
+
const deselectItem = useCallback53(
|
|
12472
12203
|
(itemIndex, specialKey = false) => {
|
|
12473
12204
|
const newSelected = selectionStrategy === "deselectable" || selectionStrategy === "multiple-special-key" && !specialKey ? [] : selected.filter((index) => index !== itemIndex);
|
|
12474
12205
|
setSelected(newSelected);
|
|
@@ -12476,7 +12207,7 @@ var useSelection3 = ({
|
|
|
12476
12207
|
},
|
|
12477
12208
|
[onSelectionChange, selected, selectionStrategy, setSelected]
|
|
12478
12209
|
);
|
|
12479
|
-
const handleKeyDown =
|
|
12210
|
+
const handleKeyDown = useCallback53(
|
|
12480
12211
|
(e) => {
|
|
12481
12212
|
if (isSelectionEvent(e) && isSelectableElement2(e.target)) {
|
|
12482
12213
|
if (!selected.includes(highlightedIdx)) {
|
|
@@ -12499,7 +12230,7 @@ var useSelection3 = ({
|
|
|
12499
12230
|
deselectItem
|
|
12500
12231
|
]
|
|
12501
12232
|
);
|
|
12502
|
-
const handleClick =
|
|
12233
|
+
const handleClick = useCallback53(
|
|
12503
12234
|
(e, itemIndex) => {
|
|
12504
12235
|
const element = getClosestIndexItem(e.target);
|
|
12505
12236
|
if (isSelectableElement2(element)) {
|
|
@@ -12535,7 +12266,7 @@ var useToolbar = ({
|
|
|
12535
12266
|
orientation,
|
|
12536
12267
|
selectionStrategy
|
|
12537
12268
|
}) => {
|
|
12538
|
-
const lastSelection =
|
|
12269
|
+
const lastSelection = useRef43(activeItemIndexProp);
|
|
12539
12270
|
const {
|
|
12540
12271
|
focusItem: keyboardHookFocusItem,
|
|
12541
12272
|
highlightedIdx,
|
|
@@ -12562,7 +12293,7 @@ var useToolbar = ({
|
|
|
12562
12293
|
selectionStrategy
|
|
12563
12294
|
});
|
|
12564
12295
|
lastSelection.current = selectionHookSelected;
|
|
12565
|
-
const handleClick =
|
|
12296
|
+
const handleClick = useCallback54(
|
|
12566
12297
|
(evt) => {
|
|
12567
12298
|
var _a2;
|
|
12568
12299
|
const target = evt.target;
|
|
@@ -12577,7 +12308,7 @@ var useToolbar = ({
|
|
|
12577
12308
|
},
|
|
12578
12309
|
[keyboardHookHandleClick, onClick]
|
|
12579
12310
|
);
|
|
12580
|
-
const handleKeyDown =
|
|
12311
|
+
const handleKeyDown = useCallback54(
|
|
12581
12312
|
(evt) => {
|
|
12582
12313
|
keyboardHookHandleKeyDown(evt);
|
|
12583
12314
|
if (!evt.defaultPrevented) {
|
|
@@ -12586,7 +12317,7 @@ var useToolbar = ({
|
|
|
12586
12317
|
},
|
|
12587
12318
|
[keyboardHookHandleKeyDown, onKeyDown]
|
|
12588
12319
|
);
|
|
12589
|
-
const onSwitchWrappedItemIntoView =
|
|
12320
|
+
const onSwitchWrappedItemIntoView = useCallback54(
|
|
12590
12321
|
(item) => {
|
|
12591
12322
|
const index = parseInt(item.index);
|
|
12592
12323
|
if (!isNaN(index)) {
|
|
@@ -12618,8 +12349,8 @@ var useToolbar = ({
|
|
|
12618
12349
|
};
|
|
12619
12350
|
|
|
12620
12351
|
// src/toolbar/Toolbar.tsx
|
|
12621
|
-
import { jsx as
|
|
12622
|
-
var
|
|
12352
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
12353
|
+
var classBase29 = "vuuToolbar";
|
|
12623
12354
|
var Toolbar = ({
|
|
12624
12355
|
activeItemIndex: activeItemIndexProp,
|
|
12625
12356
|
alignItems = "start",
|
|
@@ -12634,7 +12365,7 @@ var Toolbar = ({
|
|
|
12634
12365
|
showSeparators = false,
|
|
12635
12366
|
...props
|
|
12636
12367
|
}) => {
|
|
12637
|
-
const rootRef =
|
|
12368
|
+
const rootRef = useRef44(null);
|
|
12638
12369
|
const {
|
|
12639
12370
|
activeItemIndex,
|
|
12640
12371
|
focusableIdx,
|
|
@@ -12651,7 +12382,7 @@ var Toolbar = ({
|
|
|
12651
12382
|
selectionStrategy
|
|
12652
12383
|
});
|
|
12653
12384
|
const id = useId10(idProp);
|
|
12654
|
-
const items =
|
|
12385
|
+
const items = useMemo22(
|
|
12655
12386
|
() => asReactElements3(children).map((child, index) => {
|
|
12656
12387
|
const {
|
|
12657
12388
|
id: itemId = `${id}-tab-${index}`,
|
|
@@ -12659,9 +12390,9 @@ var Toolbar = ({
|
|
|
12659
12390
|
...ownProps
|
|
12660
12391
|
} = child.props;
|
|
12661
12392
|
const selected = activeItemIndex.includes(index);
|
|
12662
|
-
return
|
|
12393
|
+
return React4.cloneElement(child, {
|
|
12663
12394
|
...forwardCallbackProps(ownProps, itemProps),
|
|
12664
|
-
className:
|
|
12395
|
+
className: cx27("vuuToolbarItem", itemClassName),
|
|
12665
12396
|
"data-overflow-priority": selected ? "1" : void 0,
|
|
12666
12397
|
id: itemId,
|
|
12667
12398
|
key: index,
|
|
@@ -12671,15 +12402,15 @@ var Toolbar = ({
|
|
|
12671
12402
|
}),
|
|
12672
12403
|
[activeItemIndex, children, focusableIdx, id, itemProps]
|
|
12673
12404
|
);
|
|
12674
|
-
return /* @__PURE__ */
|
|
12405
|
+
return /* @__PURE__ */ jsx45(
|
|
12675
12406
|
OverflowContainer,
|
|
12676
12407
|
{
|
|
12677
12408
|
...props,
|
|
12678
12409
|
...toolbarHook.containerProps,
|
|
12679
|
-
className:
|
|
12680
|
-
[`${
|
|
12681
|
-
[`${
|
|
12682
|
-
[`${
|
|
12410
|
+
className: cx27(className, classBase29, `${classBase29}-${orientation}`, {
|
|
12411
|
+
[`${classBase29}-alignCenter`]: alignItems === "center",
|
|
12412
|
+
[`${classBase29}-alignEnd`]: alignItems === "end",
|
|
12413
|
+
[`${classBase29}-withSeparators`]: showSeparators
|
|
12683
12414
|
}),
|
|
12684
12415
|
...props,
|
|
12685
12416
|
ref: rootRef,
|
|
@@ -12690,10 +12421,10 @@ var Toolbar = ({
|
|
|
12690
12421
|
|
|
12691
12422
|
// src/tree/Tree.tsx
|
|
12692
12423
|
import { useForkRef as useForkRef11, useIdMemo as useId11 } from "@salt-ds/core";
|
|
12693
|
-
import
|
|
12424
|
+
import cx28 from "clsx";
|
|
12694
12425
|
import {
|
|
12695
|
-
forwardRef as
|
|
12696
|
-
useRef as
|
|
12426
|
+
forwardRef as forwardRef26,
|
|
12427
|
+
useRef as useRef51
|
|
12697
12428
|
} from "react";
|
|
12698
12429
|
|
|
12699
12430
|
// src/tree/list-dom-utils.ts
|
|
@@ -12712,7 +12443,7 @@ var closestListItem2 = (el) => el.closest("[data-idx],[aria-posinset]");
|
|
|
12712
12443
|
var closestListItemIndex2 = (el) => listItemIndex2(closestListItem2(el));
|
|
12713
12444
|
|
|
12714
12445
|
// src/tree/use-items-with-ids.ts
|
|
12715
|
-
import { useCallback as
|
|
12446
|
+
import { useCallback as useCallback55, useMemo as useMemo23 } from "react";
|
|
12716
12447
|
var PathSeparators2 = /* @__PURE__ */ new Set(["/", "-", "."]);
|
|
12717
12448
|
var isPathSeparator2 = (char) => PathSeparators2.has(char);
|
|
12718
12449
|
var isParentPath2 = (parentPath, childPath) => childPath.startsWith(parentPath) && isPathSeparator2(childPath[parentPath.length]);
|
|
@@ -12736,7 +12467,7 @@ var useItemsWithIds = (sourceProp, idRoot = "root", {
|
|
|
12736
12467
|
return 0;
|
|
12737
12468
|
}
|
|
12738
12469
|
};
|
|
12739
|
-
const isExpanded2 =
|
|
12470
|
+
const isExpanded2 = useCallback55(
|
|
12740
12471
|
(path) => {
|
|
12741
12472
|
if (Array.isArray(revealSelected)) {
|
|
12742
12473
|
return revealSelected.some((id) => isParentPath2(path, id));
|
|
@@ -12745,7 +12476,7 @@ var useItemsWithIds = (sourceProp, idRoot = "root", {
|
|
|
12745
12476
|
},
|
|
12746
12477
|
[defaultExpanded, revealSelected]
|
|
12747
12478
|
);
|
|
12748
|
-
const normalizeItems =
|
|
12479
|
+
const normalizeItems = useCallback55(
|
|
12749
12480
|
(items, indexer, level = 1, path = "", results = [], flattenedSource2 = []) => {
|
|
12750
12481
|
let count2 = 0;
|
|
12751
12482
|
items.forEach((item, i, all) => {
|
|
@@ -12789,10 +12520,10 @@ var useItemsWithIds = (sourceProp, idRoot = "root", {
|
|
|
12789
12520
|
},
|
|
12790
12521
|
[collapsibleHeaders, idRoot, isExpanded2]
|
|
12791
12522
|
);
|
|
12792
|
-
const [count, sourceWithIds, flattenedSource] =
|
|
12523
|
+
const [count, sourceWithIds, flattenedSource] = useMemo23(() => {
|
|
12793
12524
|
return normalizeItems(sourceProp, { index: 0 });
|
|
12794
12525
|
}, [normalizeItems, sourceProp]);
|
|
12795
|
-
const sourceItemById =
|
|
12526
|
+
const sourceItemById = useCallback55(
|
|
12796
12527
|
(id, target = sourceWithIds) => {
|
|
12797
12528
|
const sourceWithId = target.find(
|
|
12798
12529
|
(i) => {
|
|
@@ -12813,8 +12544,8 @@ var useItemsWithIds = (sourceProp, idRoot = "root", {
|
|
|
12813
12544
|
|
|
12814
12545
|
// src/tree/use-selection.ts
|
|
12815
12546
|
import {
|
|
12816
|
-
useCallback as
|
|
12817
|
-
useRef as
|
|
12547
|
+
useCallback as useCallback56,
|
|
12548
|
+
useRef as useRef45
|
|
12818
12549
|
} from "react";
|
|
12819
12550
|
import { useControlled as useControlled12 } from "@salt-ds/core";
|
|
12820
12551
|
var SINGLE = "single";
|
|
@@ -12837,8 +12568,8 @@ var useSelection4 = ({
|
|
|
12837
12568
|
const singleSelect = selection === SINGLE;
|
|
12838
12569
|
const multiSelect = selection === MULTI || selection.startsWith(CHECKBOX2);
|
|
12839
12570
|
const extendedSelect = selection === EXTENDED;
|
|
12840
|
-
const lastActive =
|
|
12841
|
-
const isSelectionEvent =
|
|
12571
|
+
const lastActive = useRef45(-1);
|
|
12572
|
+
const isSelectionEvent = useCallback56(
|
|
12842
12573
|
(evt) => selectionKeys.includes(evt.key),
|
|
12843
12574
|
[selectionKeys]
|
|
12844
12575
|
);
|
|
@@ -12847,7 +12578,7 @@ var useSelection4 = ({
|
|
|
12847
12578
|
default: defaultSelected != null ? defaultSelected : [],
|
|
12848
12579
|
name: "selected"
|
|
12849
12580
|
});
|
|
12850
|
-
const selectItemAtIndex =
|
|
12581
|
+
const selectItemAtIndex = useCallback56(
|
|
12851
12582
|
(evt, idx, id, rangeSelect, preserveExistingSelection = false) => {
|
|
12852
12583
|
const { current: active } = lastActive;
|
|
12853
12584
|
const isSelected2 = selected == null ? void 0 : selected.includes(id);
|
|
@@ -12888,7 +12619,7 @@ var useSelection4 = ({
|
|
|
12888
12619
|
singleSelect
|
|
12889
12620
|
]
|
|
12890
12621
|
);
|
|
12891
|
-
const handleKeyDown =
|
|
12622
|
+
const handleKeyDown = useCallback56(
|
|
12892
12623
|
(evt) => {
|
|
12893
12624
|
if (~highlightedIdx && isSelectionEvent(evt)) {
|
|
12894
12625
|
evt.preventDefault();
|
|
@@ -12913,7 +12644,7 @@ var useSelection4 = ({
|
|
|
12913
12644
|
selectItemAtIndex
|
|
12914
12645
|
]
|
|
12915
12646
|
);
|
|
12916
|
-
const handleKeyboardNavigation =
|
|
12647
|
+
const handleKeyboardNavigation = useCallback56(
|
|
12917
12648
|
(evt, currentIndex) => {
|
|
12918
12649
|
if (extendedSelect && evt.shiftKey) {
|
|
12919
12650
|
const item = treeNodes[currentIndex];
|
|
@@ -12926,7 +12657,7 @@ var useSelection4 = ({
|
|
|
12926
12657
|
onKeyDown: handleKeyDown,
|
|
12927
12658
|
onKeyboardNavigation: handleKeyboardNavigation
|
|
12928
12659
|
};
|
|
12929
|
-
const handleClick =
|
|
12660
|
+
const handleClick = useCallback56(
|
|
12930
12661
|
(evt) => {
|
|
12931
12662
|
if (highlightedIdx !== -1) {
|
|
12932
12663
|
const item = treeNodes[highlightedIdx];
|
|
@@ -12961,18 +12692,18 @@ var useSelection4 = ({
|
|
|
12961
12692
|
|
|
12962
12693
|
// src/tree/use-viewport-tracking.ts
|
|
12963
12694
|
import {
|
|
12964
|
-
useCallback as
|
|
12695
|
+
useCallback as useCallback57,
|
|
12965
12696
|
useEffect as useEffect11,
|
|
12966
12697
|
useLayoutEffect as useLayoutEffect4,
|
|
12967
|
-
useRef as
|
|
12698
|
+
useRef as useRef46
|
|
12968
12699
|
} from "react";
|
|
12969
12700
|
var HeightOnly4 = ["height", "scrollHeight"];
|
|
12970
12701
|
var useViewportTracking2 = (root, highlightedIdx, stickyHeaders = false) => {
|
|
12971
|
-
const scrollTop =
|
|
12972
|
-
const scrolling =
|
|
12973
|
-
const rootHeight =
|
|
12974
|
-
const rootScrollHeight =
|
|
12975
|
-
const scrollIntoView =
|
|
12702
|
+
const scrollTop = useRef46(0);
|
|
12703
|
+
const scrolling = useRef46(false);
|
|
12704
|
+
const rootHeight = useRef46(0);
|
|
12705
|
+
const rootScrollHeight = useRef46(0);
|
|
12706
|
+
const scrollIntoView = useCallback57(
|
|
12976
12707
|
(el) => {
|
|
12977
12708
|
const targetEl = el.ariaExpanded ? el.firstChild : el;
|
|
12978
12709
|
const headerHeight = stickyHeaders ? 30 : 0;
|
|
@@ -12993,7 +12724,7 @@ var useViewportTracking2 = (root, highlightedIdx, stickyHeaders = false) => {
|
|
|
12993
12724
|
},
|
|
12994
12725
|
[root, stickyHeaders]
|
|
12995
12726
|
);
|
|
12996
|
-
const scrollHandler =
|
|
12727
|
+
const scrollHandler = useCallback57((e) => {
|
|
12997
12728
|
scrollTop.current = e.target.scrollTop;
|
|
12998
12729
|
}, []);
|
|
12999
12730
|
useEffect11(() => {
|
|
@@ -13026,7 +12757,7 @@ var useViewportTracking2 = (root, highlightedIdx, stickyHeaders = false) => {
|
|
|
13026
12757
|
}, [highlightedIdx, root, scrollIntoView]);
|
|
13027
12758
|
useEffect11(() => {
|
|
13028
12759
|
}, [stickyHeaders]);
|
|
13029
|
-
const onResize =
|
|
12760
|
+
const onResize = useCallback57(({ height, scrollHeight }) => {
|
|
13030
12761
|
rootHeight.current = height;
|
|
13031
12762
|
rootScrollHeight.current = scrollHeight;
|
|
13032
12763
|
}, []);
|
|
@@ -13035,10 +12766,10 @@ var useViewportTracking2 = (root, highlightedIdx, stickyHeaders = false) => {
|
|
|
13035
12766
|
};
|
|
13036
12767
|
|
|
13037
12768
|
// src/tree/useTree.ts
|
|
13038
|
-
import { useCallback as
|
|
12769
|
+
import { useCallback as useCallback61, useRef as useRef50 } from "react";
|
|
13039
12770
|
|
|
13040
12771
|
// src/tree/use-keyboard-navigation.ts
|
|
13041
|
-
import { useCallback as
|
|
12772
|
+
import { useCallback as useCallback58, useMemo as useMemo24, useRef as useRef47 } from "react";
|
|
13042
12773
|
|
|
13043
12774
|
// src/tree/hierarchical-data-utils.ts
|
|
13044
12775
|
var getNodeParentPath = ({ id }) => {
|
|
@@ -13188,7 +12919,7 @@ var useKeyboardNavigation4 = ({
|
|
|
13188
12919
|
onKeyboardNavigation,
|
|
13189
12920
|
selected = []
|
|
13190
12921
|
}) => {
|
|
13191
|
-
const { bwd: ArrowBwd, fwd: ArrowFwd } =
|
|
12922
|
+
const { bwd: ArrowBwd, fwd: ArrowFwd } = useMemo24(
|
|
13192
12923
|
() => ({
|
|
13193
12924
|
bwd: ArrowUp4,
|
|
13194
12925
|
fwd: ArrowDown4
|
|
@@ -13200,14 +12931,14 @@ var useKeyboardNavigation4 = ({
|
|
|
13200
12931
|
default: defaultHighlightedIdx,
|
|
13201
12932
|
name: "highlightedIdx"
|
|
13202
12933
|
});
|
|
13203
|
-
const setHighlightedIndex =
|
|
12934
|
+
const setHighlightedIndex = useCallback58(
|
|
13204
12935
|
(idx) => {
|
|
13205
12936
|
onHighlight == null ? void 0 : onHighlight(idx);
|
|
13206
12937
|
setHighlightedIdx(idx);
|
|
13207
12938
|
},
|
|
13208
12939
|
[onHighlight, setHighlightedIdx]
|
|
13209
12940
|
);
|
|
13210
|
-
const nextFocusableItemIdx =
|
|
12941
|
+
const nextFocusableItemIdx = useCallback58(
|
|
13211
12942
|
(key = ArrowFwd, idx = key === ArrowFwd ? -1 : treeNodes.length) => {
|
|
13212
12943
|
let nextIdx = nextItemIdx4(treeNodes.length, key, idx);
|
|
13213
12944
|
while (nextIdx !== -1 && (key === ArrowFwd && nextIdx < treeNodes.length || key === ArrowBwd && nextIdx > 0) && !isFocusable3(treeNodes[nextIdx])) {
|
|
@@ -13217,10 +12948,10 @@ var useKeyboardNavigation4 = ({
|
|
|
13217
12948
|
},
|
|
13218
12949
|
[ArrowBwd, ArrowFwd, treeNodes]
|
|
13219
12950
|
);
|
|
13220
|
-
const keyBoardNavigation =
|
|
13221
|
-
const ignoreFocus =
|
|
12951
|
+
const keyBoardNavigation = useRef47(true);
|
|
12952
|
+
const ignoreFocus = useRef47(false);
|
|
13222
12953
|
const setIgnoreFocus = (value) => ignoreFocus.current = value;
|
|
13223
|
-
const handleFocus =
|
|
12954
|
+
const handleFocus = useCallback58(() => {
|
|
13224
12955
|
if (ignoreFocus.current) {
|
|
13225
12956
|
ignoreFocus.current = false;
|
|
13226
12957
|
} else if (selected.length > 0) {
|
|
@@ -13233,7 +12964,7 @@ var useKeyboardNavigation4 = ({
|
|
|
13233
12964
|
setHighlightedIndex(nextFocusableItemIdx());
|
|
13234
12965
|
}
|
|
13235
12966
|
}, [treeNodes, nextFocusableItemIdx, selected, setHighlightedIndex]);
|
|
13236
|
-
const navigateChildItems =
|
|
12967
|
+
const navigateChildItems = useCallback58(
|
|
13237
12968
|
(e) => {
|
|
13238
12969
|
const nextIdx = nextFocusableItemIdx(e.key, highlightedIdx);
|
|
13239
12970
|
if (nextIdx !== highlightedIdx) {
|
|
@@ -13248,7 +12979,7 @@ var useKeyboardNavigation4 = ({
|
|
|
13248
12979
|
setHighlightedIndex
|
|
13249
12980
|
]
|
|
13250
12981
|
);
|
|
13251
|
-
const handleKeyDown =
|
|
12982
|
+
const handleKeyDown = useCallback58(
|
|
13252
12983
|
(e) => {
|
|
13253
12984
|
if (treeNodes.length > 0 && isNavigationKey4(e, "vertical")) {
|
|
13254
12985
|
e.preventDefault();
|
|
@@ -13259,7 +12990,7 @@ var useKeyboardNavigation4 = ({
|
|
|
13259
12990
|
},
|
|
13260
12991
|
[treeNodes, navigateChildItems]
|
|
13261
12992
|
);
|
|
13262
|
-
const listProps =
|
|
12993
|
+
const listProps = useMemo24(
|
|
13263
12994
|
() => ({
|
|
13264
12995
|
onBlur: () => {
|
|
13265
12996
|
setHighlightedIndex(-1);
|
|
@@ -13297,7 +13028,7 @@ var useKeyboardNavigation4 = ({
|
|
|
13297
13028
|
};
|
|
13298
13029
|
|
|
13299
13030
|
// src/tree/use-hierarchical-data.ts
|
|
13300
|
-
import { useRef as
|
|
13031
|
+
import { useRef as useRef48, useState as useState23 } from "react";
|
|
13301
13032
|
var populateIndices = (nodes, results = [], idx = { value: 0 }) => {
|
|
13302
13033
|
let skipToNextHeader = false;
|
|
13303
13034
|
for (const node of nodes) {
|
|
@@ -13319,10 +13050,10 @@ var populateIndices = (nodes, results = [], idx = { value: 0 }) => {
|
|
|
13319
13050
|
return results;
|
|
13320
13051
|
};
|
|
13321
13052
|
var useHierarchicalData = (source) => {
|
|
13322
|
-
const externalSource =
|
|
13323
|
-
const statefulSource =
|
|
13324
|
-
const indexPositions =
|
|
13325
|
-
const [, forceUpdate] =
|
|
13053
|
+
const externalSource = useRef48(source);
|
|
13054
|
+
const statefulSource = useRef48(source);
|
|
13055
|
+
const indexPositions = useRef48(populateIndices(source));
|
|
13056
|
+
const [, forceUpdate] = useState23({});
|
|
13326
13057
|
if (source !== externalSource.current) {
|
|
13327
13058
|
externalSource.current = source;
|
|
13328
13059
|
statefulSource.current = source;
|
|
@@ -13342,7 +13073,7 @@ var useHierarchicalData = (source) => {
|
|
|
13342
13073
|
};
|
|
13343
13074
|
|
|
13344
13075
|
// src/tree/use-collapsible-groups.ts
|
|
13345
|
-
import { useCallback as
|
|
13076
|
+
import { useCallback as useCallback59, useRef as useRef49 } from "react";
|
|
13346
13077
|
var NO_HANDLERS4 = {};
|
|
13347
13078
|
var isToggleElement = (element) => element && element.hasAttribute("aria-expanded");
|
|
13348
13079
|
var useCollapsibleGroups2 = ({
|
|
@@ -13352,23 +13083,23 @@ var useCollapsibleGroups2 = ({
|
|
|
13352
13083
|
setVisibleData,
|
|
13353
13084
|
source
|
|
13354
13085
|
}) => {
|
|
13355
|
-
const fullSource =
|
|
13356
|
-
const stateSource =
|
|
13357
|
-
const setSource =
|
|
13086
|
+
const fullSource = useRef49(source);
|
|
13087
|
+
const stateSource = useRef49(fullSource.current);
|
|
13088
|
+
const setSource = useCallback59(
|
|
13358
13089
|
(value) => {
|
|
13359
13090
|
setVisibleData(stateSource.current = value);
|
|
13360
13091
|
},
|
|
13361
13092
|
[setVisibleData]
|
|
13362
13093
|
);
|
|
13363
|
-
const expandNode =
|
|
13094
|
+
const expandNode = useCallback59(
|
|
13364
13095
|
(nodeList, { id }) => replaceNode(nodeList, id, { expanded: true }),
|
|
13365
13096
|
[]
|
|
13366
13097
|
);
|
|
13367
|
-
const collapseNode =
|
|
13098
|
+
const collapseNode = useCallback59(
|
|
13368
13099
|
(nodeList, { id }) => replaceNode(nodeList, id, { expanded: false }),
|
|
13369
13100
|
[]
|
|
13370
13101
|
);
|
|
13371
|
-
const handleKeyDown =
|
|
13102
|
+
const handleKeyDown = useCallback59(
|
|
13372
13103
|
(e) => {
|
|
13373
13104
|
if (e.key === ArrowRight4 || e.key === Enter2) {
|
|
13374
13105
|
const node = treeNodes[highlightedIdx];
|
|
@@ -13394,7 +13125,7 @@ var useCollapsibleGroups2 = ({
|
|
|
13394
13125
|
const listHandlers = collapsibleHeaders ? {
|
|
13395
13126
|
onKeyDown: handleKeyDown
|
|
13396
13127
|
} : NO_HANDLERS4;
|
|
13397
|
-
const handleClick =
|
|
13128
|
+
const handleClick = useCallback59(
|
|
13398
13129
|
(evt) => {
|
|
13399
13130
|
const el = closestListItem2(evt.target);
|
|
13400
13131
|
if (isToggleElement(el)) {
|
|
@@ -13420,14 +13151,14 @@ var useCollapsibleGroups2 = ({
|
|
|
13420
13151
|
};
|
|
13421
13152
|
|
|
13422
13153
|
// src/tree/use-tree-keyboard-navigation.ts
|
|
13423
|
-
import { useCallback as
|
|
13154
|
+
import { useCallback as useCallback60 } from "react";
|
|
13424
13155
|
var useTreeKeyboardNavigation = ({
|
|
13425
13156
|
highlightedIdx,
|
|
13426
13157
|
hiliteItemAtIndex,
|
|
13427
13158
|
indexPositions,
|
|
13428
13159
|
source
|
|
13429
13160
|
}) => {
|
|
13430
|
-
const handleKeyDown =
|
|
13161
|
+
const handleKeyDown = useCallback60(
|
|
13431
13162
|
(e) => {
|
|
13432
13163
|
if (e.key === ArrowLeft4) {
|
|
13433
13164
|
const node = indexPositions[highlightedIdx];
|
|
@@ -13464,7 +13195,7 @@ var useTree = ({
|
|
|
13464
13195
|
selected: selectedProp,
|
|
13465
13196
|
selection
|
|
13466
13197
|
}) => {
|
|
13467
|
-
const lastSelection =
|
|
13198
|
+
const lastSelection = useRef50(EMPTY_ARRAY2);
|
|
13468
13199
|
const dataHook = useHierarchicalData(sourceWithIds);
|
|
13469
13200
|
const handleKeyboardNavigation = (evt, nextIdx) => {
|
|
13470
13201
|
var _a2, _b;
|
|
@@ -13497,7 +13228,7 @@ var useTree = ({
|
|
|
13497
13228
|
hiliteItemAtIndex: keyboardHook.hiliteItemAtIndex,
|
|
13498
13229
|
indexPositions: dataHook.indexPositions
|
|
13499
13230
|
});
|
|
13500
|
-
const handleClick =
|
|
13231
|
+
const handleClick = useCallback61(
|
|
13501
13232
|
(evt) => {
|
|
13502
13233
|
var _a2, _b, _c;
|
|
13503
13234
|
(_a2 = collapsibleHook.listItemHandlers) == null ? void 0 : _a2.onClick(evt);
|
|
@@ -13507,7 +13238,7 @@ var useTree = ({
|
|
|
13507
13238
|
},
|
|
13508
13239
|
[collapsibleHook, selectionHook]
|
|
13509
13240
|
);
|
|
13510
|
-
const handleKeyDown =
|
|
13241
|
+
const handleKeyDown = useCallback61(
|
|
13511
13242
|
(evt) => {
|
|
13512
13243
|
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
13513
13244
|
(_b = (_a2 = keyboardHook.listProps).onKeyDown) == null ? void 0 : _b.call(_a2, evt);
|
|
@@ -13557,14 +13288,14 @@ var useTree = ({
|
|
|
13557
13288
|
};
|
|
13558
13289
|
|
|
13559
13290
|
// src/tree/Tree.tsx
|
|
13560
|
-
import { jsx as
|
|
13291
|
+
import { jsx as jsx46, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
13561
13292
|
import { createElement as createElement3 } from "react";
|
|
13562
|
-
var
|
|
13293
|
+
var classBase30 = "vuuTree";
|
|
13563
13294
|
var isExpanded = (node) => node.expanded === true;
|
|
13564
13295
|
var TreeNode = ({ children, idx, ...props }) => {
|
|
13565
|
-
return /* @__PURE__ */
|
|
13296
|
+
return /* @__PURE__ */ jsx46("li", { ...props, children });
|
|
13566
13297
|
};
|
|
13567
|
-
var Tree =
|
|
13298
|
+
var Tree = forwardRef26(function Tree2({
|
|
13568
13299
|
allowDragDrop,
|
|
13569
13300
|
className,
|
|
13570
13301
|
defaultSelected,
|
|
@@ -13580,7 +13311,7 @@ var Tree = forwardRef27(function Tree2({
|
|
|
13580
13311
|
}, forwardedRef) {
|
|
13581
13312
|
var _a2;
|
|
13582
13313
|
const id = useId11(idProp);
|
|
13583
|
-
const rootRef =
|
|
13314
|
+
const rootRef = useRef51(null);
|
|
13584
13315
|
const [, sourceWithIds, sourceItemById] = useItemsWithIds(source, id, {
|
|
13585
13316
|
revealSelected: revealSelected ? (_a2 = selectedProp != null ? selectedProp : defaultSelected) != null ? _a2 : false : void 0
|
|
13586
13317
|
});
|
|
@@ -13623,14 +13354,14 @@ var Tree = forwardRef27(function Tree2({
|
|
|
13623
13354
|
const allowGroupSelect = groupSelectionEnabled2(groupSelection);
|
|
13624
13355
|
function addLeafNode(list, item, idx) {
|
|
13625
13356
|
list.push(
|
|
13626
|
-
/* @__PURE__ */
|
|
13357
|
+
/* @__PURE__ */ jsxs25(
|
|
13627
13358
|
TreeNode,
|
|
13628
13359
|
{
|
|
13629
13360
|
...propsCommonToAllListItems,
|
|
13630
13361
|
...getListItemProps(item, idx, highlightedIdx, selected, focusVisible),
|
|
13631
13362
|
children: [
|
|
13632
|
-
item.icon ? /* @__PURE__ */
|
|
13633
|
-
/* @__PURE__ */
|
|
13363
|
+
item.icon ? /* @__PURE__ */ jsx46("span", { className: `${classBase30}Node-icon`, "data-icon": item.icon }) : null,
|
|
13364
|
+
/* @__PURE__ */ jsx46("span", { children: item.label })
|
|
13634
13365
|
]
|
|
13635
13366
|
}
|
|
13636
13367
|
)
|
|
@@ -13648,9 +13379,9 @@ var Tree = forwardRef27(function Tree2({
|
|
|
13648
13379
|
"aria-expanded": child.expanded,
|
|
13649
13380
|
"aria-level": child.level,
|
|
13650
13381
|
"aria-selected": selected.includes(id2) || void 0,
|
|
13651
|
-
className:
|
|
13382
|
+
className: cx28(`${classBase30}Node`, {
|
|
13652
13383
|
focusVisible: focusVisible === i,
|
|
13653
|
-
[`${
|
|
13384
|
+
[`${classBase30}Node-toggle`]: !allowGroupSelect
|
|
13654
13385
|
}),
|
|
13655
13386
|
"data-idx": i,
|
|
13656
13387
|
"data-highlighted": i === highlightedIdx || void 0,
|
|
@@ -13658,20 +13389,20 @@ var Tree = forwardRef27(function Tree2({
|
|
|
13658
13389
|
id: id2,
|
|
13659
13390
|
key: `header-${i}`
|
|
13660
13391
|
},
|
|
13661
|
-
allowGroupSelect ? /* @__PURE__ */
|
|
13662
|
-
/* @__PURE__ */
|
|
13392
|
+
allowGroupSelect ? /* @__PURE__ */ jsxs25("div", { className: `${classBase30}Node-label`, children: [
|
|
13393
|
+
/* @__PURE__ */ jsx46("span", { className: `${classBase30}Node-toggle` }),
|
|
13663
13394
|
title
|
|
13664
|
-
] }) : /* @__PURE__ */
|
|
13665
|
-
child.icon ? /* @__PURE__ */
|
|
13395
|
+
] }) : /* @__PURE__ */ jsxs25("div", { className: `${classBase30}Node-label`, children: [
|
|
13396
|
+
child.icon ? /* @__PURE__ */ jsx46(
|
|
13666
13397
|
"span",
|
|
13667
13398
|
{
|
|
13668
|
-
className: `${
|
|
13399
|
+
className: `${classBase30}Node-icon`,
|
|
13669
13400
|
"data-icon": child.icon
|
|
13670
13401
|
}
|
|
13671
13402
|
) : null,
|
|
13672
|
-
/* @__PURE__ */
|
|
13403
|
+
/* @__PURE__ */ jsx46("span", { children: title })
|
|
13673
13404
|
] }),
|
|
13674
|
-
/* @__PURE__ */
|
|
13405
|
+
/* @__PURE__ */ jsx46("ul", { role: "group", children: isExpanded(child) ? renderSourceContent(child.childNodes, idx) : "" })
|
|
13675
13406
|
)
|
|
13676
13407
|
);
|
|
13677
13408
|
}
|
|
@@ -13688,12 +13419,12 @@ var Tree = forwardRef27(function Tree2({
|
|
|
13688
13419
|
return listItems;
|
|
13689
13420
|
}
|
|
13690
13421
|
}
|
|
13691
|
-
return /* @__PURE__ */
|
|
13422
|
+
return /* @__PURE__ */ jsx46(
|
|
13692
13423
|
"ul",
|
|
13693
13424
|
{
|
|
13694
13425
|
...htmlAttributes,
|
|
13695
13426
|
...listProps,
|
|
13696
|
-
className:
|
|
13427
|
+
className: cx28(classBase30, className),
|
|
13697
13428
|
id: `Tree-${id}`,
|
|
13698
13429
|
ref: useForkRef11(rootRef, forwardedRef),
|
|
13699
13430
|
role: "tree",
|
|
@@ -13709,7 +13440,7 @@ var getListItemProps = (item, idx, highlightedIdx, selected, focusVisible, class
|
|
|
13709
13440
|
"aria-selected": selected.includes(item.id) || void 0,
|
|
13710
13441
|
"data-idx": idx.value,
|
|
13711
13442
|
"data-highlighted": idx.value === highlightedIdx || void 0,
|
|
13712
|
-
className:
|
|
13443
|
+
className: cx28("vuuTreeNode", className, {
|
|
13713
13444
|
focusVisible: focusVisible === idx.value
|
|
13714
13445
|
})
|
|
13715
13446
|
});
|
|
@@ -13730,10 +13461,8 @@ export {
|
|
|
13730
13461
|
ComboBox,
|
|
13731
13462
|
CycleStateButton,
|
|
13732
13463
|
DateInput,
|
|
13733
|
-
DatePicker,
|
|
13734
13464
|
DatePopup,
|
|
13735
13465
|
DateRangeInput,
|
|
13736
|
-
DateRangePicker,
|
|
13737
13466
|
DragDropProvider,
|
|
13738
13467
|
DragDropState,
|
|
13739
13468
|
Dropdown2 as Dropdown,
|
|
@@ -13765,6 +13494,7 @@ export {
|
|
|
13765
13494
|
NOT_HIDDEN,
|
|
13766
13495
|
NOT_OVERFLOWED,
|
|
13767
13496
|
NO_WRAPPED_ITEMS,
|
|
13497
|
+
NullEditAPI,
|
|
13768
13498
|
OverflowContainer,
|
|
13769
13499
|
PageDown,
|
|
13770
13500
|
PageUp,
|