@vuu-ui/vuu-ui-controls 0.8.23-debug → 0.8.24-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 +358 -309
- package/cjs/index.js.map +4 -4
- package/esm/index.js +179 -130
- package/esm/index.js.map +4 -4
- package/index.css +80 -48
- package/index.css.map +3 -3
- package/package.json +8 -8
- package/types/icon-button/Icon.d.ts +7 -0
- package/types/icon-button/IconButton.d.ts +7 -0
- package/types/icon-button/index.d.ts +2 -0
- package/types/index.d.ts +1 -0
- package/types/list/useListHeight.d.ts +2 -1
- package/types/split-button/SplitButton.d.ts +4 -2
- package/types/split-button/useSplitButton.d.ts +3 -3
package/cjs/index.js
CHANGED
|
@@ -62,6 +62,8 @@ __export(src_exports, {
|
|
|
62
62
|
HeightOnly: () => HeightOnly,
|
|
63
63
|
Highlighter: () => Highlighter,
|
|
64
64
|
Home: () => Home,
|
|
65
|
+
Icon: () => Icon,
|
|
66
|
+
IconButton: () => IconButton,
|
|
65
67
|
InstrumentPicker: () => InstrumentPicker,
|
|
66
68
|
InstrumentSearch: () => InstrumentSearch,
|
|
67
69
|
LIST_FOCUS_VISIBLE: () => LIST_FOCUS_VISIBLE,
|
|
@@ -2647,9 +2649,9 @@ var getNonWrappedAndWrappedItems = (container, orientation = "horizontal") => {
|
|
|
2647
2649
|
}
|
|
2648
2650
|
return [nonWrappedItems, wrappedItems];
|
|
2649
2651
|
};
|
|
2650
|
-
var applyOverflowClassToWrappedItems = (container, overflowedItems,
|
|
2652
|
+
var applyOverflowClassToWrappedItems = (container, overflowedItems, classBase26) => {
|
|
2651
2653
|
let ignoreOverflow = false;
|
|
2652
|
-
const className =
|
|
2654
|
+
const className = classBase26 ? `${classBase26}-overflowed` : "overflow";
|
|
2653
2655
|
if (overflowedItems.find(({ index }) => index === "overflow")) {
|
|
2654
2656
|
if (overflowedItems.length === 1) {
|
|
2655
2657
|
ignoreOverflow = true;
|
|
@@ -10174,18 +10176,53 @@ var ExpandoInput = (0, import_react63.forwardRef)(function ExpandoInput2({
|
|
|
10174
10176
|
);
|
|
10175
10177
|
});
|
|
10176
10178
|
|
|
10177
|
-
// src/
|
|
10179
|
+
// src/icon-button/Icon.tsx
|
|
10180
|
+
var import_clsx26 = __toESM(require("clsx"));
|
|
10178
10181
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
10182
|
+
var classBase13 = "vuuIcon";
|
|
10183
|
+
var Icon = ({
|
|
10184
|
+
className,
|
|
10185
|
+
name,
|
|
10186
|
+
size,
|
|
10187
|
+
style: styleProp,
|
|
10188
|
+
...htmlAttributes
|
|
10189
|
+
}) => {
|
|
10190
|
+
const style = typeof size === "number" ? { ...styleProp, "--vuu-icon-size": `${size}px` } : styleProp;
|
|
10191
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
10192
|
+
"span",
|
|
10193
|
+
{
|
|
10194
|
+
...htmlAttributes,
|
|
10195
|
+
className: (0, import_clsx26.default)(classBase13, className),
|
|
10196
|
+
"data-icon": name,
|
|
10197
|
+
style
|
|
10198
|
+
}
|
|
10199
|
+
);
|
|
10200
|
+
};
|
|
10201
|
+
|
|
10202
|
+
// src/icon-button/IconButton.tsx
|
|
10203
|
+
var import_clsx27 = __toESM(require("clsx"));
|
|
10204
|
+
var import_core27 = require("@salt-ds/core");
|
|
10205
|
+
var import_react64 = require("react");
|
|
10206
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
10207
|
+
var classBase14 = "vuuIconButton";
|
|
10208
|
+
var IconButton = (0, import_react64.forwardRef)(
|
|
10209
|
+
function IconButton2({ className, icon, ...buttonProps }, ref) {
|
|
10210
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_core27.Button, { ...buttonProps, className: (0, import_clsx27.default)(classBase14, className), ref, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Icon, { name: icon }) });
|
|
10211
|
+
}
|
|
10212
|
+
);
|
|
10213
|
+
|
|
10214
|
+
// src/inputs/Checkbox.tsx
|
|
10215
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
10179
10216
|
var Checkbox = (props) => {
|
|
10180
10217
|
const { onToggle, checked, label } = props;
|
|
10181
|
-
return /* @__PURE__ */ (0,
|
|
10218
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
10182
10219
|
"div",
|
|
10183
10220
|
{
|
|
10184
10221
|
className: "vuuCheckbox",
|
|
10185
10222
|
onClick: onToggle,
|
|
10186
10223
|
onKeyUp: (e) => e.key === " " && onToggle(),
|
|
10187
10224
|
children: [
|
|
10188
|
-
/* @__PURE__ */ (0,
|
|
10225
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CheckboxIcon, { tabIndex: 0, checked }),
|
|
10189
10226
|
label
|
|
10190
10227
|
]
|
|
10191
10228
|
}
|
|
@@ -10193,13 +10230,13 @@ var Checkbox = (props) => {
|
|
|
10193
10230
|
};
|
|
10194
10231
|
|
|
10195
10232
|
// src/inputs/RadioButton.tsx
|
|
10196
|
-
var
|
|
10233
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
10197
10234
|
var RadioButton = (props) => {
|
|
10198
10235
|
const { onClick, checked, label, groupName } = props;
|
|
10199
|
-
return /* @__PURE__ */ (0,
|
|
10200
|
-
/* @__PURE__ */ (0,
|
|
10201
|
-
/* @__PURE__ */ (0,
|
|
10202
|
-
/* @__PURE__ */ (0,
|
|
10236
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "vuuRadioButton", onClick, children: [
|
|
10237
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "radio", children: [
|
|
10238
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("input", { type: "radio", name: groupName }),
|
|
10239
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(RadioIcon, { checked })
|
|
10203
10240
|
] }),
|
|
10204
10241
|
label
|
|
10205
10242
|
] });
|
|
@@ -10208,13 +10245,13 @@ var RadioButton = (props) => {
|
|
|
10208
10245
|
// src/instrument-picker/InstrumentPicker.tsx
|
|
10209
10246
|
var import_vuu_table2 = require("@vuu-ui/vuu-table");
|
|
10210
10247
|
var import_vuu_utils23 = require("@vuu-ui/vuu-utils");
|
|
10211
|
-
var
|
|
10212
|
-
var
|
|
10248
|
+
var import_core28 = require("@salt-ds/core");
|
|
10249
|
+
var import_react66 = require("react");
|
|
10213
10250
|
|
|
10214
10251
|
// src/instrument-picker/SearchCell.tsx
|
|
10215
10252
|
var import_vuu_utils22 = require("@vuu-ui/vuu-utils");
|
|
10216
|
-
var
|
|
10217
|
-
var
|
|
10253
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
10254
|
+
var classBase15 = "vuuSearchCell";
|
|
10218
10255
|
var SearchCell = ({
|
|
10219
10256
|
column,
|
|
10220
10257
|
columnMap,
|
|
@@ -10222,8 +10259,8 @@ var SearchCell = ({
|
|
|
10222
10259
|
}) => {
|
|
10223
10260
|
const key = columnMap[column.name];
|
|
10224
10261
|
const value = row[key];
|
|
10225
|
-
return /* @__PURE__ */ (0,
|
|
10226
|
-
/* @__PURE__ */ (0,
|
|
10262
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: classBase15, tabIndex: -1, children: [
|
|
10263
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { "data-icon": "draggable" }),
|
|
10227
10264
|
value
|
|
10228
10265
|
] });
|
|
10229
10266
|
};
|
|
@@ -10233,7 +10270,7 @@ var SearchCell = ({
|
|
|
10233
10270
|
|
|
10234
10271
|
// src/instrument-picker/useInstrumentPicker.ts
|
|
10235
10272
|
var import_vuu_table = require("@vuu-ui/vuu-table");
|
|
10236
|
-
var
|
|
10273
|
+
var import_react65 = require("react");
|
|
10237
10274
|
var defaultItemToString = (columns, columnMap) => (row) => {
|
|
10238
10275
|
return columns.map(({ name }) => row[columnMap[name]]).join(" ");
|
|
10239
10276
|
};
|
|
@@ -10248,26 +10285,26 @@ var useInstrumentPicker = ({
|
|
|
10248
10285
|
onSelect,
|
|
10249
10286
|
searchColumns
|
|
10250
10287
|
}) => {
|
|
10251
|
-
const [value, setValue] = (0,
|
|
10288
|
+
const [value, setValue] = (0, import_react65.useState)("");
|
|
10252
10289
|
const [isOpen, setIsOpen] = useControlled({
|
|
10253
10290
|
controlled: isOpenProp,
|
|
10254
10291
|
default: defaultIsOpen != null ? defaultIsOpen : false,
|
|
10255
10292
|
name: "useDropdownList"
|
|
10256
10293
|
});
|
|
10257
10294
|
const { highlightedIndexRef, onKeyDown, tableRef } = (0, import_vuu_table.useControlledTableNavigation)(-1, dataSource.size);
|
|
10258
|
-
const baseFilterPattern = (0,
|
|
10295
|
+
const baseFilterPattern = (0, import_react65.useMemo)(
|
|
10259
10296
|
// TODO make this contains once server supports it
|
|
10260
10297
|
() => searchColumns.map((col) => `${col} starts "__VALUE__"`).join(" or "),
|
|
10261
10298
|
[searchColumns]
|
|
10262
10299
|
);
|
|
10263
|
-
const handleOpenChange = (0,
|
|
10300
|
+
const handleOpenChange = (0, import_react65.useCallback)(
|
|
10264
10301
|
(open, closeReason) => {
|
|
10265
10302
|
setIsOpen(open);
|
|
10266
10303
|
onOpenChange == null ? void 0 : onOpenChange(open, closeReason);
|
|
10267
10304
|
},
|
|
10268
10305
|
[onOpenChange, setIsOpen]
|
|
10269
10306
|
);
|
|
10270
|
-
const handleInputChange = (0,
|
|
10307
|
+
const handleInputChange = (0, import_react65.useCallback)(
|
|
10271
10308
|
(evt) => {
|
|
10272
10309
|
const { value: value2 } = evt.target;
|
|
10273
10310
|
setValue(value2);
|
|
@@ -10285,7 +10322,7 @@ var useInstrumentPicker = ({
|
|
|
10285
10322
|
},
|
|
10286
10323
|
[baseFilterPattern, dataSource, setIsOpen]
|
|
10287
10324
|
);
|
|
10288
|
-
const handleSelectRow = (0,
|
|
10325
|
+
const handleSelectRow = (0, import_react65.useCallback)(
|
|
10289
10326
|
(row) => {
|
|
10290
10327
|
const value2 = itemToString2(row);
|
|
10291
10328
|
setValue(value2);
|
|
@@ -10316,12 +10353,12 @@ var useInstrumentPicker = ({
|
|
|
10316
10353
|
};
|
|
10317
10354
|
|
|
10318
10355
|
// src/instrument-picker/InstrumentPicker.tsx
|
|
10319
|
-
var
|
|
10320
|
-
var
|
|
10356
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
10357
|
+
var classBase16 = "vuuInstrumentPicker";
|
|
10321
10358
|
if (typeof SearchCell !== "function") {
|
|
10322
10359
|
console.warn("Instrument Picker: SearchCell module not loaded ");
|
|
10323
10360
|
}
|
|
10324
|
-
var InstrumentPicker = (0,
|
|
10361
|
+
var InstrumentPicker = (0, import_react66.forwardRef)(function InstrumentPicker2({
|
|
10325
10362
|
TableProps: { dataSource, ...TableProps3 },
|
|
10326
10363
|
className,
|
|
10327
10364
|
columnMap,
|
|
@@ -10353,7 +10390,7 @@ var InstrumentPicker = (0, import_react65.forwardRef)(function InstrumentPicker2
|
|
|
10353
10390
|
onSelect,
|
|
10354
10391
|
searchColumns
|
|
10355
10392
|
});
|
|
10356
|
-
const endAdornment = (0,
|
|
10393
|
+
const endAdornment = (0, import_react66.useMemo)(() => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { "data-icon": "chevron-down" }), []);
|
|
10357
10394
|
const tableProps = {
|
|
10358
10395
|
...TableProps3,
|
|
10359
10396
|
config: {
|
|
@@ -10361,7 +10398,7 @@ var InstrumentPicker = (0, import_react65.forwardRef)(function InstrumentPicker2
|
|
|
10361
10398
|
zebraStripes: false
|
|
10362
10399
|
}
|
|
10363
10400
|
};
|
|
10364
|
-
return /* @__PURE__ */ (0,
|
|
10401
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
10365
10402
|
DropdownBase,
|
|
10366
10403
|
{
|
|
10367
10404
|
...htmlAttributes,
|
|
@@ -10374,8 +10411,8 @@ var InstrumentPicker = (0, import_react65.forwardRef)(function InstrumentPicker2
|
|
|
10374
10411
|
ref: forwardedRef,
|
|
10375
10412
|
width,
|
|
10376
10413
|
children: [
|
|
10377
|
-
/* @__PURE__ */ (0,
|
|
10378
|
-
|
|
10414
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
10415
|
+
import_core28.Input,
|
|
10379
10416
|
{
|
|
10380
10417
|
...inputProps,
|
|
10381
10418
|
disabled,
|
|
@@ -10383,14 +10420,14 @@ var InstrumentPicker = (0, import_react65.forwardRef)(function InstrumentPicker2
|
|
|
10383
10420
|
value
|
|
10384
10421
|
}
|
|
10385
10422
|
),
|
|
10386
|
-
/* @__PURE__ */ (0,
|
|
10423
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
10387
10424
|
import_vuu_table2.Table,
|
|
10388
10425
|
{
|
|
10389
10426
|
rowHeight: 25,
|
|
10390
10427
|
renderBufferSize: 100,
|
|
10391
10428
|
...tableProps,
|
|
10392
10429
|
...tableHandlers,
|
|
10393
|
-
className: `${
|
|
10430
|
+
className: `${classBase16}-list`,
|
|
10394
10431
|
height: 200,
|
|
10395
10432
|
highlightedIndex,
|
|
10396
10433
|
dataSource,
|
|
@@ -10407,14 +10444,14 @@ var InstrumentPicker = (0, import_react65.forwardRef)(function InstrumentPicker2
|
|
|
10407
10444
|
// src/instrument-search/InstrumentSearch.tsx
|
|
10408
10445
|
var import_vuu_layout = require("@vuu-ui/vuu-layout");
|
|
10409
10446
|
var import_vuu_table3 = require("@vuu-ui/vuu-table");
|
|
10410
|
-
var
|
|
10411
|
-
var
|
|
10412
|
-
var
|
|
10447
|
+
var import_core29 = require("@salt-ds/core");
|
|
10448
|
+
var import_clsx28 = __toESM(require("clsx"));
|
|
10449
|
+
var import_react68 = require("react");
|
|
10413
10450
|
|
|
10414
10451
|
// src/instrument-search/SearchCell.tsx
|
|
10415
10452
|
var import_vuu_utils24 = require("@vuu-ui/vuu-utils");
|
|
10416
|
-
var
|
|
10417
|
-
var
|
|
10453
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
10454
|
+
var classBase17 = "vuuSearchCell";
|
|
10418
10455
|
var SearchCell2 = ({
|
|
10419
10456
|
column,
|
|
10420
10457
|
columnMap,
|
|
@@ -10422,8 +10459,8 @@ var SearchCell2 = ({
|
|
|
10422
10459
|
}) => {
|
|
10423
10460
|
const key = columnMap[column.name];
|
|
10424
10461
|
const value = row[key];
|
|
10425
|
-
return /* @__PURE__ */ (0,
|
|
10426
|
-
/* @__PURE__ */ (0,
|
|
10462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: classBase17, tabIndex: -1, children: [
|
|
10463
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { "data-icon": "draggable" }),
|
|
10427
10464
|
value
|
|
10428
10465
|
] });
|
|
10429
10466
|
};
|
|
@@ -10432,18 +10469,18 @@ var SearchCell2 = ({
|
|
|
10432
10469
|
});
|
|
10433
10470
|
|
|
10434
10471
|
// src/instrument-search/useInstrumentSearch.ts
|
|
10435
|
-
var
|
|
10472
|
+
var import_react67 = require("react");
|
|
10436
10473
|
var useInstrumentSearch = ({
|
|
10437
10474
|
dataSource,
|
|
10438
10475
|
searchColumns = ["description"]
|
|
10439
10476
|
}) => {
|
|
10440
|
-
const [searchState, setSearchState] = (0,
|
|
10441
|
-
const baseFilterPattern = (0,
|
|
10477
|
+
const [searchState, setSearchState] = (0, import_react67.useState)({ searchText: "", filter: "" });
|
|
10478
|
+
const baseFilterPattern = (0, import_react67.useMemo)(
|
|
10442
10479
|
// TODO make this contains once server supports it
|
|
10443
10480
|
() => searchColumns.map((col) => `${col} starts "__VALUE__"`).join(" or "),
|
|
10444
10481
|
[searchColumns]
|
|
10445
10482
|
);
|
|
10446
|
-
const handleChange = (0,
|
|
10483
|
+
const handleChange = (0, import_react67.useCallback)(
|
|
10447
10484
|
(evt) => {
|
|
10448
10485
|
const { value } = evt.target;
|
|
10449
10486
|
const filter = baseFilterPattern.replaceAll("__VALUE__", value);
|
|
@@ -10467,8 +10504,8 @@ var useInstrumentSearch = ({
|
|
|
10467
10504
|
};
|
|
10468
10505
|
|
|
10469
10506
|
// src/instrument-search/InstrumentSearch.tsx
|
|
10470
|
-
var
|
|
10471
|
-
var
|
|
10507
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
10508
|
+
var classBase18 = "vuuInstrumentSearch";
|
|
10472
10509
|
if (typeof SearchCell2 !== "function") {
|
|
10473
10510
|
console.warn("Instrument Search: SearchCell module not loaded ");
|
|
10474
10511
|
}
|
|
@@ -10488,7 +10525,7 @@ var defaultTableConfig = {
|
|
|
10488
10525
|
],
|
|
10489
10526
|
rowSeparators: true
|
|
10490
10527
|
};
|
|
10491
|
-
var searchIcon = /* @__PURE__ */ (0,
|
|
10528
|
+
var searchIcon = /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { "data-icon": "search" });
|
|
10492
10529
|
var InstrumentSearch = ({
|
|
10493
10530
|
TableProps: TableProps3,
|
|
10494
10531
|
autoFocus = false,
|
|
@@ -10504,15 +10541,15 @@ var InstrumentSearch = ({
|
|
|
10504
10541
|
searchColumns
|
|
10505
10542
|
});
|
|
10506
10543
|
const { highlightedIndexRef, onHighlight, onKeyDown, tableRef } = (0, import_vuu_table3.useControlledTableNavigation)(-1, (_a2 = dataSource == null ? void 0 : dataSource.size) != null ? _a2 : 0);
|
|
10507
|
-
const searchCallbackRef = (0,
|
|
10544
|
+
const searchCallbackRef = (0, import_react68.useCallback)((el) => {
|
|
10508
10545
|
setTimeout(() => {
|
|
10509
10546
|
var _a3;
|
|
10510
10547
|
(_a3 = el == null ? void 0 : el.querySelector("input")) == null ? void 0 : _a3.focus();
|
|
10511
10548
|
}, 100);
|
|
10512
10549
|
}, []);
|
|
10513
|
-
return /* @__PURE__ */ (0,
|
|
10514
|
-
/* @__PURE__ */ (0,
|
|
10515
|
-
|
|
10550
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { ...htmlAttributes, className: (0, import_clsx28.default)(classBase18, className), children: [
|
|
10551
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: `${classBase18}-inputField`, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
10552
|
+
import_core29.Input,
|
|
10516
10553
|
{
|
|
10517
10554
|
inputProps: { onKeyDown },
|
|
10518
10555
|
endAdornment: searchIcon,
|
|
@@ -10522,7 +10559,7 @@ var InstrumentSearch = ({
|
|
|
10522
10559
|
onChange
|
|
10523
10560
|
}
|
|
10524
10561
|
) }),
|
|
10525
|
-
dataSource ? /* @__PURE__ */ (0,
|
|
10562
|
+
dataSource ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
10526
10563
|
import_vuu_table3.Table,
|
|
10527
10564
|
{
|
|
10528
10565
|
disableFocus: true,
|
|
@@ -10532,7 +10569,7 @@ var InstrumentSearch = ({
|
|
|
10532
10569
|
highlightedIndex: highlightedIndexRef.current,
|
|
10533
10570
|
renderBufferSize: 100,
|
|
10534
10571
|
...TableProps3,
|
|
10535
|
-
className: `${
|
|
10572
|
+
className: `${classBase18}-list`,
|
|
10536
10573
|
dataSource,
|
|
10537
10574
|
navigationStyle: "row",
|
|
10538
10575
|
onHighlight,
|
|
@@ -10547,10 +10584,10 @@ var _a;
|
|
|
10547
10584
|
|
|
10548
10585
|
// src/price-ticker/PriceTicker.tsx
|
|
10549
10586
|
var import_vuu_utils25 = require("@vuu-ui/vuu-utils");
|
|
10550
|
-
var
|
|
10551
|
-
var
|
|
10552
|
-
var
|
|
10553
|
-
var
|
|
10587
|
+
var import_react69 = require("react");
|
|
10588
|
+
var import_clsx29 = __toESM(require("clsx"));
|
|
10589
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
10590
|
+
var classBase19 = "vuuPriceTicker";
|
|
10554
10591
|
var getValueFormatter = (decimals) => (0, import_vuu_utils25.numericFormatter)({
|
|
10555
10592
|
type: {
|
|
10556
10593
|
name: "number",
|
|
@@ -10561,7 +10598,7 @@ var getValueFormatter = (decimals) => (0, import_vuu_utils25.numericFormatter)({
|
|
|
10561
10598
|
}
|
|
10562
10599
|
});
|
|
10563
10600
|
var INITIAL_VALUE = [void 0, void 0];
|
|
10564
|
-
var PriceTicker = (0,
|
|
10601
|
+
var PriceTicker = (0, import_react69.memo)(
|
|
10565
10602
|
({
|
|
10566
10603
|
className,
|
|
10567
10604
|
decimals = 2,
|
|
@@ -10569,14 +10606,14 @@ var PriceTicker = (0, import_react68.memo)(
|
|
|
10569
10606
|
showArrow,
|
|
10570
10607
|
...htmlAttributes
|
|
10571
10608
|
}) => {
|
|
10572
|
-
const ref = (0,
|
|
10609
|
+
const ref = (0, import_react69.useRef)(INITIAL_VALUE);
|
|
10573
10610
|
const [prevValue, prevDirection] = ref.current;
|
|
10574
|
-
const formatNumber = (0,
|
|
10611
|
+
const formatNumber = (0, import_react69.useMemo)(() => getValueFormatter(decimals), [decimals]);
|
|
10575
10612
|
const direction = (0, import_vuu_utils25.isValidNumber)(prevValue) ? (0, import_vuu_utils25.getMovingValueDirection)(price, prevDirection, prevValue, decimals) : "";
|
|
10576
10613
|
ref.current = [price, direction];
|
|
10577
|
-
return /* @__PURE__ */ (0,
|
|
10614
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { ...htmlAttributes, className: (0, import_clsx29.default)(classBase19, className, direction), children: [
|
|
10578
10615
|
formatNumber(price),
|
|
10579
|
-
showArrow ? /* @__PURE__ */ (0,
|
|
10616
|
+
showArrow ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { "data-icon": "price-arrow" }) : null
|
|
10580
10617
|
] });
|
|
10581
10618
|
}
|
|
10582
10619
|
);
|
|
@@ -10584,128 +10621,141 @@ PriceTicker.displayName = "PriceTicker";
|
|
|
10584
10621
|
|
|
10585
10622
|
// src/split-button/SplitButton.tsx
|
|
10586
10623
|
var import_vuu_popups5 = require("@vuu-ui/vuu-popups");
|
|
10587
|
-
var
|
|
10624
|
+
var import_core30 = require("@salt-ds/core");
|
|
10588
10625
|
|
|
10589
10626
|
// src/split-button/useSplitButton.ts
|
|
10590
10627
|
var import_vuu_utils26 = require("@vuu-ui/vuu-utils");
|
|
10591
|
-
var
|
|
10628
|
+
var import_react70 = require("react");
|
|
10592
10629
|
var useSplitButton = ({
|
|
10593
10630
|
ButtonProps: ButtonPropsProp,
|
|
10594
10631
|
PopupMenuProps: PopupMenuProps3,
|
|
10595
|
-
classBase:
|
|
10632
|
+
classBase: classBase26,
|
|
10596
10633
|
onClick,
|
|
10597
10634
|
segmented
|
|
10598
10635
|
}) => {
|
|
10599
|
-
const buttonRef = (0,
|
|
10600
|
-
const rootRef = (0,
|
|
10601
|
-
const onMenuClose = (0,
|
|
10636
|
+
const buttonRef = (0, import_react70.useRef)(null);
|
|
10637
|
+
const rootRef = (0, import_react70.useRef)(null);
|
|
10638
|
+
const onMenuClose = (0, import_react70.useCallback)((reason) => {
|
|
10602
10639
|
var _a2;
|
|
10603
10640
|
if ((reason == null ? void 0 : reason.type) !== "tab-away") {
|
|
10604
|
-
(_a2 = rootRef.current) == null ? void 0 : _a2.
|
|
10641
|
+
const buttonMain = (_a2 = rootRef.current) == null ? void 0 : _a2.querySelector(
|
|
10642
|
+
".vuuSplitButton-main"
|
|
10643
|
+
);
|
|
10644
|
+
buttonMain == null ? void 0 : buttonMain.focus();
|
|
10605
10645
|
}
|
|
10606
10646
|
}, []);
|
|
10607
10647
|
const menuProps = {
|
|
10608
10648
|
...PopupMenuProps3,
|
|
10609
10649
|
anchorElement: rootRef,
|
|
10610
|
-
menuClassName: `${
|
|
10650
|
+
menuClassName: `${classBase26}-menu`,
|
|
10611
10651
|
onMenuClose,
|
|
10612
10652
|
popupPlacement: "below-full-width"
|
|
10613
10653
|
};
|
|
10614
|
-
const handleRootFocus = (0,
|
|
10615
|
-
|
|
10616
|
-
|
|
10617
|
-
|
|
10618
|
-
|
|
10619
|
-
|
|
10654
|
+
const handleRootFocus = (0, import_react70.useCallback)(() => {
|
|
10655
|
+
const { current: splitButton } = rootRef;
|
|
10656
|
+
if (!(splitButton == null ? void 0 : splitButton.classList.contains("vuuFocusVisible"))) {
|
|
10657
|
+
splitButton == null ? void 0 : splitButton.classList.add("vuuFocusVisible");
|
|
10658
|
+
}
|
|
10659
|
+
}, []);
|
|
10660
|
+
const handleRootBlur = (0, import_react70.useCallback)((evt) => {
|
|
10661
|
+
const { current: splitButton } = rootRef;
|
|
10662
|
+
const target = evt.relatedTarget;
|
|
10663
|
+
if (!(splitButton == null ? void 0 : splitButton.contains(target))) {
|
|
10664
|
+
if (splitButton == null ? void 0 : splitButton.classList.contains("vuuFocusVisible")) {
|
|
10665
|
+
splitButton.classList.remove("vuuFocusVisible");
|
|
10620
10666
|
}
|
|
10621
|
-
}
|
|
10622
|
-
|
|
10623
|
-
)
|
|
10624
|
-
const handleButtonKeyDown = (0, import_react69.useCallback)(
|
|
10667
|
+
}
|
|
10668
|
+
}, []);
|
|
10669
|
+
const handleButtonKeyDown = (0, import_react70.useCallback)(
|
|
10625
10670
|
(evt) => {
|
|
10626
10671
|
var _a2;
|
|
10627
10672
|
if (evt.key === "ArrowDown") {
|
|
10628
10673
|
const popupTrigger = (_a2 = rootRef.current) == null ? void 0 : _a2.querySelector(
|
|
10629
|
-
`.${
|
|
10674
|
+
`.${classBase26}-trigger`
|
|
10630
10675
|
);
|
|
10631
10676
|
if (popupTrigger) {
|
|
10632
10677
|
(0, import_vuu_utils26.dispatchMouseEvent)(popupTrigger, "click");
|
|
10633
10678
|
}
|
|
10634
10679
|
}
|
|
10635
10680
|
},
|
|
10636
|
-
[
|
|
10681
|
+
[classBase26]
|
|
10637
10682
|
);
|
|
10638
|
-
const handleClick = (0,
|
|
10683
|
+
const handleClick = (0, import_react70.useCallback)(
|
|
10639
10684
|
(evt) => {
|
|
10640
10685
|
onClick == null ? void 0 : onClick(evt);
|
|
10641
10686
|
},
|
|
10642
10687
|
[onClick]
|
|
10643
10688
|
);
|
|
10644
|
-
const
|
|
10689
|
+
const ButtonProps6 = {
|
|
10645
10690
|
...ButtonPropsProp,
|
|
10646
10691
|
onClick: segmented ? handleClick : void 0,
|
|
10647
10692
|
onKeyDown: handleButtonKeyDown
|
|
10648
10693
|
};
|
|
10649
10694
|
return {
|
|
10650
|
-
ButtonProps:
|
|
10695
|
+
ButtonProps: ButtonProps6,
|
|
10651
10696
|
PopupMenuProps: menuProps,
|
|
10652
10697
|
buttonRef,
|
|
10653
10698
|
rootRef,
|
|
10654
10699
|
onClick: segmented ? void 0 : handleClick,
|
|
10700
|
+
onBlur: handleRootBlur,
|
|
10655
10701
|
onFocus: handleRootFocus
|
|
10656
10702
|
};
|
|
10657
10703
|
};
|
|
10658
10704
|
|
|
10659
10705
|
// src/split-button/SplitButton.tsx
|
|
10660
|
-
var
|
|
10661
|
-
var
|
|
10662
|
-
var
|
|
10706
|
+
var import_clsx30 = __toESM(require("clsx"));
|
|
10707
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
10708
|
+
var classBase20 = "vuuSplitButton";
|
|
10663
10709
|
var SplitButton = ({
|
|
10664
10710
|
ButtonProps: ButtonPropsProp,
|
|
10665
10711
|
PopupMenuProps: PopupMenuPropsProp,
|
|
10666
10712
|
buttonText,
|
|
10713
|
+
disabled = false,
|
|
10667
10714
|
onClick,
|
|
10668
10715
|
segmented = false,
|
|
10716
|
+
variant = "primary",
|
|
10669
10717
|
...htmlAttributes
|
|
10670
10718
|
}) => {
|
|
10671
10719
|
var _a2;
|
|
10672
|
-
const { ButtonProps:
|
|
10720
|
+
const { ButtonProps: ButtonProps6, buttonRef, rootRef, PopupMenuProps: PopupMenuProps3, ...rootProps } = useSplitButton({
|
|
10673
10721
|
ButtonProps: ButtonPropsProp,
|
|
10674
10722
|
PopupMenuProps: PopupMenuPropsProp,
|
|
10675
|
-
classBase:
|
|
10723
|
+
classBase: classBase20,
|
|
10676
10724
|
onClick,
|
|
10677
10725
|
segmented
|
|
10678
10726
|
});
|
|
10679
|
-
|
|
10680
|
-
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
10727
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
10681
10728
|
"div",
|
|
10682
10729
|
{
|
|
10683
10730
|
...htmlAttributes,
|
|
10684
10731
|
...rootProps,
|
|
10685
|
-
className: (0,
|
|
10686
|
-
[`${
|
|
10732
|
+
className: (0, import_clsx30.default)(classBase20, `${classBase20}-${variant}`, {
|
|
10733
|
+
[`${classBase20}-disabled`]: disabled,
|
|
10734
|
+
[`${classBase20}-segmented`]: segmented
|
|
10687
10735
|
}),
|
|
10688
10736
|
ref: rootRef,
|
|
10689
10737
|
"data-showcase-center": true,
|
|
10690
|
-
tabIndex: segmented ? void 0 : 0,
|
|
10691
10738
|
children: [
|
|
10692
|
-
/* @__PURE__ */ (0,
|
|
10693
|
-
|
|
10739
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10740
|
+
import_core30.Button,
|
|
10694
10741
|
{
|
|
10695
|
-
...
|
|
10696
|
-
className: `${
|
|
10742
|
+
...ButtonProps6,
|
|
10743
|
+
className: `${classBase20}-main`,
|
|
10744
|
+
disabled,
|
|
10697
10745
|
ref: buttonRef,
|
|
10698
|
-
variant
|
|
10746
|
+
variant,
|
|
10699
10747
|
children: buttonText
|
|
10700
10748
|
}
|
|
10701
10749
|
),
|
|
10702
|
-
/* @__PURE__ */ (0,
|
|
10750
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10703
10751
|
import_vuu_popups5.PopupMenu,
|
|
10704
10752
|
{
|
|
10705
10753
|
...PopupMenuProps3,
|
|
10706
|
-
className: `${
|
|
10754
|
+
className: `${classBase20}-trigger`,
|
|
10755
|
+
disabled,
|
|
10707
10756
|
icon: (_a2 = PopupMenuProps3 == null ? void 0 : PopupMenuProps3.icon) != null ? _a2 : "chevron-down",
|
|
10708
|
-
tabIndex: segmented ? 0 : -1
|
|
10757
|
+
tabIndex: segmented ? 0 : -1,
|
|
10758
|
+
variant
|
|
10709
10759
|
}
|
|
10710
10760
|
)
|
|
10711
10761
|
]
|
|
@@ -10715,13 +10765,12 @@ var SplitButton = ({
|
|
|
10715
10765
|
|
|
10716
10766
|
// src/tabstrip/Tabstrip.tsx
|
|
10717
10767
|
var import_vuu_utils32 = require("@vuu-ui/vuu-utils");
|
|
10718
|
-
var
|
|
10719
|
-
var
|
|
10720
|
-
var import_react74 = __toESM(require("react"));
|
|
10768
|
+
var import_clsx31 = __toESM(require("clsx"));
|
|
10769
|
+
var import_react75 = __toESM(require("react"));
|
|
10721
10770
|
|
|
10722
10771
|
// src/tabstrip/useTabstrip.ts
|
|
10723
10772
|
var import_vuu_utils31 = require("@vuu-ui/vuu-utils");
|
|
10724
|
-
var
|
|
10773
|
+
var import_react74 = require("react");
|
|
10725
10774
|
|
|
10726
10775
|
// src/tabstrip/TabMenuOptions.ts
|
|
10727
10776
|
var isTabMenuOptions = (options) => typeof options === "object" && options !== null && "tabIndex" in options && typeof options.tabIndex === "number";
|
|
@@ -10754,22 +10803,22 @@ var getIndexOfEditedItem = (container) => getIndexOfItem(container, ".vuuEditabl
|
|
|
10754
10803
|
|
|
10755
10804
|
// src/tabstrip/useAnimatedSelectionThumb.ts
|
|
10756
10805
|
var import_vuu_utils28 = require("@vuu-ui/vuu-utils");
|
|
10757
|
-
var
|
|
10806
|
+
var import_react71 = require("react");
|
|
10758
10807
|
var useAnimatedSelectionThumb = (containerRef, activeTabIndex, orientation = "horizontal") => {
|
|
10759
|
-
const animationSuspendedRef = (0,
|
|
10760
|
-
const suspendAnimation = (0,
|
|
10808
|
+
const animationSuspendedRef = (0, import_react71.useRef)(false);
|
|
10809
|
+
const suspendAnimation = (0, import_react71.useCallback)(() => {
|
|
10761
10810
|
animationSuspendedRef.current = true;
|
|
10762
10811
|
}, []);
|
|
10763
|
-
const resumeAnimation = (0,
|
|
10812
|
+
const resumeAnimation = (0, import_react71.useCallback)(() => {
|
|
10764
10813
|
animationSuspendedRef.current = false;
|
|
10765
10814
|
}, []);
|
|
10766
|
-
const onTransitionEnd = (0,
|
|
10815
|
+
const onTransitionEnd = (0, import_react71.useCallback)(() => {
|
|
10767
10816
|
var _a2, _b;
|
|
10768
10817
|
(_a2 = containerRef.current) == null ? void 0 : _a2.style.setProperty("--tab-thumb-transition", "none");
|
|
10769
10818
|
(_b = containerRef.current) == null ? void 0 : _b.removeEventListener("transitionend", onTransitionEnd);
|
|
10770
10819
|
}, [containerRef]);
|
|
10771
|
-
const lastSelectedRef = (0,
|
|
10772
|
-
return (0,
|
|
10820
|
+
const lastSelectedRef = (0, import_react71.useRef)(-1);
|
|
10821
|
+
return (0, import_react71.useMemo)(() => {
|
|
10773
10822
|
var _a2, _b;
|
|
10774
10823
|
let offset = 0;
|
|
10775
10824
|
let size = 0;
|
|
@@ -10837,9 +10886,9 @@ var useAnimatedSelectionThumb = (containerRef, activeTabIndex, orientation = "ho
|
|
|
10837
10886
|
};
|
|
10838
10887
|
|
|
10839
10888
|
// src/tabstrip/useKeyboardNavigation.ts
|
|
10840
|
-
var
|
|
10889
|
+
var import_core31 = require("@salt-ds/core");
|
|
10841
10890
|
var import_vuu_utils29 = require("@vuu-ui/vuu-utils");
|
|
10842
|
-
var
|
|
10891
|
+
var import_react72 = require("react");
|
|
10843
10892
|
var import_vuu_utils30 = require("@vuu-ui/vuu-utils");
|
|
10844
10893
|
var navigation = {
|
|
10845
10894
|
horizontal: {
|
|
@@ -10889,23 +10938,23 @@ var useKeyboardNavigation2 = ({
|
|
|
10889
10938
|
selectedIndex: selectedTabIndex = 0
|
|
10890
10939
|
}) => {
|
|
10891
10940
|
const manualActivation = keyBoardActivation === "manual";
|
|
10892
|
-
const mouseClickPending = (0,
|
|
10893
|
-
const focusedRef = (0,
|
|
10894
|
-
const [hasFocus, setHasFocus] = (0,
|
|
10895
|
-
const [, forceRefresh] = (0,
|
|
10896
|
-
const [highlightedIdx, _setHighlightedIdx] = (0,
|
|
10941
|
+
const mouseClickPending = (0, import_react72.useRef)(false);
|
|
10942
|
+
const focusedRef = (0, import_react72.useRef)(-1);
|
|
10943
|
+
const [hasFocus, setHasFocus] = (0, import_react72.useState)(false);
|
|
10944
|
+
const [, forceRefresh] = (0, import_react72.useState)({});
|
|
10945
|
+
const [highlightedIdx, _setHighlightedIdx] = (0, import_core31.useControlled)({
|
|
10897
10946
|
controlled: highlightedIdxProp,
|
|
10898
10947
|
default: defaultHighlightedIdx,
|
|
10899
10948
|
name: "UseKeyboardNavigation"
|
|
10900
10949
|
});
|
|
10901
|
-
const setHighlightedIdx = (0,
|
|
10950
|
+
const setHighlightedIdx = (0, import_react72.useCallback)(
|
|
10902
10951
|
(value) => {
|
|
10903
10952
|
_setHighlightedIdx(focusedRef.current = value);
|
|
10904
10953
|
},
|
|
10905
10954
|
[_setHighlightedIdx]
|
|
10906
10955
|
);
|
|
10907
|
-
const keyboardNavigation = (0,
|
|
10908
|
-
const focusTab = (0,
|
|
10956
|
+
const keyboardNavigation = (0, import_react72.useRef)(false);
|
|
10957
|
+
const focusTab = (0, import_react72.useCallback)(
|
|
10909
10958
|
(tabIndex, immediateFocus = false, withKeyboard, delay = 70) => {
|
|
10910
10959
|
setHighlightedIdx(tabIndex);
|
|
10911
10960
|
if (withKeyboard === true && !keyboardNavigation.current) {
|
|
@@ -10945,14 +10994,14 @@ var useKeyboardNavigation2 = ({
|
|
|
10945
10994
|
}
|
|
10946
10995
|
}
|
|
10947
10996
|
};
|
|
10948
|
-
const getIndexCount = (0,
|
|
10997
|
+
const getIndexCount = (0, import_react72.useCallback)(
|
|
10949
10998
|
() => {
|
|
10950
10999
|
var _a2, _b;
|
|
10951
11000
|
return (_b = (_a2 = containerRef.current) == null ? void 0 : _a2.querySelectorAll(`[data-index]`).length) != null ? _b : 0;
|
|
10952
11001
|
},
|
|
10953
11002
|
[containerRef]
|
|
10954
11003
|
);
|
|
10955
|
-
const nextFocusableItemIdx = (0,
|
|
11004
|
+
const nextFocusableItemIdx = (0, import_react72.useCallback)(
|
|
10956
11005
|
(direction = "fwd", idx) => {
|
|
10957
11006
|
const indexCount = getIndexCount();
|
|
10958
11007
|
const index = typeof idx === "number" ? idx : indexCount;
|
|
@@ -10972,7 +11021,7 @@ var useKeyboardNavigation2 = ({
|
|
|
10972
11021
|
},
|
|
10973
11022
|
[containerRef, getIndexCount]
|
|
10974
11023
|
);
|
|
10975
|
-
const navigateChildItems = (0,
|
|
11024
|
+
const navigateChildItems = (0, import_react72.useCallback)(
|
|
10976
11025
|
(e, forceFocusVisible = false) => {
|
|
10977
11026
|
const direction = navigation[orientation][e.key];
|
|
10978
11027
|
const nextIdx = nextFocusableItemIdx(direction, highlightedIdx);
|
|
@@ -10994,14 +11043,14 @@ var useKeyboardNavigation2 = ({
|
|
|
10994
11043
|
orientation
|
|
10995
11044
|
]
|
|
10996
11045
|
);
|
|
10997
|
-
const highlightedTabHasMenu = (0,
|
|
11046
|
+
const highlightedTabHasMenu = (0, import_react72.useCallback)(() => {
|
|
10998
11047
|
const el = getElementByPosition(containerRef.current, highlightedIdx);
|
|
10999
11048
|
if (el) {
|
|
11000
11049
|
return el.querySelector(".vuuPopupMenu") != null;
|
|
11001
11050
|
}
|
|
11002
11051
|
return false;
|
|
11003
11052
|
}, [containerRef, highlightedIdx]);
|
|
11004
|
-
const activateTabMenu = (0,
|
|
11053
|
+
const activateTabMenu = (0, import_react72.useCallback)(() => {
|
|
11005
11054
|
const el = getElementByPosition(containerRef.current, highlightedIdx);
|
|
11006
11055
|
const menuEl = el == null ? void 0 : el.querySelector(".vuuPopupMenu");
|
|
11007
11056
|
if (menuEl) {
|
|
@@ -11009,7 +11058,7 @@ var useKeyboardNavigation2 = ({
|
|
|
11009
11058
|
}
|
|
11010
11059
|
return false;
|
|
11011
11060
|
}, [containerRef, highlightedIdx]);
|
|
11012
|
-
const handleKeyDown = (0,
|
|
11061
|
+
const handleKeyDown = (0, import_react72.useCallback)(
|
|
11013
11062
|
(e) => {
|
|
11014
11063
|
if (getIndexCount() > 0 && isNavigationKey2(e.key, orientation)) {
|
|
11015
11064
|
e.preventDefault();
|
|
@@ -11034,7 +11083,7 @@ var useKeyboardNavigation2 = ({
|
|
|
11034
11083
|
const handleItemClick = (_, tabIndex) => {
|
|
11035
11084
|
setHighlightedIdx(tabIndex);
|
|
11036
11085
|
};
|
|
11037
|
-
const handleFocus = (0,
|
|
11086
|
+
const handleFocus = (0, import_react72.useCallback)(() => {
|
|
11038
11087
|
if (!hasFocus) {
|
|
11039
11088
|
setHasFocus(true);
|
|
11040
11089
|
if (!mouseClickPending.current) {
|
|
@@ -11044,7 +11093,7 @@ var useKeyboardNavigation2 = ({
|
|
|
11044
11093
|
}
|
|
11045
11094
|
}
|
|
11046
11095
|
}, [hasFocus]);
|
|
11047
|
-
const handleContainerMouseDown = (0,
|
|
11096
|
+
const handleContainerMouseDown = (0, import_react72.useCallback)(() => {
|
|
11048
11097
|
if (!hasFocus) {
|
|
11049
11098
|
mouseClickPending.current = true;
|
|
11050
11099
|
}
|
|
@@ -11081,8 +11130,8 @@ var useKeyboardNavigation2 = ({
|
|
|
11081
11130
|
};
|
|
11082
11131
|
|
|
11083
11132
|
// src/tabstrip/useSelection.ts
|
|
11084
|
-
var
|
|
11085
|
-
var
|
|
11133
|
+
var import_core32 = require("@salt-ds/core");
|
|
11134
|
+
var import_react73 = require("react");
|
|
11086
11135
|
var defaultSelectionKeys2 = ["Enter", " "];
|
|
11087
11136
|
var isTabElement = (el) => el && el.matches('[class*="vuuTab "]');
|
|
11088
11137
|
var useSelection2 = ({
|
|
@@ -11091,24 +11140,24 @@ var useSelection2 = ({
|
|
|
11091
11140
|
onSelectionChange,
|
|
11092
11141
|
selected: selectedProp
|
|
11093
11142
|
}) => {
|
|
11094
|
-
const [selected, setSelected, isControlled] = (0,
|
|
11143
|
+
const [selected, setSelected, isControlled] = (0, import_core32.useControlled)({
|
|
11095
11144
|
controlled: selectedProp,
|
|
11096
11145
|
default: defaultSelected != null ? defaultSelected : 0,
|
|
11097
11146
|
name: "Tabstrip",
|
|
11098
11147
|
state: "value"
|
|
11099
11148
|
});
|
|
11100
|
-
const isSelectionEvent = (0,
|
|
11149
|
+
const isSelectionEvent = (0, import_react73.useCallback)(
|
|
11101
11150
|
(evt) => defaultSelectionKeys2.includes(evt.key),
|
|
11102
11151
|
[]
|
|
11103
11152
|
);
|
|
11104
|
-
const selectItem = (0,
|
|
11153
|
+
const selectItem = (0, import_react73.useCallback)(
|
|
11105
11154
|
(tabIndex) => {
|
|
11106
11155
|
setSelected(tabIndex);
|
|
11107
11156
|
onSelectionChange == null ? void 0 : onSelectionChange(tabIndex);
|
|
11108
11157
|
},
|
|
11109
11158
|
[onSelectionChange, setSelected]
|
|
11110
11159
|
);
|
|
11111
|
-
const handleKeyDown = (0,
|
|
11160
|
+
const handleKeyDown = (0, import_react73.useCallback)(
|
|
11112
11161
|
(e) => {
|
|
11113
11162
|
const targetElement = e.target;
|
|
11114
11163
|
if (isSelectionEvent(e) && highlightedIdx !== selected && isTabElement(targetElement)) {
|
|
@@ -11119,7 +11168,7 @@ var useSelection2 = ({
|
|
|
11119
11168
|
},
|
|
11120
11169
|
[isSelectionEvent, highlightedIdx, selected, selectItem]
|
|
11121
11170
|
);
|
|
11122
|
-
const onClick = (0,
|
|
11171
|
+
const onClick = (0, import_react73.useCallback)(
|
|
11123
11172
|
(e, tabIndex) => {
|
|
11124
11173
|
if (tabIndex !== selected) {
|
|
11125
11174
|
selectItem(tabIndex);
|
|
@@ -11159,7 +11208,7 @@ var useTabstrip = ({
|
|
|
11159
11208
|
orientation,
|
|
11160
11209
|
keyBoardActivation
|
|
11161
11210
|
}) => {
|
|
11162
|
-
const lastSelection = (0,
|
|
11211
|
+
const lastSelection = (0, import_react74.useRef)(activeTabIndexProp);
|
|
11163
11212
|
const {
|
|
11164
11213
|
focusTab: keyboardHookFocusTab,
|
|
11165
11214
|
highlightedIdx,
|
|
@@ -11189,7 +11238,7 @@ var useTabstrip = ({
|
|
|
11189
11238
|
animateSelectionThumb ? selectionHookSelected : -1,
|
|
11190
11239
|
orientation
|
|
11191
11240
|
);
|
|
11192
|
-
const handleDrop = (0,
|
|
11241
|
+
const handleDrop = (0, import_react74.useCallback)(
|
|
11193
11242
|
({ fromIndex, toIndex }) => {
|
|
11194
11243
|
const { current: selected } = lastSelection;
|
|
11195
11244
|
console.log(
|
|
@@ -11231,7 +11280,7 @@ var useTabstrip = ({
|
|
|
11231
11280
|
orientation: "horizontal",
|
|
11232
11281
|
itemQuery: ".vuuOverflowContainer-item"
|
|
11233
11282
|
});
|
|
11234
|
-
const handleExitEditMode = (0,
|
|
11283
|
+
const handleExitEditMode = (0, import_react74.useCallback)(
|
|
11235
11284
|
(originalValue, editedValue, allowDeactivation, tabIndex) => {
|
|
11236
11285
|
console.log(
|
|
11237
11286
|
`handleExitEditMode ${originalValue} ${editedValue} ${allowDeactivation} ${tabIndex}`
|
|
@@ -11243,7 +11292,7 @@ var useTabstrip = ({
|
|
|
11243
11292
|
},
|
|
11244
11293
|
[keyboardHookFocusTab, onExitEditMode]
|
|
11245
11294
|
);
|
|
11246
|
-
const handleClick = (0,
|
|
11295
|
+
const handleClick = (0, import_react74.useCallback)(
|
|
11247
11296
|
(evt, tabIndex) => {
|
|
11248
11297
|
keyboardHookHandleClick(evt, tabIndex);
|
|
11249
11298
|
selectionHookHandleClick(evt, tabIndex);
|
|
@@ -11251,7 +11300,7 @@ var useTabstrip = ({
|
|
|
11251
11300
|
// [dragDropHook.isDragging, keyboardHook, selectionHook]
|
|
11252
11301
|
[keyboardHookHandleClick, selectionHookHandleClick]
|
|
11253
11302
|
);
|
|
11254
|
-
const getEditableLabel = (0,
|
|
11303
|
+
const getEditableLabel = (0, import_react74.useCallback)(
|
|
11255
11304
|
(tabIndex = highlightedIdx) => {
|
|
11256
11305
|
const targetEl = getElementWithIndex(containerRef.current, tabIndex);
|
|
11257
11306
|
if (targetEl) {
|
|
@@ -11260,7 +11309,7 @@ var useTabstrip = ({
|
|
|
11260
11309
|
},
|
|
11261
11310
|
[containerRef, highlightedIdx]
|
|
11262
11311
|
);
|
|
11263
|
-
const tabInEditMode = (0,
|
|
11312
|
+
const tabInEditMode = (0, import_react74.useCallback)(
|
|
11264
11313
|
(tabIndex = highlightedIdx) => {
|
|
11265
11314
|
const editableLabel = getEditableLabel(tabIndex);
|
|
11266
11315
|
if (editableLabel) {
|
|
@@ -11270,7 +11319,7 @@ var useTabstrip = ({
|
|
|
11270
11319
|
},
|
|
11271
11320
|
[getEditableLabel, highlightedIdx]
|
|
11272
11321
|
);
|
|
11273
|
-
const editTab = (0,
|
|
11322
|
+
const editTab = (0, import_react74.useCallback)(
|
|
11274
11323
|
(tabIndex = highlightedIdx) => {
|
|
11275
11324
|
const editableLabelEl = getEditableLabel(tabIndex);
|
|
11276
11325
|
if (editableLabelEl) {
|
|
@@ -11279,7 +11328,7 @@ var useTabstrip = ({
|
|
|
11279
11328
|
},
|
|
11280
11329
|
[getEditableLabel, highlightedIdx]
|
|
11281
11330
|
);
|
|
11282
|
-
const handleKeyDown = (0,
|
|
11331
|
+
const handleKeyDown = (0, import_react74.useCallback)(
|
|
11283
11332
|
(evt) => {
|
|
11284
11333
|
keyboardHookHandleKeyDown(evt);
|
|
11285
11334
|
if (!evt.defaultPrevented) {
|
|
@@ -11291,7 +11340,7 @@ var useTabstrip = ({
|
|
|
11291
11340
|
},
|
|
11292
11341
|
[editTab, keyboardHookHandleKeyDown, selectionHookHandleKeyDown]
|
|
11293
11342
|
);
|
|
11294
|
-
const handleCloseTabFromMenu = (0,
|
|
11343
|
+
const handleCloseTabFromMenu = (0, import_react74.useCallback)(
|
|
11295
11344
|
(tabIndex) => {
|
|
11296
11345
|
const selectedTabIndex = getIndexOfSelectedTab(containerRef.current);
|
|
11297
11346
|
const newActiveTabIndex = selectedTabIndex > tabIndex ? selectedTabIndex - 1 : selectedTabIndex === tabIndex ? 0 : selectedTabIndex;
|
|
@@ -11304,14 +11353,14 @@ var useTabstrip = ({
|
|
|
11304
11353
|
},
|
|
11305
11354
|
[containerRef, onCloseTab, resumeAnimation, suspendAnimation]
|
|
11306
11355
|
);
|
|
11307
|
-
const handleRenameTabFromMenu = (0,
|
|
11356
|
+
const handleRenameTabFromMenu = (0, import_react74.useCallback)(
|
|
11308
11357
|
(tabIndex) => {
|
|
11309
11358
|
editTab(tabIndex);
|
|
11310
11359
|
return true;
|
|
11311
11360
|
},
|
|
11312
11361
|
[editTab]
|
|
11313
11362
|
);
|
|
11314
|
-
const handleTabMenuAction = (0,
|
|
11363
|
+
const handleTabMenuAction = (0, import_react74.useCallback)(
|
|
11315
11364
|
(action) => {
|
|
11316
11365
|
if (isTabMenuOptions(action.options)) {
|
|
11317
11366
|
switch (action.menuId) {
|
|
@@ -11327,7 +11376,7 @@ var useTabstrip = ({
|
|
|
11327
11376
|
},
|
|
11328
11377
|
[handleCloseTabFromMenu, handleRenameTabFromMenu]
|
|
11329
11378
|
);
|
|
11330
|
-
const handleTabMenuClose = (0,
|
|
11379
|
+
const handleTabMenuClose = (0, import_react74.useCallback)(() => {
|
|
11331
11380
|
if (!tabInEditMode()) {
|
|
11332
11381
|
keyboardHookFocusTab(highlightedIdx);
|
|
11333
11382
|
} else {
|
|
@@ -11339,7 +11388,7 @@ var useTabstrip = ({
|
|
|
11339
11388
|
keyboardHookSetHighlightedIndex,
|
|
11340
11389
|
tabInEditMode
|
|
11341
11390
|
]);
|
|
11342
|
-
const onSwitchWrappedItemIntoView = (0,
|
|
11391
|
+
const onSwitchWrappedItemIntoView = (0, import_react74.useCallback)(
|
|
11343
11392
|
(item) => {
|
|
11344
11393
|
const index = parseInt(item.index);
|
|
11345
11394
|
if (!isNaN(index)) {
|
|
@@ -11352,7 +11401,7 @@ var useTabstrip = ({
|
|
|
11352
11401
|
onFocus: keyboardHook.onFocus,
|
|
11353
11402
|
onKeyDown: handleKeyDown
|
|
11354
11403
|
};
|
|
11355
|
-
const handleAddTabClick = (0,
|
|
11404
|
+
const handleAddTabClick = (0, import_react74.useCallback)(() => {
|
|
11356
11405
|
onAddTab == null ? void 0 : onAddTab();
|
|
11357
11406
|
requestAnimationFrame(() => {
|
|
11358
11407
|
const selectedTabIndex = getIndexOfSelectedTab(containerRef.current);
|
|
@@ -11385,9 +11434,9 @@ var useTabstrip = ({
|
|
|
11385
11434
|
};
|
|
11386
11435
|
|
|
11387
11436
|
// src/tabstrip/Tabstrip.tsx
|
|
11388
|
-
var
|
|
11389
|
-
var
|
|
11390
|
-
var
|
|
11437
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
11438
|
+
var import_react76 = require("react");
|
|
11439
|
+
var classBase21 = "vuuTabstrip";
|
|
11391
11440
|
var Tabstrip = ({
|
|
11392
11441
|
activeTabIndex: activeTabIndexProp,
|
|
11393
11442
|
allowAddTab,
|
|
@@ -11411,7 +11460,7 @@ var Tabstrip = ({
|
|
|
11411
11460
|
tabClassName,
|
|
11412
11461
|
...htmlAttributes
|
|
11413
11462
|
}) => {
|
|
11414
|
-
const rootRef = (0,
|
|
11463
|
+
const rootRef = (0, import_react75.useRef)(null);
|
|
11415
11464
|
const {
|
|
11416
11465
|
activeTabIndex,
|
|
11417
11466
|
focusVisible,
|
|
@@ -11434,12 +11483,12 @@ var Tabstrip = ({
|
|
|
11434
11483
|
orientation
|
|
11435
11484
|
});
|
|
11436
11485
|
const id = (0, import_vuu_utils32.useId)(idProp);
|
|
11437
|
-
const className = (0,
|
|
11486
|
+
const className = (0, import_clsx31.default)(classBase21, `${classBase21}-${orientation}`, classNameProp);
|
|
11438
11487
|
const style = styleProp || containerStyle ? {
|
|
11439
11488
|
...styleProp,
|
|
11440
11489
|
...containerStyle
|
|
11441
11490
|
} : void 0;
|
|
11442
|
-
const tabs = (0,
|
|
11491
|
+
const tabs = (0, import_react75.useMemo)(
|
|
11443
11492
|
() => (0, import_vuu_utils32.asReactElements)(children).map((child, index) => {
|
|
11444
11493
|
const {
|
|
11445
11494
|
id: tabId = `${id}-tab-${index}`,
|
|
@@ -11450,10 +11499,10 @@ var Tabstrip = ({
|
|
|
11450
11499
|
showMenuButton = showTabMenuButton
|
|
11451
11500
|
} = child.props;
|
|
11452
11501
|
const selected = index === activeTabIndex;
|
|
11453
|
-
return
|
|
11502
|
+
return import_react75.default.cloneElement(child, {
|
|
11454
11503
|
...tabProps,
|
|
11455
11504
|
...tabstripHook.navigationProps,
|
|
11456
|
-
className: (0,
|
|
11505
|
+
className: (0, import_clsx31.default)(className2, tabClassName),
|
|
11457
11506
|
closeable,
|
|
11458
11507
|
"data-overflow-priority": selected ? "1" : void 0,
|
|
11459
11508
|
dragging: draggedItemIndex === index,
|
|
@@ -11462,19 +11511,19 @@ var Tabstrip = ({
|
|
|
11462
11511
|
id: tabId,
|
|
11463
11512
|
index,
|
|
11464
11513
|
key: index,
|
|
11465
|
-
location: (0,
|
|
11514
|
+
location: (0, import_clsx31.default)(location, tabLocation),
|
|
11466
11515
|
selected,
|
|
11467
11516
|
showMenuButton,
|
|
11468
11517
|
tabIndex: selected ? 0 : -1
|
|
11469
11518
|
});
|
|
11470
11519
|
}).concat(
|
|
11471
|
-
allowAddTab ? /* @__PURE__ */ (0,
|
|
11472
|
-
|
|
11520
|
+
allowAddTab ? /* @__PURE__ */ (0, import_react76.createElement)(
|
|
11521
|
+
IconButton,
|
|
11473
11522
|
{
|
|
11474
11523
|
...tabstripHook.navigationProps,
|
|
11475
11524
|
"aria-label": "Create Tab",
|
|
11476
|
-
className: `${
|
|
11477
|
-
|
|
11525
|
+
className: `${classBase21}-addTabButton`,
|
|
11526
|
+
icon: "add",
|
|
11478
11527
|
"data-overflow-priority": "1",
|
|
11479
11528
|
key: "addButton",
|
|
11480
11529
|
onClick: onClickAddTab,
|
|
@@ -11500,8 +11549,8 @@ var Tabstrip = ({
|
|
|
11500
11549
|
location
|
|
11501
11550
|
]
|
|
11502
11551
|
);
|
|
11503
|
-
return /* @__PURE__ */ (0,
|
|
11504
|
-
/* @__PURE__ */ (0,
|
|
11552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
|
|
11553
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
11505
11554
|
OverflowContainer,
|
|
11506
11555
|
{
|
|
11507
11556
|
...htmlAttributes,
|
|
@@ -11523,15 +11572,15 @@ var Tabstrip = ({
|
|
|
11523
11572
|
|
|
11524
11573
|
// src/tabstrip/Tab.tsx
|
|
11525
11574
|
var import_core33 = require("@salt-ds/core");
|
|
11526
|
-
var
|
|
11527
|
-
var
|
|
11575
|
+
var import_clsx33 = __toESM(require("clsx"));
|
|
11576
|
+
var import_react78 = require("react");
|
|
11528
11577
|
|
|
11529
11578
|
// src/tabstrip/TabMenu.tsx
|
|
11530
11579
|
var import_vuu_popups6 = require("@vuu-ui/vuu-popups");
|
|
11531
|
-
var
|
|
11532
|
-
var
|
|
11533
|
-
var
|
|
11534
|
-
var
|
|
11580
|
+
var import_react77 = require("react");
|
|
11581
|
+
var import_clsx32 = __toESM(require("clsx"));
|
|
11582
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
11583
|
+
var classBase22 = "vuuTabMenu";
|
|
11535
11584
|
var TabMenu = ({
|
|
11536
11585
|
allowClose,
|
|
11537
11586
|
allowRename,
|
|
@@ -11542,7 +11591,7 @@ var TabMenu = ({
|
|
|
11542
11591
|
onMenuClose,
|
|
11543
11592
|
index
|
|
11544
11593
|
}) => {
|
|
11545
|
-
const [menuBuilder, menuOptions] = (0,
|
|
11594
|
+
const [menuBuilder, menuOptions] = (0, import_react77.useMemo)(
|
|
11546
11595
|
() => [
|
|
11547
11596
|
(_location, options) => {
|
|
11548
11597
|
const menuItems = [];
|
|
@@ -11568,13 +11617,13 @@ var TabMenu = ({
|
|
|
11568
11617
|
index
|
|
11569
11618
|
]
|
|
11570
11619
|
);
|
|
11571
|
-
return /* @__PURE__ */ (0,
|
|
11620
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
11572
11621
|
import_vuu_popups6.PopupMenu,
|
|
11573
11622
|
{
|
|
11574
|
-
className:
|
|
11623
|
+
className: classBase22,
|
|
11575
11624
|
menuBuilder,
|
|
11576
11625
|
menuActionHandler: onMenuAction,
|
|
11577
|
-
menuLocation: (0,
|
|
11626
|
+
menuLocation: (0, import_clsx32.default)("tab", location),
|
|
11578
11627
|
menuOptions,
|
|
11579
11628
|
onMenuClose,
|
|
11580
11629
|
tabIndex: -1,
|
|
@@ -11584,10 +11633,10 @@ var TabMenu = ({
|
|
|
11584
11633
|
};
|
|
11585
11634
|
|
|
11586
11635
|
// src/tabstrip/Tab.tsx
|
|
11587
|
-
var
|
|
11588
|
-
var
|
|
11636
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
11637
|
+
var classBase23 = "vuuTab";
|
|
11589
11638
|
var noop2 = () => void 0;
|
|
11590
|
-
var Tab = (0,
|
|
11639
|
+
var Tab = (0, import_react78.forwardRef)(function Tab2({
|
|
11591
11640
|
ariaControls,
|
|
11592
11641
|
children,
|
|
11593
11642
|
className,
|
|
@@ -11616,10 +11665,10 @@ var Tab = (0, import_react77.forwardRef)(function Tab2({
|
|
|
11616
11665
|
if (showMenuButton && typeof onMenuAction !== "function") {
|
|
11617
11666
|
throw Error("Tab onMenuAction must be provided if showMenuButton is set");
|
|
11618
11667
|
}
|
|
11619
|
-
const rootRef = (0,
|
|
11620
|
-
const editableRef = (0,
|
|
11668
|
+
const rootRef = (0, import_react78.useRef)(null);
|
|
11669
|
+
const editableRef = (0, import_react78.useRef)(null);
|
|
11621
11670
|
const setForkRef = (0, import_core33.useForkRef)(ref, rootRef);
|
|
11622
|
-
const handleClick = (0,
|
|
11671
|
+
const handleClick = (0, import_react78.useCallback)(
|
|
11623
11672
|
(e) => {
|
|
11624
11673
|
if (!editing) {
|
|
11625
11674
|
e.preventDefault();
|
|
@@ -11644,7 +11693,7 @@ var Tab = (0, import_react77.forwardRef)(function Tab2({
|
|
|
11644
11693
|
};
|
|
11645
11694
|
const getLabel = () => {
|
|
11646
11695
|
if (editable) {
|
|
11647
|
-
return /* @__PURE__ */ (0,
|
|
11696
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
11648
11697
|
EditableLabel,
|
|
11649
11698
|
{
|
|
11650
11699
|
editing,
|
|
@@ -11669,18 +11718,18 @@ var Tab = (0, import_react77.forwardRef)(function Tab2({
|
|
|
11669
11718
|
}
|
|
11670
11719
|
onFocusProp == null ? void 0 : onFocusProp(evt);
|
|
11671
11720
|
};
|
|
11672
|
-
return /* @__PURE__ */ (0,
|
|
11721
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
11673
11722
|
"div",
|
|
11674
11723
|
{
|
|
11675
11724
|
...props,
|
|
11676
11725
|
"aria-controls": ariaControls,
|
|
11677
11726
|
"aria-selected": selected,
|
|
11678
|
-
className: (0,
|
|
11679
|
-
[`${
|
|
11727
|
+
className: (0, import_clsx33.default)(classBase23, className, {
|
|
11728
|
+
[`${classBase23}-closeable`]: closeable,
|
|
11680
11729
|
"vuuDraggable-dragAway": dragging,
|
|
11681
|
-
[`${
|
|
11682
|
-
[`${
|
|
11683
|
-
[`${
|
|
11730
|
+
[`${classBase23}-editing`]: editing,
|
|
11731
|
+
[`${classBase23}-selected`]: selected || void 0,
|
|
11732
|
+
[`${classBase23}-vertical`]: orientation === "vertical",
|
|
11684
11733
|
[`vuuFocusVisible`]: focusVisible
|
|
11685
11734
|
}),
|
|
11686
11735
|
onClick: handleClick,
|
|
@@ -11690,15 +11739,15 @@ var Tab = (0, import_react77.forwardRef)(function Tab2({
|
|
|
11690
11739
|
role: "tab",
|
|
11691
11740
|
tabIndex,
|
|
11692
11741
|
children: [
|
|
11693
|
-
/* @__PURE__ */ (0,
|
|
11742
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: `${classBase23}-main`, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
11694
11743
|
"span",
|
|
11695
11744
|
{
|
|
11696
|
-
className: `${
|
|
11745
|
+
className: `${classBase23}-text`,
|
|
11697
11746
|
"data-text": editable ? void 0 : label,
|
|
11698
11747
|
children: children != null ? children : getLabel()
|
|
11699
11748
|
}
|
|
11700
11749
|
) }),
|
|
11701
|
-
showMenuButton ? /* @__PURE__ */ (0,
|
|
11750
|
+
showMenuButton ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
11702
11751
|
TabMenu,
|
|
11703
11752
|
{
|
|
11704
11753
|
allowClose: closeable,
|
|
@@ -11718,17 +11767,17 @@ var Tab = (0, import_react77.forwardRef)(function Tab2({
|
|
|
11718
11767
|
|
|
11719
11768
|
// src/toolbar/Toolbar.tsx
|
|
11720
11769
|
var import_vuu_utils38 = require("@vuu-ui/vuu-utils");
|
|
11721
|
-
var
|
|
11722
|
-
var
|
|
11770
|
+
var import_clsx34 = __toESM(require("clsx"));
|
|
11771
|
+
var import_react82 = __toESM(require("react"));
|
|
11723
11772
|
|
|
11724
11773
|
// src/toolbar/useToolbar.ts
|
|
11725
11774
|
var import_vuu_utils37 = require("@vuu-ui/vuu-utils");
|
|
11726
|
-
var
|
|
11775
|
+
var import_react81 = require("react");
|
|
11727
11776
|
|
|
11728
11777
|
// src/toolbar/useKeyboardNavigation.ts
|
|
11729
11778
|
var import_core34 = require("@salt-ds/core");
|
|
11730
11779
|
var import_vuu_utils34 = require("@vuu-ui/vuu-utils");
|
|
11731
|
-
var
|
|
11780
|
+
var import_react79 = require("react");
|
|
11732
11781
|
var import_vuu_utils35 = require("@vuu-ui/vuu-utils");
|
|
11733
11782
|
|
|
11734
11783
|
// src/toolbar/toolbar-dom-utils.ts
|
|
@@ -11827,22 +11876,22 @@ var useKeyboardNavigation3 = ({
|
|
|
11827
11876
|
onNavigateOutOfBounds,
|
|
11828
11877
|
orientation
|
|
11829
11878
|
}) => {
|
|
11830
|
-
const mouseClickPending = (0,
|
|
11831
|
-
const focusedRef = (0,
|
|
11832
|
-
const [hasFocus, setHasFocus] = (0,
|
|
11879
|
+
const mouseClickPending = (0, import_react79.useRef)(false);
|
|
11880
|
+
const focusedRef = (0, import_react79.useRef)(-1);
|
|
11881
|
+
const [hasFocus, setHasFocus] = (0, import_react79.useState)(false);
|
|
11833
11882
|
const [highlightedIdx, _setHighlightedIdx] = (0, import_core34.useControlled)({
|
|
11834
11883
|
controlled: highlightedIdxProp,
|
|
11835
11884
|
default: defaultHighlightedIdx,
|
|
11836
11885
|
name: "UseKeyboardNavigation"
|
|
11837
11886
|
});
|
|
11838
|
-
const setHighlightedIdx = (0,
|
|
11887
|
+
const setHighlightedIdx = (0, import_react79.useCallback)(
|
|
11839
11888
|
(value) => {
|
|
11840
11889
|
_setHighlightedIdx(focusedRef.current = value);
|
|
11841
11890
|
},
|
|
11842
11891
|
[_setHighlightedIdx]
|
|
11843
11892
|
);
|
|
11844
|
-
const keyboardNavigation = (0,
|
|
11845
|
-
const focusItem = (0,
|
|
11893
|
+
const keyboardNavigation = (0, import_react79.useRef)(false);
|
|
11894
|
+
const focusItem = (0, import_react79.useCallback)(
|
|
11846
11895
|
(itemIndex, immediateFocus = false, withKeyboard, delay = 70) => {
|
|
11847
11896
|
console.log(`focus item ${itemIndex}`);
|
|
11848
11897
|
setHighlightedIdx(itemIndex);
|
|
@@ -11884,14 +11933,14 @@ var useKeyboardNavigation3 = ({
|
|
|
11884
11933
|
}
|
|
11885
11934
|
}
|
|
11886
11935
|
};
|
|
11887
|
-
const getIndexCount = (0,
|
|
11936
|
+
const getIndexCount = (0, import_react79.useCallback)(
|
|
11888
11937
|
() => {
|
|
11889
11938
|
var _a2, _b;
|
|
11890
11939
|
return (_b = (_a2 = containerRef.current) == null ? void 0 : _a2.querySelectorAll(`[data-index]`).length) != null ? _b : 0;
|
|
11891
11940
|
},
|
|
11892
11941
|
[containerRef]
|
|
11893
11942
|
);
|
|
11894
|
-
const nextFocusableItemIdx = (0,
|
|
11943
|
+
const nextFocusableItemIdx = (0, import_react79.useCallback)(
|
|
11895
11944
|
(direction = "fwd", idx) => {
|
|
11896
11945
|
var _a2;
|
|
11897
11946
|
const indexCount = getIndexCount();
|
|
@@ -11919,7 +11968,7 @@ var useKeyboardNavigation3 = ({
|
|
|
11919
11968
|
},
|
|
11920
11969
|
[containerRef, getIndexCount]
|
|
11921
11970
|
);
|
|
11922
|
-
const navigateChildItems = (0,
|
|
11971
|
+
const navigateChildItems = (0, import_react79.useCallback)(
|
|
11923
11972
|
(e) => {
|
|
11924
11973
|
const direction = navigation2[orientation][e.key];
|
|
11925
11974
|
const nextIdx = nextFocusableItemIdx(direction, highlightedIdx);
|
|
@@ -11939,21 +11988,21 @@ var useKeyboardNavigation3 = ({
|
|
|
11939
11988
|
onNavigateOutOfBounds
|
|
11940
11989
|
]
|
|
11941
11990
|
);
|
|
11942
|
-
const highlightedItemHasMenu = (0,
|
|
11991
|
+
const highlightedItemHasMenu = (0, import_react79.useCallback)(() => {
|
|
11943
11992
|
const el = getElementByPosition2(containerRef.current, highlightedIdx);
|
|
11944
11993
|
if (el) {
|
|
11945
11994
|
return el.querySelector(".vuuPopupMenu") != null;
|
|
11946
11995
|
}
|
|
11947
11996
|
return false;
|
|
11948
11997
|
}, [containerRef, highlightedIdx]);
|
|
11949
|
-
const highlightedItemInEditState = (0,
|
|
11998
|
+
const highlightedItemInEditState = (0, import_react79.useCallback)(() => {
|
|
11950
11999
|
const el = getElementByPosition2(containerRef.current, highlightedIdx);
|
|
11951
12000
|
if (el) {
|
|
11952
12001
|
return el.querySelector(".vuuEditableLabel-input") != null;
|
|
11953
12002
|
}
|
|
11954
12003
|
return false;
|
|
11955
12004
|
}, [containerRef, highlightedIdx]);
|
|
11956
|
-
const activateItemMenu = (0,
|
|
12005
|
+
const activateItemMenu = (0, import_react79.useCallback)(() => {
|
|
11957
12006
|
const el = getElementByPosition2(containerRef.current, highlightedIdx);
|
|
11958
12007
|
const menuEl = el == null ? void 0 : el.querySelector(".vuuPopupMenu");
|
|
11959
12008
|
if (menuEl) {
|
|
@@ -11961,7 +12010,7 @@ var useKeyboardNavigation3 = ({
|
|
|
11961
12010
|
}
|
|
11962
12011
|
return false;
|
|
11963
12012
|
}, [containerRef, highlightedIdx]);
|
|
11964
|
-
const handleKeyDown = (0,
|
|
12013
|
+
const handleKeyDown = (0, import_react79.useCallback)(
|
|
11965
12014
|
(e) => {
|
|
11966
12015
|
if (getIndexCount() > 0 && isNavigationKey3(e.key, orientation)) {
|
|
11967
12016
|
e.preventDefault();
|
|
@@ -11987,7 +12036,7 @@ var useKeyboardNavigation3 = ({
|
|
|
11987
12036
|
const handleItemClick = (_, itemIndex) => {
|
|
11988
12037
|
setHighlightedIdx(itemIndex);
|
|
11989
12038
|
};
|
|
11990
|
-
const handleFocus = (0,
|
|
12039
|
+
const handleFocus = (0, import_react79.useCallback)(() => {
|
|
11991
12040
|
if (!hasFocus) {
|
|
11992
12041
|
setHasFocus(true);
|
|
11993
12042
|
if (!mouseClickPending.current) {
|
|
@@ -11997,13 +12046,13 @@ var useKeyboardNavigation3 = ({
|
|
|
11997
12046
|
}
|
|
11998
12047
|
}
|
|
11999
12048
|
}, [hasFocus]);
|
|
12000
|
-
const handleContainerMouseDown = (0,
|
|
12049
|
+
const handleContainerMouseDown = (0, import_react79.useCallback)(() => {
|
|
12001
12050
|
if (!hasFocus) {
|
|
12002
12051
|
mouseClickPending.current = true;
|
|
12003
12052
|
}
|
|
12004
12053
|
keyboardNavigation.current = false;
|
|
12005
12054
|
}, [hasFocus]);
|
|
12006
|
-
const handleOverflowMenuClose = (0,
|
|
12055
|
+
const handleOverflowMenuClose = (0, import_react79.useCallback)(
|
|
12007
12056
|
(closeReason) => {
|
|
12008
12057
|
if ((closeReason == null ? void 0 : closeReason.type) === "escape") {
|
|
12009
12058
|
const index = getIndexOfOverflowItem(containerRef.current);
|
|
@@ -12048,7 +12097,7 @@ var useKeyboardNavigation3 = ({
|
|
|
12048
12097
|
|
|
12049
12098
|
// src/toolbar/useSelection.ts
|
|
12050
12099
|
var import_vuu_utils36 = require("@vuu-ui/vuu-utils");
|
|
12051
|
-
var
|
|
12100
|
+
var import_react80 = require("react");
|
|
12052
12101
|
var defaultSelectionKeys3 = ["Enter", " "];
|
|
12053
12102
|
var NO_SELECTION_HANDLERS = {};
|
|
12054
12103
|
var useSelection3 = ({
|
|
@@ -12064,11 +12113,11 @@ var useSelection3 = ({
|
|
|
12064
12113
|
name: "useSelection",
|
|
12065
12114
|
state: "selected"
|
|
12066
12115
|
});
|
|
12067
|
-
const isSelectionEvent = (0,
|
|
12116
|
+
const isSelectionEvent = (0, import_react80.useCallback)(
|
|
12068
12117
|
(evt) => defaultSelectionKeys3.includes(evt.key),
|
|
12069
12118
|
[]
|
|
12070
12119
|
);
|
|
12071
|
-
const selectItem = (0,
|
|
12120
|
+
const selectItem = (0, import_react80.useCallback)(
|
|
12072
12121
|
(itemIndex, specialKey = false) => {
|
|
12073
12122
|
const newSelected = allowMultipleSelection(selectionStrategy, specialKey) ? selected.concat(itemIndex) : [itemIndex];
|
|
12074
12123
|
setSelected(newSelected);
|
|
@@ -12076,7 +12125,7 @@ var useSelection3 = ({
|
|
|
12076
12125
|
},
|
|
12077
12126
|
[onSelectionChange, selected, selectionStrategy, setSelected]
|
|
12078
12127
|
);
|
|
12079
|
-
const deselectItem = (0,
|
|
12128
|
+
const deselectItem = (0, import_react80.useCallback)(
|
|
12080
12129
|
(itemIndex, specialKey = false) => {
|
|
12081
12130
|
const newSelected = selectionStrategy === "deselectable" || selectionStrategy === "multiple-special-key" && !specialKey ? [] : selected.filter((index) => index !== itemIndex);
|
|
12082
12131
|
setSelected(newSelected);
|
|
@@ -12084,7 +12133,7 @@ var useSelection3 = ({
|
|
|
12084
12133
|
},
|
|
12085
12134
|
[onSelectionChange, selected, selectionStrategy, setSelected]
|
|
12086
12135
|
);
|
|
12087
|
-
const handleKeyDown = (0,
|
|
12136
|
+
const handleKeyDown = (0, import_react80.useCallback)(
|
|
12088
12137
|
(e) => {
|
|
12089
12138
|
if (isSelectionEvent(e) && (0, import_vuu_utils36.isSelectableElement)(e.target)) {
|
|
12090
12139
|
if (!selected.includes(highlightedIdx)) {
|
|
@@ -12107,7 +12156,7 @@ var useSelection3 = ({
|
|
|
12107
12156
|
deselectItem
|
|
12108
12157
|
]
|
|
12109
12158
|
);
|
|
12110
|
-
const handleClick = (0,
|
|
12159
|
+
const handleClick = (0, import_react80.useCallback)(
|
|
12111
12160
|
(e, itemIndex) => {
|
|
12112
12161
|
const element = (0, import_vuu_utils36.getClosestIndexItem)(e.target);
|
|
12113
12162
|
if ((0, import_vuu_utils36.isSelectableElement)(element)) {
|
|
@@ -12143,7 +12192,7 @@ var useToolbar = ({
|
|
|
12143
12192
|
orientation,
|
|
12144
12193
|
selectionStrategy
|
|
12145
12194
|
}) => {
|
|
12146
|
-
const lastSelection = (0,
|
|
12195
|
+
const lastSelection = (0, import_react81.useRef)(activeItemIndexProp);
|
|
12147
12196
|
const {
|
|
12148
12197
|
focusItem: keyboardHookFocusItem,
|
|
12149
12198
|
highlightedIdx,
|
|
@@ -12170,7 +12219,7 @@ var useToolbar = ({
|
|
|
12170
12219
|
selectionStrategy
|
|
12171
12220
|
});
|
|
12172
12221
|
lastSelection.current = selectionHookSelected;
|
|
12173
|
-
const handleClick = (0,
|
|
12222
|
+
const handleClick = (0, import_react81.useCallback)(
|
|
12174
12223
|
(evt) => {
|
|
12175
12224
|
var _a2;
|
|
12176
12225
|
const target = evt.target;
|
|
@@ -12185,7 +12234,7 @@ var useToolbar = ({
|
|
|
12185
12234
|
},
|
|
12186
12235
|
[keyboardHookHandleClick, onClick]
|
|
12187
12236
|
);
|
|
12188
|
-
const handleKeyDown = (0,
|
|
12237
|
+
const handleKeyDown = (0, import_react81.useCallback)(
|
|
12189
12238
|
(evt) => {
|
|
12190
12239
|
keyboardHookHandleKeyDown(evt);
|
|
12191
12240
|
if (!evt.defaultPrevented) {
|
|
@@ -12194,7 +12243,7 @@ var useToolbar = ({
|
|
|
12194
12243
|
},
|
|
12195
12244
|
[keyboardHookHandleKeyDown, onKeyDown]
|
|
12196
12245
|
);
|
|
12197
|
-
const onSwitchWrappedItemIntoView = (0,
|
|
12246
|
+
const onSwitchWrappedItemIntoView = (0, import_react81.useCallback)(
|
|
12198
12247
|
(item) => {
|
|
12199
12248
|
const index = parseInt(item.index);
|
|
12200
12249
|
if (!isNaN(index)) {
|
|
@@ -12226,8 +12275,8 @@ var useToolbar = ({
|
|
|
12226
12275
|
};
|
|
12227
12276
|
|
|
12228
12277
|
// src/toolbar/Toolbar.tsx
|
|
12229
|
-
var
|
|
12230
|
-
var
|
|
12278
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
12279
|
+
var classBase24 = "vuuToolbar";
|
|
12231
12280
|
var Toolbar = ({
|
|
12232
12281
|
activeItemIndex: activeItemIndexProp,
|
|
12233
12282
|
alignItems = "start",
|
|
@@ -12242,7 +12291,7 @@ var Toolbar = ({
|
|
|
12242
12291
|
showSeparators = false,
|
|
12243
12292
|
...props
|
|
12244
12293
|
}) => {
|
|
12245
|
-
const rootRef = (0,
|
|
12294
|
+
const rootRef = (0, import_react82.useRef)(null);
|
|
12246
12295
|
const {
|
|
12247
12296
|
activeItemIndex,
|
|
12248
12297
|
focusableIdx,
|
|
@@ -12259,7 +12308,7 @@ var Toolbar = ({
|
|
|
12259
12308
|
selectionStrategy
|
|
12260
12309
|
});
|
|
12261
12310
|
const id = (0, import_vuu_utils38.useId)(idProp);
|
|
12262
|
-
const items = (0,
|
|
12311
|
+
const items = (0, import_react82.useMemo)(
|
|
12263
12312
|
() => (0, import_vuu_utils38.asReactElements)(children).map((child, index) => {
|
|
12264
12313
|
const {
|
|
12265
12314
|
id: itemId = `${id}-tab-${index}`,
|
|
@@ -12267,9 +12316,9 @@ var Toolbar = ({
|
|
|
12267
12316
|
...ownProps
|
|
12268
12317
|
} = child.props;
|
|
12269
12318
|
const selected = activeItemIndex.includes(index);
|
|
12270
|
-
return
|
|
12319
|
+
return import_react82.default.cloneElement(child, {
|
|
12271
12320
|
...forwardCallbackProps(ownProps, itemProps),
|
|
12272
|
-
className: (0,
|
|
12321
|
+
className: (0, import_clsx34.default)("vuuToolbarItem", itemClassName),
|
|
12273
12322
|
"data-overflow-priority": selected ? "1" : void 0,
|
|
12274
12323
|
id: itemId,
|
|
12275
12324
|
key: index,
|
|
@@ -12279,15 +12328,15 @@ var Toolbar = ({
|
|
|
12279
12328
|
}),
|
|
12280
12329
|
[activeItemIndex, children, focusableIdx, id, itemProps]
|
|
12281
12330
|
);
|
|
12282
|
-
return /* @__PURE__ */ (0,
|
|
12331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
12283
12332
|
OverflowContainer,
|
|
12284
12333
|
{
|
|
12285
12334
|
...props,
|
|
12286
12335
|
...toolbarHook.containerProps,
|
|
12287
|
-
className: (0,
|
|
12288
|
-
[`${
|
|
12289
|
-
[`${
|
|
12290
|
-
[`${
|
|
12336
|
+
className: (0, import_clsx34.default)(className, classBase24, `${classBase24}-${orientation}`, {
|
|
12337
|
+
[`${classBase24}-alignCenter`]: alignItems === "center",
|
|
12338
|
+
[`${classBase24}-alignEnd`]: alignItems === "end",
|
|
12339
|
+
[`${classBase24}-withSeparators`]: showSeparators
|
|
12291
12340
|
}),
|
|
12292
12341
|
...props,
|
|
12293
12342
|
ref: rootRef,
|
|
@@ -12298,8 +12347,8 @@ var Toolbar = ({
|
|
|
12298
12347
|
|
|
12299
12348
|
// src/tree/Tree.tsx
|
|
12300
12349
|
var import_core37 = require("@salt-ds/core");
|
|
12301
|
-
var
|
|
12302
|
-
var
|
|
12350
|
+
var import_clsx35 = __toESM(require("clsx"));
|
|
12351
|
+
var import_react91 = require("react");
|
|
12303
12352
|
|
|
12304
12353
|
// src/tree/list-dom-utils.ts
|
|
12305
12354
|
function listItemIndex2(listItemEl) {
|
|
@@ -12317,7 +12366,7 @@ var closestListItem2 = (el) => el.closest("[data-idx],[aria-posinset]");
|
|
|
12317
12366
|
var closestListItemIndex2 = (el) => listItemIndex2(closestListItem2(el));
|
|
12318
12367
|
|
|
12319
12368
|
// src/tree/use-items-with-ids.ts
|
|
12320
|
-
var
|
|
12369
|
+
var import_react83 = require("react");
|
|
12321
12370
|
var PathSeparators2 = /* @__PURE__ */ new Set(["/", "-", "."]);
|
|
12322
12371
|
var isPathSeparator2 = (char) => PathSeparators2.has(char);
|
|
12323
12372
|
var isParentPath2 = (parentPath, childPath) => childPath.startsWith(parentPath) && isPathSeparator2(childPath[parentPath.length]);
|
|
@@ -12341,7 +12390,7 @@ var useItemsWithIds = (sourceProp, idRoot = "root", {
|
|
|
12341
12390
|
return 0;
|
|
12342
12391
|
}
|
|
12343
12392
|
};
|
|
12344
|
-
const isExpanded2 = (0,
|
|
12393
|
+
const isExpanded2 = (0, import_react83.useCallback)(
|
|
12345
12394
|
(path) => {
|
|
12346
12395
|
if (Array.isArray(revealSelected)) {
|
|
12347
12396
|
return revealSelected.some((id) => isParentPath2(path, id));
|
|
@@ -12350,7 +12399,7 @@ var useItemsWithIds = (sourceProp, idRoot = "root", {
|
|
|
12350
12399
|
},
|
|
12351
12400
|
[defaultExpanded, revealSelected]
|
|
12352
12401
|
);
|
|
12353
|
-
const normalizeItems = (0,
|
|
12402
|
+
const normalizeItems = (0, import_react83.useCallback)(
|
|
12354
12403
|
(items, indexer, level = 1, path = "", results = [], flattenedSource2 = []) => {
|
|
12355
12404
|
let count2 = 0;
|
|
12356
12405
|
items.forEach((item, i, all) => {
|
|
@@ -12394,10 +12443,10 @@ var useItemsWithIds = (sourceProp, idRoot = "root", {
|
|
|
12394
12443
|
},
|
|
12395
12444
|
[collapsibleHeaders, idRoot, isExpanded2]
|
|
12396
12445
|
);
|
|
12397
|
-
const [count, sourceWithIds, flattenedSource] = (0,
|
|
12446
|
+
const [count, sourceWithIds, flattenedSource] = (0, import_react83.useMemo)(() => {
|
|
12398
12447
|
return normalizeItems(sourceProp, { index: 0 });
|
|
12399
12448
|
}, [normalizeItems, sourceProp]);
|
|
12400
|
-
const sourceItemById = (0,
|
|
12449
|
+
const sourceItemById = (0, import_react83.useCallback)(
|
|
12401
12450
|
(id, target = sourceWithIds) => {
|
|
12402
12451
|
const sourceWithId = target.find(
|
|
12403
12452
|
(i) => {
|
|
@@ -12417,7 +12466,7 @@ var useItemsWithIds = (sourceProp, idRoot = "root", {
|
|
|
12417
12466
|
};
|
|
12418
12467
|
|
|
12419
12468
|
// src/tree/use-selection.ts
|
|
12420
|
-
var
|
|
12469
|
+
var import_react84 = require("react");
|
|
12421
12470
|
var import_core35 = require("@salt-ds/core");
|
|
12422
12471
|
var SINGLE = "single";
|
|
12423
12472
|
var CHECKBOX2 = "checkbox";
|
|
@@ -12439,8 +12488,8 @@ var useSelection4 = ({
|
|
|
12439
12488
|
const singleSelect = selection === SINGLE;
|
|
12440
12489
|
const multiSelect = selection === MULTI || selection.startsWith(CHECKBOX2);
|
|
12441
12490
|
const extendedSelect = selection === EXTENDED;
|
|
12442
|
-
const lastActive = (0,
|
|
12443
|
-
const isSelectionEvent = (0,
|
|
12491
|
+
const lastActive = (0, import_react84.useRef)(-1);
|
|
12492
|
+
const isSelectionEvent = (0, import_react84.useCallback)(
|
|
12444
12493
|
(evt) => selectionKeys.includes(evt.key),
|
|
12445
12494
|
[selectionKeys]
|
|
12446
12495
|
);
|
|
@@ -12449,7 +12498,7 @@ var useSelection4 = ({
|
|
|
12449
12498
|
default: defaultSelected != null ? defaultSelected : [],
|
|
12450
12499
|
name: "selected"
|
|
12451
12500
|
});
|
|
12452
|
-
const selectItemAtIndex = (0,
|
|
12501
|
+
const selectItemAtIndex = (0, import_react84.useCallback)(
|
|
12453
12502
|
(evt, idx, id, rangeSelect, preserveExistingSelection = false) => {
|
|
12454
12503
|
const { current: active } = lastActive;
|
|
12455
12504
|
const isSelected2 = selected == null ? void 0 : selected.includes(id);
|
|
@@ -12490,7 +12539,7 @@ var useSelection4 = ({
|
|
|
12490
12539
|
singleSelect
|
|
12491
12540
|
]
|
|
12492
12541
|
);
|
|
12493
|
-
const handleKeyDown = (0,
|
|
12542
|
+
const handleKeyDown = (0, import_react84.useCallback)(
|
|
12494
12543
|
(evt) => {
|
|
12495
12544
|
if (~highlightedIdx && isSelectionEvent(evt)) {
|
|
12496
12545
|
evt.preventDefault();
|
|
@@ -12515,7 +12564,7 @@ var useSelection4 = ({
|
|
|
12515
12564
|
selectItemAtIndex
|
|
12516
12565
|
]
|
|
12517
12566
|
);
|
|
12518
|
-
const handleKeyboardNavigation = (0,
|
|
12567
|
+
const handleKeyboardNavigation = (0, import_react84.useCallback)(
|
|
12519
12568
|
(evt, currentIndex) => {
|
|
12520
12569
|
if (extendedSelect && evt.shiftKey) {
|
|
12521
12570
|
const item = treeNodes[currentIndex];
|
|
@@ -12528,7 +12577,7 @@ var useSelection4 = ({
|
|
|
12528
12577
|
onKeyDown: handleKeyDown,
|
|
12529
12578
|
onKeyboardNavigation: handleKeyboardNavigation
|
|
12530
12579
|
};
|
|
12531
|
-
const handleClick = (0,
|
|
12580
|
+
const handleClick = (0, import_react84.useCallback)(
|
|
12532
12581
|
(evt) => {
|
|
12533
12582
|
if (highlightedIdx !== -1) {
|
|
12534
12583
|
const item = treeNodes[highlightedIdx];
|
|
@@ -12562,14 +12611,14 @@ var useSelection4 = ({
|
|
|
12562
12611
|
};
|
|
12563
12612
|
|
|
12564
12613
|
// src/tree/use-viewport-tracking.ts
|
|
12565
|
-
var
|
|
12614
|
+
var import_react85 = require("react");
|
|
12566
12615
|
var HeightOnly4 = ["height", "scrollHeight"];
|
|
12567
12616
|
var useViewportTracking2 = (root, highlightedIdx, stickyHeaders = false) => {
|
|
12568
|
-
const scrollTop = (0,
|
|
12569
|
-
const scrolling = (0,
|
|
12570
|
-
const rootHeight = (0,
|
|
12571
|
-
const rootScrollHeight = (0,
|
|
12572
|
-
const scrollIntoView = (0,
|
|
12617
|
+
const scrollTop = (0, import_react85.useRef)(0);
|
|
12618
|
+
const scrolling = (0, import_react85.useRef)(false);
|
|
12619
|
+
const rootHeight = (0, import_react85.useRef)(0);
|
|
12620
|
+
const rootScrollHeight = (0, import_react85.useRef)(0);
|
|
12621
|
+
const scrollIntoView = (0, import_react85.useCallback)(
|
|
12573
12622
|
(el) => {
|
|
12574
12623
|
const targetEl = el.ariaExpanded ? el.firstChild : el;
|
|
12575
12624
|
const headerHeight = stickyHeaders ? 30 : 0;
|
|
@@ -12590,10 +12639,10 @@ var useViewportTracking2 = (root, highlightedIdx, stickyHeaders = false) => {
|
|
|
12590
12639
|
},
|
|
12591
12640
|
[root, stickyHeaders]
|
|
12592
12641
|
);
|
|
12593
|
-
const scrollHandler = (0,
|
|
12642
|
+
const scrollHandler = (0, import_react85.useCallback)((e) => {
|
|
12594
12643
|
scrollTop.current = e.target.scrollTop;
|
|
12595
12644
|
}, []);
|
|
12596
|
-
(0,
|
|
12645
|
+
(0, import_react85.useEffect)(() => {
|
|
12597
12646
|
const { current: rootEl } = root;
|
|
12598
12647
|
if (rootEl) {
|
|
12599
12648
|
rootEl.addEventListener("scroll", scrollHandler);
|
|
@@ -12604,7 +12653,7 @@ var useViewportTracking2 = (root, highlightedIdx, stickyHeaders = false) => {
|
|
|
12604
12653
|
}
|
|
12605
12654
|
};
|
|
12606
12655
|
}, [root, scrollHandler]);
|
|
12607
|
-
(0,
|
|
12656
|
+
(0, import_react85.useLayoutEffect)(() => {
|
|
12608
12657
|
if (highlightedIdx !== -1 && rootScrollHeight.current > rootHeight.current) {
|
|
12609
12658
|
if (root.current) {
|
|
12610
12659
|
const item = root.current.querySelector(`
|
|
@@ -12621,9 +12670,9 @@ var useViewportTracking2 = (root, highlightedIdx, stickyHeaders = false) => {
|
|
|
12621
12670
|
}
|
|
12622
12671
|
}
|
|
12623
12672
|
}, [highlightedIdx, root, scrollIntoView]);
|
|
12624
|
-
(0,
|
|
12673
|
+
(0, import_react85.useEffect)(() => {
|
|
12625
12674
|
}, [stickyHeaders]);
|
|
12626
|
-
const onResize = (0,
|
|
12675
|
+
const onResize = (0, import_react85.useCallback)(({ height, scrollHeight }) => {
|
|
12627
12676
|
rootHeight.current = height;
|
|
12628
12677
|
rootScrollHeight.current = scrollHeight;
|
|
12629
12678
|
}, []);
|
|
@@ -12632,10 +12681,10 @@ var useViewportTracking2 = (root, highlightedIdx, stickyHeaders = false) => {
|
|
|
12632
12681
|
};
|
|
12633
12682
|
|
|
12634
12683
|
// src/tree/useTree.ts
|
|
12635
|
-
var
|
|
12684
|
+
var import_react90 = require("react");
|
|
12636
12685
|
|
|
12637
12686
|
// src/tree/use-keyboard-navigation.ts
|
|
12638
|
-
var
|
|
12687
|
+
var import_react86 = require("react");
|
|
12639
12688
|
|
|
12640
12689
|
// src/tree/hierarchical-data-utils.ts
|
|
12641
12690
|
var getNodeParentPath = ({ id }) => {
|
|
@@ -12785,7 +12834,7 @@ var useKeyboardNavigation4 = ({
|
|
|
12785
12834
|
onKeyboardNavigation,
|
|
12786
12835
|
selected = []
|
|
12787
12836
|
}) => {
|
|
12788
|
-
const { bwd: ArrowBwd, fwd: ArrowFwd } = (0,
|
|
12837
|
+
const { bwd: ArrowBwd, fwd: ArrowFwd } = (0, import_react86.useMemo)(
|
|
12789
12838
|
() => ({
|
|
12790
12839
|
bwd: ArrowUp4,
|
|
12791
12840
|
fwd: ArrowDown4
|
|
@@ -12797,14 +12846,14 @@ var useKeyboardNavigation4 = ({
|
|
|
12797
12846
|
default: defaultHighlightedIdx,
|
|
12798
12847
|
name: "highlightedIdx"
|
|
12799
12848
|
});
|
|
12800
|
-
const setHighlightedIndex = (0,
|
|
12849
|
+
const setHighlightedIndex = (0, import_react86.useCallback)(
|
|
12801
12850
|
(idx) => {
|
|
12802
12851
|
onHighlight == null ? void 0 : onHighlight(idx);
|
|
12803
12852
|
setHighlightedIdx(idx);
|
|
12804
12853
|
},
|
|
12805
12854
|
[onHighlight, setHighlightedIdx]
|
|
12806
12855
|
);
|
|
12807
|
-
const nextFocusableItemIdx = (0,
|
|
12856
|
+
const nextFocusableItemIdx = (0, import_react86.useCallback)(
|
|
12808
12857
|
(key = ArrowFwd, idx = key === ArrowFwd ? -1 : treeNodes.length) => {
|
|
12809
12858
|
let nextIdx = nextItemIdx4(treeNodes.length, key, idx);
|
|
12810
12859
|
while (nextIdx !== -1 && (key === ArrowFwd && nextIdx < treeNodes.length || key === ArrowBwd && nextIdx > 0) && !isFocusable3(treeNodes[nextIdx])) {
|
|
@@ -12814,10 +12863,10 @@ var useKeyboardNavigation4 = ({
|
|
|
12814
12863
|
},
|
|
12815
12864
|
[ArrowBwd, ArrowFwd, treeNodes]
|
|
12816
12865
|
);
|
|
12817
|
-
const keyBoardNavigation = (0,
|
|
12818
|
-
const ignoreFocus = (0,
|
|
12866
|
+
const keyBoardNavigation = (0, import_react86.useRef)(true);
|
|
12867
|
+
const ignoreFocus = (0, import_react86.useRef)(false);
|
|
12819
12868
|
const setIgnoreFocus = (value) => ignoreFocus.current = value;
|
|
12820
|
-
const handleFocus = (0,
|
|
12869
|
+
const handleFocus = (0, import_react86.useCallback)(() => {
|
|
12821
12870
|
if (ignoreFocus.current) {
|
|
12822
12871
|
ignoreFocus.current = false;
|
|
12823
12872
|
} else if (selected.length > 0) {
|
|
@@ -12830,7 +12879,7 @@ var useKeyboardNavigation4 = ({
|
|
|
12830
12879
|
setHighlightedIndex(nextFocusableItemIdx());
|
|
12831
12880
|
}
|
|
12832
12881
|
}, [treeNodes, nextFocusableItemIdx, selected, setHighlightedIndex]);
|
|
12833
|
-
const navigateChildItems = (0,
|
|
12882
|
+
const navigateChildItems = (0, import_react86.useCallback)(
|
|
12834
12883
|
(e) => {
|
|
12835
12884
|
const nextIdx = nextFocusableItemIdx(e.key, highlightedIdx);
|
|
12836
12885
|
if (nextIdx !== highlightedIdx) {
|
|
@@ -12845,7 +12894,7 @@ var useKeyboardNavigation4 = ({
|
|
|
12845
12894
|
setHighlightedIndex
|
|
12846
12895
|
]
|
|
12847
12896
|
);
|
|
12848
|
-
const handleKeyDown = (0,
|
|
12897
|
+
const handleKeyDown = (0, import_react86.useCallback)(
|
|
12849
12898
|
(e) => {
|
|
12850
12899
|
if (treeNodes.length > 0 && isNavigationKey4(e, "vertical")) {
|
|
12851
12900
|
e.preventDefault();
|
|
@@ -12856,7 +12905,7 @@ var useKeyboardNavigation4 = ({
|
|
|
12856
12905
|
},
|
|
12857
12906
|
[treeNodes, navigateChildItems]
|
|
12858
12907
|
);
|
|
12859
|
-
const listProps = (0,
|
|
12908
|
+
const listProps = (0, import_react86.useMemo)(
|
|
12860
12909
|
() => ({
|
|
12861
12910
|
onBlur: () => {
|
|
12862
12911
|
setHighlightedIndex(-1);
|
|
@@ -12894,7 +12943,7 @@ var useKeyboardNavigation4 = ({
|
|
|
12894
12943
|
};
|
|
12895
12944
|
|
|
12896
12945
|
// src/tree/use-hierarchical-data.ts
|
|
12897
|
-
var
|
|
12946
|
+
var import_react87 = require("react");
|
|
12898
12947
|
var populateIndices = (nodes, results = [], idx = { value: 0 }) => {
|
|
12899
12948
|
let skipToNextHeader = false;
|
|
12900
12949
|
for (const node of nodes) {
|
|
@@ -12916,10 +12965,10 @@ var populateIndices = (nodes, results = [], idx = { value: 0 }) => {
|
|
|
12916
12965
|
return results;
|
|
12917
12966
|
};
|
|
12918
12967
|
var useHierarchicalData = (source) => {
|
|
12919
|
-
const externalSource = (0,
|
|
12920
|
-
const statefulSource = (0,
|
|
12921
|
-
const indexPositions = (0,
|
|
12922
|
-
const [, forceUpdate] = (0,
|
|
12968
|
+
const externalSource = (0, import_react87.useRef)(source);
|
|
12969
|
+
const statefulSource = (0, import_react87.useRef)(source);
|
|
12970
|
+
const indexPositions = (0, import_react87.useRef)(populateIndices(source));
|
|
12971
|
+
const [, forceUpdate] = (0, import_react87.useState)({});
|
|
12923
12972
|
if (source !== externalSource.current) {
|
|
12924
12973
|
externalSource.current = source;
|
|
12925
12974
|
statefulSource.current = source;
|
|
@@ -12939,7 +12988,7 @@ var useHierarchicalData = (source) => {
|
|
|
12939
12988
|
};
|
|
12940
12989
|
|
|
12941
12990
|
// src/tree/use-collapsible-groups.ts
|
|
12942
|
-
var
|
|
12991
|
+
var import_react88 = require("react");
|
|
12943
12992
|
var NO_HANDLERS4 = {};
|
|
12944
12993
|
var isToggleElement = (element) => element && element.hasAttribute("aria-expanded");
|
|
12945
12994
|
var useCollapsibleGroups2 = ({
|
|
@@ -12949,23 +12998,23 @@ var useCollapsibleGroups2 = ({
|
|
|
12949
12998
|
setVisibleData,
|
|
12950
12999
|
source
|
|
12951
13000
|
}) => {
|
|
12952
|
-
const fullSource = (0,
|
|
12953
|
-
const stateSource = (0,
|
|
12954
|
-
const setSource = (0,
|
|
13001
|
+
const fullSource = (0, import_react88.useRef)(source);
|
|
13002
|
+
const stateSource = (0, import_react88.useRef)(fullSource.current);
|
|
13003
|
+
const setSource = (0, import_react88.useCallback)(
|
|
12955
13004
|
(value) => {
|
|
12956
13005
|
setVisibleData(stateSource.current = value);
|
|
12957
13006
|
},
|
|
12958
13007
|
[setVisibleData]
|
|
12959
13008
|
);
|
|
12960
|
-
const expandNode = (0,
|
|
13009
|
+
const expandNode = (0, import_react88.useCallback)(
|
|
12961
13010
|
(nodeList, { id }) => replaceNode(nodeList, id, { expanded: true }),
|
|
12962
13011
|
[]
|
|
12963
13012
|
);
|
|
12964
|
-
const collapseNode = (0,
|
|
13013
|
+
const collapseNode = (0, import_react88.useCallback)(
|
|
12965
13014
|
(nodeList, { id }) => replaceNode(nodeList, id, { expanded: false }),
|
|
12966
13015
|
[]
|
|
12967
13016
|
);
|
|
12968
|
-
const handleKeyDown = (0,
|
|
13017
|
+
const handleKeyDown = (0, import_react88.useCallback)(
|
|
12969
13018
|
(e) => {
|
|
12970
13019
|
if (e.key === ArrowRight4 || e.key === Enter2) {
|
|
12971
13020
|
const node = treeNodes[highlightedIdx];
|
|
@@ -12991,7 +13040,7 @@ var useCollapsibleGroups2 = ({
|
|
|
12991
13040
|
const listHandlers = collapsibleHeaders ? {
|
|
12992
13041
|
onKeyDown: handleKeyDown
|
|
12993
13042
|
} : NO_HANDLERS4;
|
|
12994
|
-
const handleClick = (0,
|
|
13043
|
+
const handleClick = (0, import_react88.useCallback)(
|
|
12995
13044
|
(evt) => {
|
|
12996
13045
|
const el = closestListItem2(evt.target);
|
|
12997
13046
|
if (isToggleElement(el)) {
|
|
@@ -13017,14 +13066,14 @@ var useCollapsibleGroups2 = ({
|
|
|
13017
13066
|
};
|
|
13018
13067
|
|
|
13019
13068
|
// src/tree/use-tree-keyboard-navigation.ts
|
|
13020
|
-
var
|
|
13069
|
+
var import_react89 = require("react");
|
|
13021
13070
|
var useTreeKeyboardNavigation = ({
|
|
13022
13071
|
highlightedIdx,
|
|
13023
13072
|
hiliteItemAtIndex,
|
|
13024
13073
|
indexPositions,
|
|
13025
13074
|
source
|
|
13026
13075
|
}) => {
|
|
13027
|
-
const handleKeyDown = (0,
|
|
13076
|
+
const handleKeyDown = (0, import_react89.useCallback)(
|
|
13028
13077
|
(e) => {
|
|
13029
13078
|
if (e.key === ArrowLeft4) {
|
|
13030
13079
|
const node = indexPositions[highlightedIdx];
|
|
@@ -13061,7 +13110,7 @@ var useTree = ({
|
|
|
13061
13110
|
selected: selectedProp,
|
|
13062
13111
|
selection
|
|
13063
13112
|
}) => {
|
|
13064
|
-
const lastSelection = (0,
|
|
13113
|
+
const lastSelection = (0, import_react90.useRef)(EMPTY_ARRAY2);
|
|
13065
13114
|
const dataHook = useHierarchicalData(sourceWithIds);
|
|
13066
13115
|
const handleKeyboardNavigation = (evt, nextIdx) => {
|
|
13067
13116
|
var _a2, _b;
|
|
@@ -13094,7 +13143,7 @@ var useTree = ({
|
|
|
13094
13143
|
hiliteItemAtIndex: keyboardHook.hiliteItemAtIndex,
|
|
13095
13144
|
indexPositions: dataHook.indexPositions
|
|
13096
13145
|
});
|
|
13097
|
-
const handleClick = (0,
|
|
13146
|
+
const handleClick = (0, import_react90.useCallback)(
|
|
13098
13147
|
(evt) => {
|
|
13099
13148
|
var _a2, _b, _c;
|
|
13100
13149
|
(_a2 = collapsibleHook.listItemHandlers) == null ? void 0 : _a2.onClick(evt);
|
|
@@ -13104,7 +13153,7 @@ var useTree = ({
|
|
|
13104
13153
|
},
|
|
13105
13154
|
[collapsibleHook, selectionHook]
|
|
13106
13155
|
);
|
|
13107
|
-
const handleKeyDown = (0,
|
|
13156
|
+
const handleKeyDown = (0, import_react90.useCallback)(
|
|
13108
13157
|
(evt) => {
|
|
13109
13158
|
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
13110
13159
|
(_b = (_a2 = keyboardHook.listProps).onKeyDown) == null ? void 0 : _b.call(_a2, evt);
|
|
@@ -13154,14 +13203,14 @@ var useTree = ({
|
|
|
13154
13203
|
};
|
|
13155
13204
|
|
|
13156
13205
|
// src/tree/Tree.tsx
|
|
13157
|
-
var
|
|
13158
|
-
var
|
|
13159
|
-
var
|
|
13206
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
13207
|
+
var import_react92 = require("react");
|
|
13208
|
+
var classBase25 = "vuuTree";
|
|
13160
13209
|
var isExpanded = (node) => node.expanded === true;
|
|
13161
13210
|
var TreeNode = ({ children, idx, ...props }) => {
|
|
13162
|
-
return /* @__PURE__ */ (0,
|
|
13211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("li", { ...props, children });
|
|
13163
13212
|
};
|
|
13164
|
-
var Tree = (0,
|
|
13213
|
+
var Tree = (0, import_react91.forwardRef)(function Tree2({
|
|
13165
13214
|
allowDragDrop,
|
|
13166
13215
|
className,
|
|
13167
13216
|
defaultSelected,
|
|
@@ -13177,7 +13226,7 @@ var Tree = (0, import_react90.forwardRef)(function Tree2({
|
|
|
13177
13226
|
}, forwardedRef) {
|
|
13178
13227
|
var _a2;
|
|
13179
13228
|
const id = (0, import_core37.useIdMemo)(idProp);
|
|
13180
|
-
const rootRef = (0,
|
|
13229
|
+
const rootRef = (0, import_react91.useRef)(null);
|
|
13181
13230
|
const [, sourceWithIds, sourceItemById] = useItemsWithIds(source, id, {
|
|
13182
13231
|
revealSelected: revealSelected ? (_a2 = selectedProp != null ? selectedProp : defaultSelected) != null ? _a2 : false : void 0
|
|
13183
13232
|
});
|
|
@@ -13220,14 +13269,14 @@ var Tree = (0, import_react90.forwardRef)(function Tree2({
|
|
|
13220
13269
|
const allowGroupSelect = groupSelectionEnabled2(groupSelection);
|
|
13221
13270
|
function addLeafNode(list, item, idx) {
|
|
13222
13271
|
list.push(
|
|
13223
|
-
/* @__PURE__ */ (0,
|
|
13272
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
13224
13273
|
TreeNode,
|
|
13225
13274
|
{
|
|
13226
13275
|
...propsCommonToAllListItems,
|
|
13227
13276
|
...getListItemProps(item, idx, highlightedIdx, selected, focusVisible),
|
|
13228
13277
|
children: [
|
|
13229
|
-
item.icon ? /* @__PURE__ */ (0,
|
|
13230
|
-
/* @__PURE__ */ (0,
|
|
13278
|
+
item.icon ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: `${classBase25}Node-icon`, "data-icon": item.icon }) : null,
|
|
13279
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { children: item.label })
|
|
13231
13280
|
]
|
|
13232
13281
|
}
|
|
13233
13282
|
)
|
|
@@ -13238,16 +13287,16 @@ var Tree = (0, import_react90.forwardRef)(function Tree2({
|
|
|
13238
13287
|
const { value: i } = idx;
|
|
13239
13288
|
idx.value += 1;
|
|
13240
13289
|
list.push(
|
|
13241
|
-
/* @__PURE__ */ (0,
|
|
13290
|
+
/* @__PURE__ */ (0, import_react92.createElement)(
|
|
13242
13291
|
TreeNode,
|
|
13243
13292
|
{
|
|
13244
13293
|
...listItemHandlers,
|
|
13245
13294
|
"aria-expanded": child.expanded,
|
|
13246
13295
|
"aria-level": child.level,
|
|
13247
13296
|
"aria-selected": selected.includes(id2) || void 0,
|
|
13248
|
-
className: (0,
|
|
13297
|
+
className: (0, import_clsx35.default)(`${classBase25}Node`, {
|
|
13249
13298
|
focusVisible: focusVisible === i,
|
|
13250
|
-
[`${
|
|
13299
|
+
[`${classBase25}Node-toggle`]: !allowGroupSelect
|
|
13251
13300
|
}),
|
|
13252
13301
|
"data-idx": i,
|
|
13253
13302
|
"data-highlighted": i === highlightedIdx || void 0,
|
|
@@ -13255,20 +13304,20 @@ var Tree = (0, import_react90.forwardRef)(function Tree2({
|
|
|
13255
13304
|
id: id2,
|
|
13256
13305
|
key: `header-${i}`
|
|
13257
13306
|
},
|
|
13258
|
-
allowGroupSelect ? /* @__PURE__ */ (0,
|
|
13259
|
-
/* @__PURE__ */ (0,
|
|
13307
|
+
allowGroupSelect ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: `${classBase25}Node-label`, children: [
|
|
13308
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: `${classBase25}Node-toggle` }),
|
|
13260
13309
|
title
|
|
13261
|
-
] }) : /* @__PURE__ */ (0,
|
|
13262
|
-
child.icon ? /* @__PURE__ */ (0,
|
|
13310
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: `${classBase25}Node-label`, children: [
|
|
13311
|
+
child.icon ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
13263
13312
|
"span",
|
|
13264
13313
|
{
|
|
13265
|
-
className: `${
|
|
13314
|
+
className: `${classBase25}Node-icon`,
|
|
13266
13315
|
"data-icon": child.icon
|
|
13267
13316
|
}
|
|
13268
13317
|
) : null,
|
|
13269
|
-
/* @__PURE__ */ (0,
|
|
13318
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { children: title })
|
|
13270
13319
|
] }),
|
|
13271
|
-
/* @__PURE__ */ (0,
|
|
13320
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("ul", { role: "group", children: isExpanded(child) ? renderSourceContent(child.childNodes, idx) : "" })
|
|
13272
13321
|
)
|
|
13273
13322
|
);
|
|
13274
13323
|
}
|
|
@@ -13285,12 +13334,12 @@ var Tree = (0, import_react90.forwardRef)(function Tree2({
|
|
|
13285
13334
|
return listItems;
|
|
13286
13335
|
}
|
|
13287
13336
|
}
|
|
13288
|
-
return /* @__PURE__ */ (0,
|
|
13337
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
13289
13338
|
"ul",
|
|
13290
13339
|
{
|
|
13291
13340
|
...htmlAttributes,
|
|
13292
13341
|
...listProps,
|
|
13293
|
-
className: (0,
|
|
13342
|
+
className: (0, import_clsx35.default)(classBase25, className),
|
|
13294
13343
|
id: `Tree-${id}`,
|
|
13295
13344
|
ref: (0, import_core37.useForkRef)(rootRef, forwardedRef),
|
|
13296
13345
|
role: "tree",
|
|
@@ -13306,7 +13355,7 @@ var getListItemProps = (item, idx, highlightedIdx, selected, focusVisible, class
|
|
|
13306
13355
|
"aria-selected": selected.includes(item.id) || void 0,
|
|
13307
13356
|
"data-idx": idx.value,
|
|
13308
13357
|
"data-highlighted": idx.value === highlightedIdx || void 0,
|
|
13309
|
-
className: (0,
|
|
13358
|
+
className: (0, import_clsx35.default)("vuuTreeNode", className, {
|
|
13310
13359
|
focusVisible: focusVisible === idx.value
|
|
13311
13360
|
})
|
|
13312
13361
|
});
|