@homebound/beam 3.1.0-alpha.1 → 3.1.0
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/dist/index.cjs +123 -273
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -43
- package/dist/index.d.ts +27 -43
- package/dist/index.js +279 -429
- package/dist/index.js.map +1 -1
- package/package.json +1 -2
package/dist/index.js
CHANGED
|
@@ -4902,7 +4902,7 @@ function Chips(props) {
|
|
|
4902
4902
|
// src/components/Table/GridTable.tsx
|
|
4903
4903
|
import memoizeOne from "memoize-one";
|
|
4904
4904
|
import { runInAction } from "mobx";
|
|
4905
|
-
import React13, { useEffect as useEffect19, useMemo as useMemo24, useRef as
|
|
4905
|
+
import React13, { useEffect as useEffect19, useMemo as useMemo24, useRef as useRef38, useState as useState29 } from "react";
|
|
4906
4906
|
import { Virtuoso as Virtuoso2 } from "react-virtuoso";
|
|
4907
4907
|
|
|
4908
4908
|
// src/components/Layout/ScrollableContent.tsx
|
|
@@ -5482,50 +5482,27 @@ function useHover2(props) {
|
|
|
5482
5482
|
}
|
|
5483
5483
|
|
|
5484
5484
|
// src/hooks/usePersistedFilter.ts
|
|
5485
|
-
import { useEffect as useEffect6, useMemo as useMemo8
|
|
5485
|
+
import { useEffect as useEffect6, useMemo as useMemo8 } from "react";
|
|
5486
5486
|
import { JsonParam, useQueryParams as useQueryParams2 } from "use-query-params";
|
|
5487
5487
|
function usePersistedFilter({ storageKey, filterDefs }) {
|
|
5488
|
-
const
|
|
5489
|
-
() => Object.fromEntries(safeEntries(filterDefs).map(([key, def]) => [key, def(key)])),
|
|
5490
|
-
[filterDefs]
|
|
5491
|
-
);
|
|
5492
|
-
const filterKeys = useMemo8(() => Object.keys(filterImpls), [filterImpls]);
|
|
5488
|
+
const filterKeys = Object.keys(filterDefs);
|
|
5493
5489
|
const defaultFilter = useMemo8(
|
|
5494
5490
|
() => Object.fromEntries(
|
|
5495
|
-
safeEntries(
|
|
5491
|
+
safeEntries(filterDefs).filter(([key, def]) => def(key).defaultValue !== void 0).map(([key, def]) => [key, def(key).defaultValue])
|
|
5496
5492
|
),
|
|
5497
|
-
[
|
|
5493
|
+
[filterDefs]
|
|
5498
5494
|
);
|
|
5499
5495
|
const [{ filter: queryParamsFilter }, setQueryParams] = useQueryParams2({ filter: JsonParam });
|
|
5500
|
-
const [storedFilter, setStoredFilter] = useSessionStorage(
|
|
5501
|
-
storageKey,
|
|
5502
|
-
dehydrateFilter(filterImpls, defaultFilter) ?? defaultFilter
|
|
5503
|
-
);
|
|
5496
|
+
const [storedFilter, setStoredFilter] = useSessionStorage(storageKey, queryParamsFilter ?? defaultFilter);
|
|
5504
5497
|
const isQueryParamFilterValid = hasValidFilterKeys(queryParamsFilter, filterKeys);
|
|
5505
|
-
const
|
|
5506
|
-
const
|
|
5507
|
-
const queryParamsFilterSnapshot = useMemo8(
|
|
5508
|
-
() => parseSerializedValue(serializedQueryParamsFilter),
|
|
5509
|
-
[serializedQueryParamsFilter]
|
|
5510
|
-
);
|
|
5511
|
-
const storedFilterSnapshot = useMemo8(() => parseSerializedValue(serializedStoredFilter), [serializedStoredFilter]);
|
|
5512
|
-
const hydratedQueryParamsFilter = useMemo8(
|
|
5513
|
-
() => isQueryParamFilterValid ? hydrateFilter(filterImpls, queryParamsFilterSnapshot) : void 0,
|
|
5514
|
-
[filterImpls, isQueryParamFilterValid, queryParamsFilterSnapshot]
|
|
5515
|
-
);
|
|
5516
|
-
const hydratedStoredFilter = useMemo8(
|
|
5517
|
-
() => hasValidFilterKeys(storedFilterSnapshot, filterKeys) ? hydrateFilter(filterImpls, storedFilterSnapshot) : void 0,
|
|
5518
|
-
[filterImpls, filterKeys, storedFilterSnapshot]
|
|
5519
|
-
);
|
|
5520
|
-
const rawFilter = hydratedQueryParamsFilter ?? hydratedStoredFilter ?? defaultFilter;
|
|
5521
|
-
const filter = useStableValue(rawFilter);
|
|
5522
|
-
const setFilter = (filter2) => setQueryParams({ filter: dehydrateFilter(filterImpls, filter2) });
|
|
5498
|
+
const filter = isQueryParamFilterValid ? queryParamsFilter : storedFilter ?? defaultFilter;
|
|
5499
|
+
const setFilter = (filter2) => setQueryParams({ filter: filter2 });
|
|
5523
5500
|
useEffect6(
|
|
5524
5501
|
() => {
|
|
5525
5502
|
if (queryParamsFilter === void 0) {
|
|
5526
5503
|
setQueryParams({ filter: storedFilter }, "replaceIn");
|
|
5527
5504
|
} else if (!isQueryParamFilterValid) {
|
|
5528
|
-
setQueryParams({ filter:
|
|
5505
|
+
setQueryParams({ filter: defaultFilter }, "replaceIn");
|
|
5529
5506
|
} else if (JSON.stringify(queryParamsFilter) !== JSON.stringify(storedFilter)) {
|
|
5530
5507
|
setStoredFilter(queryParamsFilter);
|
|
5531
5508
|
}
|
|
@@ -5537,45 +5514,7 @@ function usePersistedFilter({ storageKey, filterDefs }) {
|
|
|
5537
5514
|
return { setFilter, filter };
|
|
5538
5515
|
}
|
|
5539
5516
|
function hasValidFilterKeys(queryParamsFilter, definedKeys) {
|
|
5540
|
-
return
|
|
5541
|
-
}
|
|
5542
|
-
function hydrateFilter(filterImpls, value) {
|
|
5543
|
-
if (typeof value !== "object" || value === null) return void 0;
|
|
5544
|
-
const hydratedEntries = [];
|
|
5545
|
-
safeEntries(value).forEach(([key, rawValue]) => {
|
|
5546
|
-
const filter = filterImpls[key];
|
|
5547
|
-
if (!filter) return;
|
|
5548
|
-
const hydratedValue = filter.hydrate ? filter.hydrate(rawValue) : rawValue;
|
|
5549
|
-
if (hydratedValue !== void 0) {
|
|
5550
|
-
hydratedEntries.push([key, hydratedValue]);
|
|
5551
|
-
}
|
|
5552
|
-
});
|
|
5553
|
-
return Object.fromEntries(hydratedEntries);
|
|
5554
|
-
}
|
|
5555
|
-
function dehydrateFilter(filterImpls, value) {
|
|
5556
|
-
if (!value) return value;
|
|
5557
|
-
return Object.fromEntries(
|
|
5558
|
-
safeEntries(value).map(([key, rawValue]) => {
|
|
5559
|
-
const filter = filterImpls[key];
|
|
5560
|
-
return [
|
|
5561
|
-
key,
|
|
5562
|
-
filter?.dehydrate ? filter.dehydrate(rawValue) : rawValue
|
|
5563
|
-
];
|
|
5564
|
-
})
|
|
5565
|
-
);
|
|
5566
|
-
}
|
|
5567
|
-
function parseSerializedValue(value) {
|
|
5568
|
-
return value === void 0 ? void 0 : JSON.parse(value);
|
|
5569
|
-
}
|
|
5570
|
-
function useStableValue(value) {
|
|
5571
|
-
const stableValue = useRef6(value);
|
|
5572
|
-
const stableKey = useRef6(JSON.stringify(value));
|
|
5573
|
-
const nextKey = JSON.stringify(value);
|
|
5574
|
-
if (stableKey.current !== nextKey) {
|
|
5575
|
-
stableValue.current = value;
|
|
5576
|
-
stableKey.current = nextKey;
|
|
5577
|
-
}
|
|
5578
|
-
return stableValue.current;
|
|
5517
|
+
return queryParamsFilter && safeKeys(queryParamsFilter).every((key) => definedKeys.includes(key));
|
|
5579
5518
|
}
|
|
5580
5519
|
|
|
5581
5520
|
// src/hooks/useSessionStorage.ts
|
|
@@ -5998,7 +5937,7 @@ function CollapseToggle(props) {
|
|
|
5998
5937
|
import { useContext as useContext12 } from "react";
|
|
5999
5938
|
|
|
6000
5939
|
// src/inputs/Autocomplete.tsx
|
|
6001
|
-
import { useCallback as useCallback10, useRef as
|
|
5940
|
+
import { useCallback as useCallback10, useRef as useRef23 } from "react";
|
|
6002
5941
|
import { useComboBox as useComboBox3, useOverlayPosition as useOverlayPosition5 } from "react-aria";
|
|
6003
5942
|
import { Item as Item5, useComboBoxState as useComboBoxState3 } from "react-stately";
|
|
6004
5943
|
|
|
@@ -6006,13 +5945,13 @@ import { Item as Item5, useComboBoxState as useComboBoxState3 } from "react-stat
|
|
|
6006
5945
|
import { DayPicker } from "react-day-picker";
|
|
6007
5946
|
|
|
6008
5947
|
// src/components/internal/DatePicker/Day.tsx
|
|
6009
|
-
import { useRef as
|
|
5948
|
+
import { useRef as useRef6 } from "react";
|
|
6010
5949
|
import { useDayRender } from "react-day-picker";
|
|
6011
5950
|
import { trussProps as trussProps12, mergeProps as mergeProps3 } from "@homebound/truss/runtime";
|
|
6012
5951
|
import { Fragment as Fragment5, jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
6013
5952
|
function Day(props) {
|
|
6014
5953
|
const tid = useTestIds(props, "datePickerDay");
|
|
6015
|
-
const buttonRef =
|
|
5954
|
+
const buttonRef = useRef6(null);
|
|
6016
5955
|
const {
|
|
6017
5956
|
isHidden,
|
|
6018
5957
|
isButton,
|
|
@@ -6193,61 +6132,6 @@ function WeekHeader() {
|
|
|
6193
6132
|
] }, format2(day, "EEEE"))) }) });
|
|
6194
6133
|
}
|
|
6195
6134
|
|
|
6196
|
-
// src/utils/plainDate.ts
|
|
6197
|
-
import { Temporal } from "temporal-polyfill";
|
|
6198
|
-
function plainDateToJsDate(date) {
|
|
6199
|
-
return new Date(date.year, date.month - 1, date.day, 12);
|
|
6200
|
-
}
|
|
6201
|
-
function jsDateToPlainDate(date) {
|
|
6202
|
-
return new Temporal.PlainDate(date.getFullYear(), date.getMonth() + 1, date.getDate());
|
|
6203
|
-
}
|
|
6204
|
-
function dateRangeToJsDateRange(range) {
|
|
6205
|
-
if (!range) return void 0;
|
|
6206
|
-
return {
|
|
6207
|
-
from: range.from ? plainDateToJsDate(range.from) : void 0,
|
|
6208
|
-
to: range.to ? plainDateToJsDate(range.to) : void 0
|
|
6209
|
-
};
|
|
6210
|
-
}
|
|
6211
|
-
function jsDateRangeToDateRange(range) {
|
|
6212
|
-
if (!range) return void 0;
|
|
6213
|
-
return {
|
|
6214
|
-
from: range.from ? jsDateToPlainDate(range.from) : void 0,
|
|
6215
|
-
to: range.to ? jsDateToPlainDate(range.to) : void 0
|
|
6216
|
-
};
|
|
6217
|
-
}
|
|
6218
|
-
function dayMatcherToDayPickerMatcher(matcher) {
|
|
6219
|
-
return (date) => matcher(jsDateToPlainDate(date));
|
|
6220
|
-
}
|
|
6221
|
-
function dayMatchersToDayPickerMatchers(matchers) {
|
|
6222
|
-
if (matchers === void 0) return void 0;
|
|
6223
|
-
return Array.isArray(matchers) ? matchers.map(dayMatcherToDayPickerMatcher) : dayMatcherToDayPickerMatcher(matchers);
|
|
6224
|
-
}
|
|
6225
|
-
function todayPlainDate() {
|
|
6226
|
-
return Temporal.Now.plainDateISO();
|
|
6227
|
-
}
|
|
6228
|
-
function isPlainDate(value) {
|
|
6229
|
-
return value instanceof Temporal.PlainDate;
|
|
6230
|
-
}
|
|
6231
|
-
function parsePersistedPlainDate(value) {
|
|
6232
|
-
if (isPlainDate(value)) return value;
|
|
6233
|
-
if (value instanceof Date && !Number.isNaN(value.getTime())) {
|
|
6234
|
-
return jsDateToPlainDate(value);
|
|
6235
|
-
}
|
|
6236
|
-
if (typeof value !== "string") return void 0;
|
|
6237
|
-
try {
|
|
6238
|
-
if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
6239
|
-
return Temporal.PlainDate.from(value);
|
|
6240
|
-
}
|
|
6241
|
-
} catch {
|
|
6242
|
-
return void 0;
|
|
6243
|
-
}
|
|
6244
|
-
const date = new Date(value);
|
|
6245
|
-
return Number.isNaN(date.getTime()) ? void 0 : jsDateToPlainDate(date);
|
|
6246
|
-
}
|
|
6247
|
-
function dehydratePlainDate(value) {
|
|
6248
|
-
return value?.toString();
|
|
6249
|
-
}
|
|
6250
|
-
|
|
6251
6135
|
// src/components/internal/DatePicker/DatePicker.tsx
|
|
6252
6136
|
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
6253
6137
|
function DatePicker(props) {
|
|
@@ -6267,15 +6151,15 @@ function DatePicker(props) {
|
|
|
6267
6151
|
Head: WeekHeader,
|
|
6268
6152
|
Day
|
|
6269
6153
|
},
|
|
6270
|
-
selected: value ? [
|
|
6271
|
-
defaultMonth:
|
|
6154
|
+
selected: value ? [value] : [],
|
|
6155
|
+
defaultMonth: value ?? /* @__PURE__ */ new Date(),
|
|
6272
6156
|
onDayClick: (day, modifiers) => {
|
|
6273
6157
|
if (modifiers.disabled) return;
|
|
6274
|
-
onSelect(
|
|
6158
|
+
onSelect(day);
|
|
6275
6159
|
},
|
|
6276
|
-
disabled:
|
|
6160
|
+
disabled: disabledDays,
|
|
6277
6161
|
modifiers: {
|
|
6278
|
-
indicatorDot:
|
|
6162
|
+
indicatorDot: dottedDays ?? []
|
|
6279
6163
|
}
|
|
6280
6164
|
}
|
|
6281
6165
|
) });
|
|
@@ -6302,21 +6186,21 @@ function DateRangePicker(props) {
|
|
|
6302
6186
|
useYearPicker
|
|
6303
6187
|
} = props;
|
|
6304
6188
|
const tid = useTestIds(props, "datePicker");
|
|
6305
|
-
return /* @__PURE__ */ jsx21("div", { className: "dib bgWhite fw4 fz_12px lh_16px", ...tid, children: /* @__PURE__ */ jsx21(DayPicker2, { mode: "range", selected:
|
|
6189
|
+
return /* @__PURE__ */ jsx21("div", { className: "dib bgWhite fw4 fz_12px lh_16px", ...tid, children: /* @__PURE__ */ jsx21(DayPicker2, { mode: "range", selected: range, components: {
|
|
6306
6190
|
Caption: useYearPicker ? YearSkipHeader : Header,
|
|
6307
6191
|
Head: WeekHeader,
|
|
6308
6192
|
Day
|
|
6309
|
-
}, defaultMonth:
|
|
6193
|
+
}, defaultMonth: range?.to ?? /* @__PURE__ */ new Date(), onSelect: (selection, day, activeModifiers) => {
|
|
6310
6194
|
if (activeModifiers.disabled) return;
|
|
6311
|
-
onSelect(
|
|
6312
|
-
}, disabled:
|
|
6313
|
-
indicatorDot:
|
|
6195
|
+
onSelect(selection);
|
|
6196
|
+
}, disabled: disabledDays, modifiers: {
|
|
6197
|
+
indicatorDot: dottedDays ?? []
|
|
6314
6198
|
} }) });
|
|
6315
6199
|
}
|
|
6316
6200
|
|
|
6317
6201
|
// src/components/internal/Menu.tsx
|
|
6318
6202
|
import { camelCase } from "change-case";
|
|
6319
|
-
import { useEffect as useEffect8, useMemo as useMemo9, useRef as
|
|
6203
|
+
import { useEffect as useEffect8, useMemo as useMemo9, useRef as useRef10, useState as useState11 } from "react";
|
|
6320
6204
|
import { FocusScope, useFilter as useFilter2, useMenu } from "react-aria";
|
|
6321
6205
|
import { Item, Section, useTreeData, useTreeState } from "react-stately";
|
|
6322
6206
|
|
|
@@ -6361,7 +6245,7 @@ import { trussProps as trussProps21 } from "@homebound/truss/runtime";
|
|
|
6361
6245
|
|
|
6362
6246
|
// src/inputs/internal/MenuSearchField.tsx
|
|
6363
6247
|
import { useTextField } from "@react-aria/textfield";
|
|
6364
|
-
import { useRef as
|
|
6248
|
+
import { useRef as useRef9 } from "react";
|
|
6365
6249
|
|
|
6366
6250
|
// src/inputs/TextFieldBase.tsx
|
|
6367
6251
|
import { useState as useState10 } from "react";
|
|
@@ -6460,7 +6344,7 @@ function InlineLabel({
|
|
|
6460
6344
|
|
|
6461
6345
|
// src/components/Table/components/Row.tsx
|
|
6462
6346
|
import { observer } from "mobx-react";
|
|
6463
|
-
import React6, { useCallback as useCallback6, useContext as useContext10, useRef as
|
|
6347
|
+
import React6, { useCallback as useCallback6, useContext as useContext10, useRef as useRef8 } from "react";
|
|
6464
6348
|
import { mergeProps as mergeProps5 } from "react-aria";
|
|
6465
6349
|
|
|
6466
6350
|
// src/components/Table/components/cell.tsx
|
|
@@ -6526,7 +6410,7 @@ var rowClickRenderFn = (as, api, colSpan) => (key, css2, content, row, rowStyle,
|
|
|
6526
6410
|
};
|
|
6527
6411
|
|
|
6528
6412
|
// src/components/Table/components/ColumnResizeHandle.tsx
|
|
6529
|
-
import { useCallback as useCallback5, useContext as useContext8, useEffect as useEffect7, useRef as
|
|
6413
|
+
import { useCallback as useCallback5, useContext as useContext8, useEffect as useEffect7, useRef as useRef7, useState as useState9 } from "react";
|
|
6530
6414
|
import { trussProps as trussProps16 } from "@homebound/truss/runtime";
|
|
6531
6415
|
import { Fragment as Fragment7, jsx as jsx26, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
6532
6416
|
function findScrollableParent(element) {
|
|
@@ -6564,13 +6448,13 @@ function ColumnResizeHandle({
|
|
|
6564
6448
|
const [guideLineX, setGuideLineX] = useState9(null);
|
|
6565
6449
|
const [guideLineTop, setGuideLineTop] = useState9(0);
|
|
6566
6450
|
const [guideLineHeight, setGuideLineHeight] = useState9(0);
|
|
6567
|
-
const startXRef =
|
|
6568
|
-
const startWidthRef =
|
|
6569
|
-
const startHandleRightRef =
|
|
6570
|
-
const handleRef =
|
|
6571
|
-
const rafRef =
|
|
6572
|
-
const pendingMouseXRef =
|
|
6573
|
-
const scrollableParentRef =
|
|
6451
|
+
const startXRef = useRef7(0);
|
|
6452
|
+
const startWidthRef = useRef7(0);
|
|
6453
|
+
const startHandleRightRef = useRef7(0);
|
|
6454
|
+
const handleRef = useRef7(null);
|
|
6455
|
+
const rafRef = useRef7(null);
|
|
6456
|
+
const pendingMouseXRef = useRef7(null);
|
|
6457
|
+
const scrollableParentRef = useRef7(null);
|
|
6574
6458
|
const tid = useTestIds({}, "columnResizeHandle");
|
|
6575
6459
|
const handleMouseDown = useCallback5((e) => {
|
|
6576
6460
|
e.preventDefault();
|
|
@@ -7712,7 +7596,7 @@ function RowImpl(props) {
|
|
|
7712
7596
|
let foundFirstContentColumn = false;
|
|
7713
7597
|
let minStickyLeftOffset = 0;
|
|
7714
7598
|
let expandColumnHidden = false;
|
|
7715
|
-
const ref =
|
|
7599
|
+
const ref = useRef8(null);
|
|
7716
7600
|
const dragOverCallback = useCallback6((row2, evt) => onDragOver?.(row2, evt), [onDragOver]);
|
|
7717
7601
|
const onDragOverDebounced = useDebouncedCallback2(dragOverCallback, 100);
|
|
7718
7602
|
const RowContent = () => /* @__PURE__ */ jsx28(RowTag, { ...mergeProps_12(BorderHoverParent, void 0, rowCss), ...others, "data-gridrow": true, ...getCount(row.id), ref, children: isKeptGroupRow ? /* @__PURE__ */ jsx28(KeptGroupRow, { as, style, columnSizes, row, colSpan: columns.length, isLastBodyRow }) : columns.map((column2, columnIndex) => {
|
|
@@ -8478,7 +8362,7 @@ var textFieldBaseMultilineTopPadding = 11;
|
|
|
8478
8362
|
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
8479
8363
|
function MenuSearchField(props) {
|
|
8480
8364
|
const tid = useTestIds(props);
|
|
8481
|
-
const inputRef =
|
|
8365
|
+
const inputRef = useRef9(null);
|
|
8482
8366
|
const { labelProps, inputProps } = useTextField({ ...props }, inputRef);
|
|
8483
8367
|
return /* @__PURE__ */ jsx31(
|
|
8484
8368
|
TextFieldBase,
|
|
@@ -8562,7 +8446,7 @@ function Menu(props) {
|
|
|
8562
8446
|
keys !== "all" && onChange && onChange([...keys.values()].map((k) => k.toString())[0]);
|
|
8563
8447
|
}
|
|
8564
8448
|
});
|
|
8565
|
-
const menuRef =
|
|
8449
|
+
const menuRef = useRef10(null);
|
|
8566
8450
|
const {
|
|
8567
8451
|
menuProps
|
|
8568
8452
|
} = useMenu({
|
|
@@ -8604,7 +8488,7 @@ function Menu(props) {
|
|
|
8604
8488
|
}
|
|
8605
8489
|
|
|
8606
8490
|
// src/components/internal/MenuItem.tsx
|
|
8607
|
-
import { useRef as
|
|
8491
|
+
import { useRef as useRef13 } from "react";
|
|
8608
8492
|
import { useHover as useHover7, useMenuItem } from "react-aria";
|
|
8609
8493
|
import { useHistory } from "react-router";
|
|
8610
8494
|
import { Link as Link3 } from "react-router-dom";
|
|
@@ -8859,12 +8743,12 @@ var pressedOverlayCss = {
|
|
|
8859
8743
|
};
|
|
8860
8744
|
|
|
8861
8745
|
// src/components/ButtonModal.tsx
|
|
8862
|
-
import { useRef as
|
|
8746
|
+
import { useRef as useRef12 } from "react";
|
|
8863
8747
|
import { useMenuTrigger } from "react-aria";
|
|
8864
8748
|
import { useMenuTriggerState } from "react-stately";
|
|
8865
8749
|
|
|
8866
8750
|
// src/components/internal/OverlayTrigger.tsx
|
|
8867
|
-
import { useMemo as useMemo13, useRef as
|
|
8751
|
+
import { useMemo as useMemo13, useRef as useRef11 } from "react";
|
|
8868
8752
|
import { useOverlayPosition } from "react-aria";
|
|
8869
8753
|
|
|
8870
8754
|
// src/components/Button.tsx
|
|
@@ -9554,7 +9438,7 @@ function OverlayTrigger(props) {
|
|
|
9554
9438
|
}
|
|
9555
9439
|
}
|
|
9556
9440
|
}), [menuTriggerProps, state]);
|
|
9557
|
-
const popoverRef =
|
|
9441
|
+
const popoverRef = useRef11(null);
|
|
9558
9442
|
const {
|
|
9559
9443
|
overlayProps: positionProps
|
|
9560
9444
|
} = useOverlayPosition({
|
|
@@ -9616,7 +9500,7 @@ import { jsx as jsx39 } from "react/jsx-runtime";
|
|
|
9616
9500
|
function ButtonModal(props) {
|
|
9617
9501
|
const { storybookDefaultOpen, trigger, disabled, content, title } = props;
|
|
9618
9502
|
const state = useMenuTriggerState({ isOpen: storybookDefaultOpen });
|
|
9619
|
-
const buttonRef =
|
|
9503
|
+
const buttonRef = useRef12(null);
|
|
9620
9504
|
const { menuTriggerProps } = useMenuTrigger({ isDisabled: !!disabled }, state, buttonRef);
|
|
9621
9505
|
const tid = useTestIds(
|
|
9622
9506
|
props,
|
|
@@ -9700,7 +9584,7 @@ function MenuItemImpl(props) {
|
|
|
9700
9584
|
const isDisabled = Boolean(disabled);
|
|
9701
9585
|
const isSelected = state.selectionManager.selectedKeys.has(label);
|
|
9702
9586
|
const isFocused = state.selectionManager.focusedKey === item.key;
|
|
9703
|
-
const ref =
|
|
9587
|
+
const ref = useRef13(null);
|
|
9704
9588
|
const history = useHistory();
|
|
9705
9589
|
const {
|
|
9706
9590
|
hoverProps,
|
|
@@ -9847,7 +9731,7 @@ function Popover(props) {
|
|
|
9847
9731
|
}
|
|
9848
9732
|
|
|
9849
9733
|
// src/inputs/internal/ComboBoxBase.tsx
|
|
9850
|
-
import { useCallback as useCallback9, useEffect as useEffect14, useMemo as useMemo16, useRef as
|
|
9734
|
+
import { useCallback as useCallback9, useEffect as useEffect14, useMemo as useMemo16, useRef as useRef22, useState as useState19 } from "react";
|
|
9851
9735
|
import { useButton as useButton7, useComboBox as useComboBox2, useFilter as useFilter4, useOverlayPosition as useOverlayPosition4 } from "react-aria";
|
|
9852
9736
|
import { Item as Item4, useComboBoxState as useComboBoxState2 } from "react-stately";
|
|
9853
9737
|
import { trussProps as trussProps39 } from "@homebound/truss/runtime";
|
|
@@ -9918,13 +9802,13 @@ function useGrowingTextField({ inputRef, inputWrapRef, value, disabled, maxLines
|
|
|
9918
9802
|
}
|
|
9919
9803
|
|
|
9920
9804
|
// src/inputs/TreeSelectField/TreeSelectField.tsx
|
|
9921
|
-
import React9, { useCallback as useCallback8, useContext as useContext11, useEffect as useEffect13, useMemo as useMemo15, useRef as
|
|
9805
|
+
import React9, { useCallback as useCallback8, useContext as useContext11, useEffect as useEffect13, useMemo as useMemo15, useRef as useRef21, useState as useState17 } from "react";
|
|
9922
9806
|
import { useButton as useButton6, useComboBox, useFilter as useFilter3, useOverlayPosition as useOverlayPosition3 } from "react-aria";
|
|
9923
9807
|
import { Item as Item3, useComboBoxState } from "react-stately";
|
|
9924
9808
|
import { trussProps as trussProps37 } from "@homebound/truss/runtime";
|
|
9925
9809
|
|
|
9926
9810
|
// src/inputs/internal/ListBox.tsx
|
|
9927
|
-
import { useEffect as useEffect12, useRef as
|
|
9811
|
+
import { useEffect as useEffect12, useRef as useRef20, useState as useState16 } from "react";
|
|
9928
9812
|
import { useListBox } from "react-aria";
|
|
9929
9813
|
import { trussProps as trussProps36 } from "@homebound/truss/runtime";
|
|
9930
9814
|
|
|
@@ -9937,17 +9821,17 @@ import { useListBoxSection, useSeparator as useSeparator2 } from "react-aria";
|
|
|
9937
9821
|
import { trussProps as trussProps35 } from "@homebound/truss/runtime";
|
|
9938
9822
|
|
|
9939
9823
|
// src/inputs/internal/Option.tsx
|
|
9940
|
-
import { useRef as
|
|
9824
|
+
import { useRef as useRef16 } from "react";
|
|
9941
9825
|
import { mergeProps as mergeProps12, useHover as useHover8, useOption } from "react-aria";
|
|
9942
9826
|
|
|
9943
9827
|
// src/inputs/ChipSelectField.tsx
|
|
9944
9828
|
import { camelCase as camelCase2 } from "change-case";
|
|
9945
|
-
import { useEffect as useEffect10, useMemo as useMemo14, useRef as
|
|
9829
|
+
import { useEffect as useEffect10, useMemo as useMemo14, useRef as useRef15, useState as useState15 } from "react";
|
|
9946
9830
|
import { mergeProps as mergeProps11, useButton as useButton5, useFocus as useFocus2, useOverlayPosition as useOverlayPosition2, useSelect } from "react-aria";
|
|
9947
9831
|
import { Item as Item2, Section as Section2, useListData, useSelectState } from "react-stately";
|
|
9948
9832
|
|
|
9949
9833
|
// src/inputs/ChipTextField.tsx
|
|
9950
|
-
import { useEffect as useEffect9, useRef as
|
|
9834
|
+
import { useEffect as useEffect9, useRef as useRef14, useState as useState14 } from "react";
|
|
9951
9835
|
import { useFocus } from "react-aria";
|
|
9952
9836
|
import { trussProps as trussProps28 } from "@homebound/truss/runtime";
|
|
9953
9837
|
import { jsx as jsx43 } from "react/jsx-runtime";
|
|
@@ -9966,7 +9850,7 @@ function ChipTextField(props) {
|
|
|
9966
9850
|
const {
|
|
9967
9851
|
fieldProps
|
|
9968
9852
|
} = usePresentationContext();
|
|
9969
|
-
const valueRef =
|
|
9853
|
+
const valueRef = useRef14(value);
|
|
9970
9854
|
const tid = useTestIds(props, "chipField");
|
|
9971
9855
|
const [isFocused, setIsFocused] = useState14(false);
|
|
9972
9856
|
const {
|
|
@@ -9987,7 +9871,7 @@ function ChipTextField(props) {
|
|
|
9987
9871
|
onBlur: () => maybeCall(onBlur),
|
|
9988
9872
|
onFocusChange: setIsFocused
|
|
9989
9873
|
});
|
|
9990
|
-
const fieldRef =
|
|
9874
|
+
const fieldRef = useRef14(null);
|
|
9991
9875
|
useEffect9(
|
|
9992
9876
|
() => {
|
|
9993
9877
|
autoFocus && fieldRef.current?.focus();
|
|
@@ -10094,7 +9978,7 @@ function defaultOptionLabel(opt) {
|
|
|
10094
9978
|
import { trussProps as trussProps30 } from "@homebound/truss/runtime";
|
|
10095
9979
|
import { Fragment as Fragment15, jsx as jsx45, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
10096
9980
|
function ChipSelectField(props) {
|
|
10097
|
-
const firstRender =
|
|
9981
|
+
const firstRender = useRef15(true);
|
|
10098
9982
|
const {
|
|
10099
9983
|
fieldProps
|
|
10100
9984
|
} = usePresentationContext();
|
|
@@ -10152,10 +10036,10 @@ function ChipSelectField(props) {
|
|
|
10152
10036
|
} = useFocus2({
|
|
10153
10037
|
onFocusChange: setIsClearFocused
|
|
10154
10038
|
});
|
|
10155
|
-
const buttonRef =
|
|
10156
|
-
const popoverRef =
|
|
10157
|
-
const listBoxRef =
|
|
10158
|
-
const wrapperRef =
|
|
10039
|
+
const buttonRef = useRef15(null);
|
|
10040
|
+
const popoverRef = useRef15(null);
|
|
10041
|
+
const listBoxRef = useRef15(null);
|
|
10042
|
+
const wrapperRef = useRef15(null);
|
|
10159
10043
|
const listData = useListData({
|
|
10160
10044
|
initialItems: !onCreateNew ? options : [{
|
|
10161
10045
|
title: "Options",
|
|
@@ -10359,7 +10243,7 @@ function Option(props) {
|
|
|
10359
10243
|
scrollToIndex,
|
|
10360
10244
|
disabledReason
|
|
10361
10245
|
} = props;
|
|
10362
|
-
const ref =
|
|
10246
|
+
const ref = useRef16(null);
|
|
10363
10247
|
const {
|
|
10364
10248
|
hoverProps,
|
|
10365
10249
|
isHovered
|
|
@@ -10438,7 +10322,7 @@ function Option(props) {
|
|
|
10438
10322
|
|
|
10439
10323
|
// src/inputs/internal/VirtualizedOptions.tsx
|
|
10440
10324
|
import { getInteractionModality } from "@react-aria/interactions";
|
|
10441
|
-
import { useEffect as useEffect11, useRef as
|
|
10325
|
+
import { useEffect as useEffect11, useRef as useRef19 } from "react";
|
|
10442
10326
|
import { Virtuoso } from "react-virtuoso";
|
|
10443
10327
|
|
|
10444
10328
|
// src/inputs/internal/LoadingDots.tsx
|
|
@@ -10486,11 +10370,11 @@ function LoadingDots({
|
|
|
10486
10370
|
}
|
|
10487
10371
|
|
|
10488
10372
|
// src/inputs/TreeSelectField/TreeOption.tsx
|
|
10489
|
-
import { useRef as
|
|
10373
|
+
import { useRef as useRef18 } from "react";
|
|
10490
10374
|
import { useHover as useHover10, useOption as useOption2 } from "react-aria";
|
|
10491
10375
|
|
|
10492
10376
|
// src/inputs/CheckboxBase.tsx
|
|
10493
|
-
import { useRef as
|
|
10377
|
+
import { useRef as useRef17 } from "react";
|
|
10494
10378
|
import { mergeProps as mergeProps13, useFocusRing as useFocusRing5, useHover as useHover9, VisuallyHidden as VisuallyHidden3 } from "react-aria";
|
|
10495
10379
|
import { trussProps as trussProps33 } from "@homebound/truss/runtime";
|
|
10496
10380
|
import { jsx as jsx48, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
@@ -10509,7 +10393,7 @@ function CheckboxBase(props) {
|
|
|
10509
10393
|
tooltip,
|
|
10510
10394
|
fullWidth = false
|
|
10511
10395
|
} = props;
|
|
10512
|
-
const ref =
|
|
10396
|
+
const ref = useRef17(null);
|
|
10513
10397
|
const {
|
|
10514
10398
|
isFocusVisible,
|
|
10515
10399
|
focusProps
|
|
@@ -10654,7 +10538,7 @@ function TreeOption(props) {
|
|
|
10654
10538
|
const leveledOption = item.value;
|
|
10655
10539
|
if (!leveledOption) return null;
|
|
10656
10540
|
const [option, level] = leveledOption;
|
|
10657
|
-
const ref =
|
|
10541
|
+
const ref = useRef18(null);
|
|
10658
10542
|
const {
|
|
10659
10543
|
hoverProps,
|
|
10660
10544
|
isHovered
|
|
@@ -10663,7 +10547,8 @@ function TreeOption(props) {
|
|
|
10663
10547
|
const {
|
|
10664
10548
|
collapsedKeys,
|
|
10665
10549
|
setCollapsedKeys,
|
|
10666
|
-
getOptionValue
|
|
10550
|
+
getOptionValue,
|
|
10551
|
+
groupKeys
|
|
10667
10552
|
} = useTreeSelectFieldProvider();
|
|
10668
10553
|
const {
|
|
10669
10554
|
optionProps,
|
|
@@ -10675,6 +10560,12 @@ function TreeOption(props) {
|
|
|
10675
10560
|
shouldSelectOnPressUp: true,
|
|
10676
10561
|
shouldFocusOnHover: false
|
|
10677
10562
|
}, state, ref);
|
|
10563
|
+
const isGroup = groupKeys.includes(item.key);
|
|
10564
|
+
const canCollapse = allowCollapsing && !!option.children?.length;
|
|
10565
|
+
function toggleCollapsed() {
|
|
10566
|
+
if (!canCollapse) return;
|
|
10567
|
+
setCollapsedKeys((prevKeys) => collapsedKeys.includes(item.key) ? prevKeys.filter((k) => k !== item.key) : [...prevKeys, item.key]);
|
|
10568
|
+
}
|
|
10678
10569
|
const isIndeterminate = !isSelected && option.children?.some((o) => hasSelectedChildren(o, state, getOptionValue));
|
|
10679
10570
|
const listItemStyles = {
|
|
10680
10571
|
item: {
|
|
@@ -10702,7 +10593,12 @@ function TreeOption(props) {
|
|
|
10702
10593
|
}]
|
|
10703
10594
|
}
|
|
10704
10595
|
};
|
|
10705
|
-
return /* @__PURE__ */ jsxs33("li", { ...hoverProps,
|
|
10596
|
+
return /* @__PURE__ */ jsxs33("li", { ...hoverProps, onClick: (e) => {
|
|
10597
|
+
if (!isGroup) return;
|
|
10598
|
+
e.preventDefault();
|
|
10599
|
+
e.stopPropagation();
|
|
10600
|
+
toggleCollapsed();
|
|
10601
|
+
}, ...trussProps34({
|
|
10706
10602
|
...{
|
|
10707
10603
|
display: "df",
|
|
10708
10604
|
alignItems: "aic",
|
|
@@ -10719,18 +10615,18 @@ function TreeOption(props) {
|
|
|
10719
10615
|
lineHeight: "lh_20px"
|
|
10720
10616
|
},
|
|
10721
10617
|
...listItemStyles.item,
|
|
10722
|
-
...isHovered && !isDisabled ? listItemStyles.hover : {},
|
|
10723
|
-
...isFocused ? listItemStyles.focus : {},
|
|
10724
|
-
...isDisabled ? listItemStyles.disabled : {}
|
|
10618
|
+
...isHovered && (!isDisabled || isGroup) ? listItemStyles.hover : {},
|
|
10619
|
+
...isFocused && !isGroup ? listItemStyles.focus : {},
|
|
10620
|
+
...isDisabled && !isGroup ? listItemStyles.disabled : {}
|
|
10725
10621
|
}), children: [
|
|
10726
|
-
allowCollapsing && /* @__PURE__ */ jsx49("span", { className: "w_18px fs0 df aic", children:
|
|
10622
|
+
allowCollapsing && /* @__PURE__ */ jsx49("span", { className: "w_18px fs0 df aic", children: canCollapse && /* @__PURE__ */ jsx49("button", { onClick: (e) => {
|
|
10727
10623
|
e.preventDefault();
|
|
10728
10624
|
e.stopPropagation();
|
|
10729
|
-
|
|
10625
|
+
toggleCollapsed();
|
|
10730
10626
|
return false;
|
|
10731
10627
|
}, className: "br4 h_16px w_16px bgTransparent h_bgGray300", ...tid[`collapseToggle_${item.key}`], children: /* @__PURE__ */ jsx49(Icon, { icon: collapsedKeys.includes(item.key) ? "triangleRight" : "triangleDown", inc: 2 }) }) }),
|
|
10732
10628
|
/* @__PURE__ */ jsxs33("span", { className: "df aic gap1 h100 fg1 pt1 pb1 pr2", ref, ...optionProps, "data-label": item.textValue, children: [
|
|
10733
|
-
/* @__PURE__ */ jsx49(StyledCheckbox, { isDisabled, isSelected, isIndeterminate, ...tid[item.key.toString()] }),
|
|
10629
|
+
!isGroup && /* @__PURE__ */ jsx49(StyledCheckbox, { isDisabled, isSelected, isIndeterminate, ...tid[item.key.toString()] }),
|
|
10734
10630
|
/* @__PURE__ */ jsx49("div", { className: "pl1", children: item.rendered })
|
|
10735
10631
|
] })
|
|
10736
10632
|
] });
|
|
@@ -10792,7 +10688,7 @@ function VirtualizedOptions(props) {
|
|
|
10792
10688
|
isTree,
|
|
10793
10689
|
allowCollapsing
|
|
10794
10690
|
} = props;
|
|
10795
|
-
const virtuosoRef =
|
|
10691
|
+
const virtuosoRef = useRef19(null);
|
|
10796
10692
|
const focusedKey = state.selectionManager.focusedKey;
|
|
10797
10693
|
const focusedItem = focusedKey != null ? state.collection.getItem(focusedKey) : null;
|
|
10798
10694
|
const selectedItem = state.selectionManager.selectedKeys.size > 0 ? state.collection.getItem([...state.selectionManager.selectedKeys.values()][0]) : void 0;
|
|
@@ -10813,9 +10709,14 @@ function VirtualizedOptions(props) {
|
|
|
10813
10709
|
totalListHeightChanged: onListHeightChange,
|
|
10814
10710
|
totalCount: items.length,
|
|
10815
10711
|
...process.env.NODE_ENV === "test" ? {
|
|
10816
|
-
//
|
|
10817
|
-
//
|
|
10818
|
-
//
|
|
10712
|
+
// In tests, we render all rows so assertions can see expands/async-loaded items. However,
|
|
10713
|
+
// the `initialItemCount` (next prop) is only applied on amount, so we set `key={items.length}`
|
|
10714
|
+
// to force a remount when our list changes -- and we only want/need this in tests, b/c otherwise
|
|
10715
|
+
// in production a Virtuoso remount causes visible flashing.
|
|
10716
|
+
key: items.length,
|
|
10717
|
+
// We don't really need to set this, but it's handy for tests, which would otherwise render
|
|
10718
|
+
// just 1 row. A better way to do this would be to jest.mock out Virtuoso with an impl that
|
|
10719
|
+
// just rendered everything, but doing this for now.
|
|
10819
10720
|
initialItemCount: items.length
|
|
10820
10721
|
} : {
|
|
10821
10722
|
// Ensure the selected item is visible when the list renders
|
|
@@ -10855,8 +10756,7 @@ function VirtualizedOptions(props) {
|
|
|
10855
10756
|
components: !loading ? {} : {
|
|
10856
10757
|
Footer: typeof loading === "function" ? loading : () => /* @__PURE__ */ jsx50(LoadingDots, { contrast })
|
|
10857
10758
|
}
|
|
10858
|
-
}
|
|
10859
|
-
items.length
|
|
10759
|
+
}
|
|
10860
10760
|
);
|
|
10861
10761
|
}
|
|
10862
10762
|
|
|
@@ -10946,9 +10846,9 @@ function ListBox(props) {
|
|
|
10946
10846
|
const isMultiSelect = state.selectionManager.selectionMode === "multiple";
|
|
10947
10847
|
const firstItem = state.collection.at(0);
|
|
10948
10848
|
const hasSections = firstItem && firstItem.type === "section";
|
|
10949
|
-
const selectedList =
|
|
10950
|
-
const firstRender =
|
|
10951
|
-
const virtuosoListHeight =
|
|
10849
|
+
const selectedList = useRef20(null);
|
|
10850
|
+
const firstRender = useRef20(true);
|
|
10851
|
+
const virtuosoListHeight = useRef20(0);
|
|
10952
10852
|
const onListHeightChange = (listHeight) => {
|
|
10953
10853
|
virtuosoListHeight.current = listHeight;
|
|
10954
10854
|
const height = (selectedList.current?.offsetHeight || 0) + listHeight;
|
|
@@ -11029,6 +10929,7 @@ function TreeSelectField(props) {
|
|
|
11029
10929
|
...otherProps
|
|
11030
10930
|
} = props;
|
|
11031
10931
|
const [collapsedKeys, setCollapsedKeys] = useState17([]);
|
|
10932
|
+
const groupKeys = useMemo15(() => props.groupOptions?.map((option) => valueToKey(option)) ?? [], [props.groupOptions]);
|
|
11032
10933
|
useEffect13(() => {
|
|
11033
10934
|
setCollapsedKeys(!Array.isArray(options) ? [] : defaultCollapsed ? options.map((o) => getOptionValue(o)) : options.flatMap(flattenOptions).filter((o) => o.defaultCollapsed).map((o) => getOptionValue(o)));
|
|
11034
10935
|
}, [options, defaultCollapsed]);
|
|
@@ -11036,11 +10937,12 @@ function TreeSelectField(props) {
|
|
|
11036
10937
|
() => ({
|
|
11037
10938
|
collapsedKeys,
|
|
11038
10939
|
setCollapsedKeys,
|
|
11039
|
-
getOptionValue
|
|
10940
|
+
getOptionValue,
|
|
10941
|
+
groupKeys
|
|
11040
10942
|
}),
|
|
11041
10943
|
// TODO: validate this eslint-disable. It was automatically ignored as part of https://app.shortcut.com/homebound-team/story/40033/enable-react-hooks-exhaustive-deps-for-react-projects
|
|
11042
10944
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
11043
|
-
[collapsedKeys, setCollapsedKeys]
|
|
10945
|
+
[collapsedKeys, setCollapsedKeys, groupKeys]
|
|
11044
10946
|
);
|
|
11045
10947
|
return /* @__PURE__ */ jsx54(CollapsedContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx54(TreeSelectFieldBase, { ...otherProps, options, getOptionLabel, getOptionValue, values, onSelect: ({
|
|
11046
10948
|
all,
|
|
@@ -11061,7 +10963,8 @@ var CollapsedContext = React9.createContext({
|
|
|
11061
10963
|
collapsedKeys: [],
|
|
11062
10964
|
setCollapsedKeys: () => {
|
|
11063
10965
|
},
|
|
11064
|
-
getOptionValue: () => ({})
|
|
10966
|
+
getOptionValue: () => ({}),
|
|
10967
|
+
groupKeys: []
|
|
11065
10968
|
});
|
|
11066
10969
|
function TreeSelectFieldBase(props) {
|
|
11067
10970
|
const {
|
|
@@ -11080,13 +10983,15 @@ function TreeSelectFieldBase(props) {
|
|
|
11080
10983
|
contrast = false,
|
|
11081
10984
|
nothingSelectedText = "",
|
|
11082
10985
|
onSelect,
|
|
11083
|
-
defaultCollapsed = false,
|
|
10986
|
+
defaultCollapsed: _defaultCollapsed = false,
|
|
11084
10987
|
placeholder,
|
|
11085
10988
|
fullWidth = fieldProps?.fullWidth ?? false,
|
|
11086
10989
|
chipDisplay = "root",
|
|
11087
10990
|
disabledOptions,
|
|
10991
|
+
groupOptions: _groupOptions,
|
|
11088
10992
|
...otherProps
|
|
11089
10993
|
} = props;
|
|
10994
|
+
void _defaultCollapsed;
|
|
11090
10995
|
const isDisabled = !!disabled;
|
|
11091
10996
|
const isReadOnly = !!readOnly;
|
|
11092
10997
|
const initialOptions = Array.isArray(options) ? options : options.current;
|
|
@@ -11098,7 +11003,10 @@ function TreeSelectFieldBase(props) {
|
|
|
11098
11003
|
const {
|
|
11099
11004
|
collapsedKeys
|
|
11100
11005
|
} = useTreeSelectFieldProvider();
|
|
11006
|
+
const groupKeys = useMemo15(() => _groupOptions?.map((option) => valueToKey(option)) ?? [], [_groupOptions]);
|
|
11007
|
+
const groupKeySet = useMemo15(() => new Set(groupKeys), [groupKeys]);
|
|
11101
11008
|
const disabledOptionsWithReasons = Object.fromEntries(disabledOptions?.map(disabledOptionToKeyedTuple) ?? []);
|
|
11009
|
+
const disabledKeys = [.../* @__PURE__ */ new Set([...Object.keys(disabledOptionsWithReasons), ...groupKeys])];
|
|
11102
11010
|
const initTreeFieldState = useCallback8(() => {
|
|
11103
11011
|
const selectedKeys = new Set(values?.flatMap((v) => {
|
|
11104
11012
|
const foundOptions = findOptions(initialOptions, valueToKey(v), getOptionValue);
|
|
@@ -11107,14 +11015,16 @@ function TreeSelectFieldBase(props) {
|
|
|
11107
11015
|
}) => selectOptionAndAllChildren(option));
|
|
11108
11016
|
}));
|
|
11109
11017
|
function selectOptionAndAllChildren(maybeParent) {
|
|
11110
|
-
|
|
11018
|
+
const key = valueToKey(getOptionValue(maybeParent));
|
|
11019
|
+
return [...groupKeySet.has(key) ? [] : [key], ...maybeParent.children?.flatMap(selectOptionAndAllChildren) ?? []];
|
|
11111
11020
|
}
|
|
11112
11021
|
function areAllChildrenSelected(maybeParent) {
|
|
11113
|
-
const
|
|
11022
|
+
const key = valueToKey(getOptionValue(maybeParent));
|
|
11023
|
+
const isSelected = selectedKeys.has(key);
|
|
11114
11024
|
if (isSelected || !maybeParent.children || maybeParent.children.length === 0) return isSelected;
|
|
11115
11025
|
const areAllSelected = maybeParent.children.every(areAllChildrenSelected);
|
|
11116
|
-
if (areAllSelected) {
|
|
11117
|
-
selectedKeys.add(
|
|
11026
|
+
if (areAllSelected && !groupKeySet.has(key)) {
|
|
11027
|
+
selectedKeys.add(key);
|
|
11118
11028
|
}
|
|
11119
11029
|
return areAllSelected;
|
|
11120
11030
|
}
|
|
@@ -11125,18 +11035,17 @@ function TreeSelectFieldBase(props) {
|
|
|
11125
11035
|
return [maybeOption.option];
|
|
11126
11036
|
});
|
|
11127
11037
|
const selectedOptionsLabels = chipDisplay === "root" ? initialOptions.flatMap((o) => getTopLevelSelections(o, selectedKeys, getOptionValue)).map(getOptionLabel) : chipDisplay === "leaf" ? selectedOptions.filter((o) => !o.children || o.children.length === 0).map(getOptionLabel) : selectedOptions.map(getOptionLabel);
|
|
11128
|
-
const filteredOptions = initialOptions.flatMap((o) => levelOptions(o, 0, false, collapsedKeys, getOptionValue));
|
|
11129
11038
|
return {
|
|
11130
11039
|
selectedKeys: [...selectedKeys],
|
|
11040
|
+
searchValue: void 0,
|
|
11131
11041
|
inputValue: selectedOptions.length === 1 ? getOptionLabel([...selectedOptions][0]) : isReadOnly && selectedOptions.length > 0 ? selectedOptionsLabels.join(", ") : selectedOptions.length === 0 ? nothingSelectedText : "",
|
|
11132
|
-
filteredOptions,
|
|
11133
11042
|
selectedOptions,
|
|
11134
11043
|
allOptions: initialOptions,
|
|
11135
11044
|
selectedOptionsLabels,
|
|
11136
11045
|
optionsLoading: false,
|
|
11137
11046
|
allowCollapsing: true
|
|
11138
11047
|
};
|
|
11139
|
-
}, [initialOptions, values, chipDisplay, getOptionLabel, isReadOnly, nothingSelectedText, getOptionValue,
|
|
11048
|
+
}, [initialOptions, values, chipDisplay, getOptionLabel, isReadOnly, nothingSelectedText, getOptionValue, groupKeySet]);
|
|
11140
11049
|
const [fieldState, setFieldState] = useState17(() => initTreeFieldState());
|
|
11141
11050
|
useEffect13(() => {
|
|
11142
11051
|
if (Array.isArray(options)) {
|
|
@@ -11156,75 +11065,54 @@ function TreeSelectFieldBase(props) {
|
|
|
11156
11065
|
setFieldState(initTreeFieldState());
|
|
11157
11066
|
}
|
|
11158
11067
|
}, [getOptionValue, initTreeFieldState, values]);
|
|
11159
|
-
const
|
|
11160
|
-
useEffect13(
|
|
11161
|
-
() => {
|
|
11162
|
-
if (reactToCollapse.current) {
|
|
11163
|
-
setFieldState(({
|
|
11164
|
-
allOptions,
|
|
11165
|
-
inputValue,
|
|
11166
|
-
...others
|
|
11167
|
-
}) => ({
|
|
11168
|
-
allOptions,
|
|
11169
|
-
inputValue,
|
|
11170
|
-
...others,
|
|
11171
|
-
filteredOptions: allOptions.flatMap((o) => levelOptions(o, 0, inputValue.length > 0, collapsedKeys, getOptionValue).filter(([option]) => contains(getOptionLabel(option), inputValue)))
|
|
11172
|
-
}));
|
|
11173
|
-
}
|
|
11174
|
-
reactToCollapse.current = true;
|
|
11175
|
-
},
|
|
11176
|
-
// Only react to collapseKey changes. Other deps should be stable (`contains`, `getOptionLabel`, `getOptionValue`).
|
|
11177
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
11178
|
-
[collapsedKeys]
|
|
11179
|
-
);
|
|
11068
|
+
const filteredOptions = useMemo15(() => getFilteredOptions(fieldState.allOptions, fieldState.searchValue, collapsedKeys, contains, getOptionLabel, getOptionValue), [fieldState.allOptions, fieldState.searchValue, collapsedKeys, contains, getOptionLabel, getOptionValue]);
|
|
11180
11069
|
const onInputChange = useCallback8((inputValue) => {
|
|
11181
11070
|
setFieldState((prevState) => {
|
|
11182
11071
|
return {
|
|
11183
11072
|
...prevState,
|
|
11184
11073
|
inputValue,
|
|
11185
|
-
|
|
11186
|
-
|
|
11074
|
+
searchValue: inputValue.length === 0 ? void 0 : inputValue,
|
|
11075
|
+
allowCollapsing: inputValue.length === 0
|
|
11187
11076
|
};
|
|
11188
11077
|
});
|
|
11189
|
-
}, [
|
|
11190
|
-
const maybeInitLoad = useCallback8(async (options2,
|
|
11078
|
+
}, []);
|
|
11079
|
+
const maybeInitLoad = useCallback8(async (options2, setFieldState2) => {
|
|
11191
11080
|
if (!Array.isArray(options2)) {
|
|
11192
11081
|
setFieldState2((prevState) => ({
|
|
11193
11082
|
...prevState,
|
|
11194
11083
|
optionsLoading: true
|
|
11195
11084
|
}));
|
|
11196
11085
|
const loadedOptions = (await options2.load()).options;
|
|
11197
|
-
const filteredOptions = loadedOptions.flatMap((o) => levelOptions(o, 0, fieldState2.inputValue.length > 0, collapsedKeys, getOptionValue).filter(([option]) => contains(getOptionLabel(option), fieldState2.inputValue)));
|
|
11198
11086
|
setFieldState2((prevState) => ({
|
|
11199
11087
|
...prevState,
|
|
11200
|
-
filteredOptions,
|
|
11201
11088
|
allOptions: loadedOptions,
|
|
11202
11089
|
optionsLoading: false
|
|
11203
11090
|
}));
|
|
11204
11091
|
}
|
|
11205
|
-
}, [
|
|
11206
|
-
const firstOpen =
|
|
11092
|
+
}, []);
|
|
11093
|
+
const firstOpen = useRef21(true);
|
|
11207
11094
|
function onOpenChange(isOpen) {
|
|
11208
11095
|
if (firstOpen.current && isOpen) {
|
|
11209
|
-
maybeInitLoad(options,
|
|
11096
|
+
maybeInitLoad(options, setFieldState);
|
|
11210
11097
|
firstOpen.current = false;
|
|
11211
11098
|
}
|
|
11212
11099
|
if (isOpen) {
|
|
11213
11100
|
setFieldState((prevState) => ({
|
|
11214
11101
|
...prevState,
|
|
11215
11102
|
inputValue: "",
|
|
11216
|
-
|
|
11103
|
+
searchValue: void 0,
|
|
11104
|
+
allowCollapsing: true
|
|
11217
11105
|
}));
|
|
11218
11106
|
}
|
|
11219
11107
|
}
|
|
11220
11108
|
const comboBoxChildren = useCallback8(([item]) => /* @__PURE__ */ jsx54(Item3, { textValue: getOptionLabel(item), children: getOptionMenuLabel(item) }, valueToKey(getOptionValue(item))), [getOptionValue, getOptionLabel, getOptionMenuLabel]);
|
|
11221
11109
|
const comboBoxProps = {
|
|
11222
11110
|
...otherProps,
|
|
11223
|
-
disabledKeys
|
|
11111
|
+
disabledKeys,
|
|
11224
11112
|
placeholder: !values || values.length === 0 ? placeholder : "",
|
|
11225
11113
|
label: props.label,
|
|
11226
11114
|
inputValue: fieldState.inputValue,
|
|
11227
|
-
items:
|
|
11115
|
+
items: filteredOptions,
|
|
11228
11116
|
isDisabled,
|
|
11229
11117
|
isReadOnly,
|
|
11230
11118
|
onInputChange,
|
|
@@ -11249,6 +11137,8 @@ function TreeSelectFieldBase(props) {
|
|
|
11249
11137
|
setFieldState((prevState) => ({
|
|
11250
11138
|
...prevState,
|
|
11251
11139
|
inputValue: nothingSelectedText,
|
|
11140
|
+
searchValue: void 0,
|
|
11141
|
+
allowCollapsing: true,
|
|
11252
11142
|
selectedKeys: [],
|
|
11253
11143
|
selectedOptions: []
|
|
11254
11144
|
}));
|
|
@@ -11279,15 +11169,16 @@ function TreeSelectFieldBase(props) {
|
|
|
11279
11169
|
const childrenKeys = option.children.flatMap(flattenOptions).map((o) => valueToKey(getOptionValue(o))).filter((childKey) => {
|
|
11280
11170
|
return !state.disabledKeys.has(childKey);
|
|
11281
11171
|
});
|
|
11282
|
-
[key, ...childrenKeys].forEach(addedKeys.add, addedKeys);
|
|
11172
|
+
[...groupKeySet.has(key) ? [] : [key], ...childrenKeys].forEach(addedKeys.add, addedKeys);
|
|
11283
11173
|
}
|
|
11284
|
-
|
|
11285
|
-
|
|
11286
|
-
|
|
11287
|
-
|
|
11288
|
-
|
|
11289
|
-
|
|
11290
|
-
|
|
11174
|
+
const selectionKeys = /* @__PURE__ */ new Set([...existingKeys, ...addedKeys]);
|
|
11175
|
+
for (const parent of [...parents].reverse()) {
|
|
11176
|
+
const parentKey = valueToKey(getOptionValue(parent));
|
|
11177
|
+
if (isOptionFullySelected(parent, selectionKeys, state.disabledKeys, groupKeySet, getOptionValue)) {
|
|
11178
|
+
if (!groupKeySet.has(parentKey)) {
|
|
11179
|
+
addedKeys.add(parentKey);
|
|
11180
|
+
selectionKeys.add(parentKey);
|
|
11181
|
+
}
|
|
11291
11182
|
}
|
|
11292
11183
|
}
|
|
11293
11184
|
}
|
|
@@ -11320,7 +11211,7 @@ function TreeSelectFieldBase(props) {
|
|
|
11320
11211
|
...prevState,
|
|
11321
11212
|
// Since we reset the list of options upon selection changes, then set the `inputValue` to empty string to reflect that.
|
|
11322
11213
|
inputValue: "",
|
|
11323
|
-
|
|
11214
|
+
searchValue: void 0,
|
|
11324
11215
|
selectedKeys: [...selectedKeys],
|
|
11325
11216
|
selectedOptions,
|
|
11326
11217
|
selectedOptionsLabels: chipDisplay === "root" ? rootOptions.map(getOptionLabel) : chipDisplay === "leaf" ? leafOptions.map(getOptionLabel) : selectedOptions.map(getOptionLabel)
|
|
@@ -11351,17 +11242,17 @@ function TreeSelectFieldBase(props) {
|
|
|
11351
11242
|
setFieldState((prevState) => ({
|
|
11352
11243
|
...prevState,
|
|
11353
11244
|
inputValue: selectedOptions.length === 1 ? getOptionLabel(selectedOptions[0]) : selectedOptions.length === 0 ? nothingSelectedText : "",
|
|
11354
|
-
|
|
11245
|
+
searchValue: void 0,
|
|
11355
11246
|
allowCollapsing: true
|
|
11356
11247
|
}));
|
|
11357
11248
|
}
|
|
11358
11249
|
}
|
|
11359
|
-
const comboBoxRef =
|
|
11360
|
-
const triggerRef =
|
|
11361
|
-
const inputRef =
|
|
11362
|
-
const inputWrapRef =
|
|
11363
|
-
const listBoxRef =
|
|
11364
|
-
const popoverRef =
|
|
11250
|
+
const comboBoxRef = useRef21(null);
|
|
11251
|
+
const triggerRef = useRef21(null);
|
|
11252
|
+
const inputRef = useRef21(null);
|
|
11253
|
+
const inputWrapRef = useRef21(null);
|
|
11254
|
+
const listBoxRef = useRef21(null);
|
|
11255
|
+
const popoverRef = useRef21(null);
|
|
11365
11256
|
const {
|
|
11366
11257
|
buttonProps: triggerProps,
|
|
11367
11258
|
inputProps,
|
|
@@ -11440,6 +11331,18 @@ function getTopLevelSelections(o, selectedKeys, getOptionValue) {
|
|
|
11440
11331
|
if (o.children) return [...o.children.flatMap((c) => getTopLevelSelections(c, selectedKeys, getOptionValue))];
|
|
11441
11332
|
return [];
|
|
11442
11333
|
}
|
|
11334
|
+
function getFilteredOptions(allOptions, searchValue, collapsedKeys, contains, getOptionLabel, getOptionValue) {
|
|
11335
|
+
return allOptions.flatMap((option) => levelOptions(option, 0, !!searchValue, collapsedKeys, getOptionValue).filter(([nestedOption]) => searchValue ? contains(getOptionLabel(nestedOption), searchValue) : true));
|
|
11336
|
+
}
|
|
11337
|
+
function isOptionFullySelected(option, selectedKeys, disabledKeys, groupKeys, getOptionValue) {
|
|
11338
|
+
const key = valueToKey(getOptionValue(option));
|
|
11339
|
+
if (groupKeys.has(key)) {
|
|
11340
|
+
return option.children?.length ? option.children.every((child) => isOptionFullySelected(child, selectedKeys, disabledKeys, groupKeys, getOptionValue)) : false;
|
|
11341
|
+
}
|
|
11342
|
+
if (selectedKeys.has(key) || disabledKeys.has(key)) return true;
|
|
11343
|
+
if (!option.children || option.children.length === 0) return false;
|
|
11344
|
+
return option.children.every((child) => isOptionFullySelected(child, selectedKeys, disabledKeys, groupKeys, getOptionValue));
|
|
11345
|
+
}
|
|
11443
11346
|
|
|
11444
11347
|
// src/inputs/internal/ComboBoxInput.tsx
|
|
11445
11348
|
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
@@ -11700,7 +11603,7 @@ function ComboBoxBase(props) {
|
|
|
11700
11603
|
}));
|
|
11701
11604
|
}
|
|
11702
11605
|
}
|
|
11703
|
-
const firstOpen =
|
|
11606
|
+
const firstOpen = useRef22(true);
|
|
11704
11607
|
function onOpenChange(isOpen) {
|
|
11705
11608
|
if (firstOpen.current && isOpen) {
|
|
11706
11609
|
maybeInitLoad();
|
|
@@ -11713,12 +11616,12 @@ function ComboBoxBase(props) {
|
|
|
11713
11616
|
}));
|
|
11714
11617
|
}
|
|
11715
11618
|
}
|
|
11716
|
-
const comboBoxRef =
|
|
11717
|
-
const triggerRef =
|
|
11718
|
-
const inputRef =
|
|
11719
|
-
const inputWrapRef =
|
|
11720
|
-
const listBoxRef =
|
|
11721
|
-
const popoverRef =
|
|
11619
|
+
const comboBoxRef = useRef22(null);
|
|
11620
|
+
const triggerRef = useRef22(null);
|
|
11621
|
+
const inputRef = useRef22(null);
|
|
11622
|
+
const inputWrapRef = useRef22(null);
|
|
11623
|
+
const listBoxRef = useRef22(null);
|
|
11624
|
+
const popoverRef = useRef22(null);
|
|
11722
11625
|
const disabledOptionsWithReasons = Object.fromEntries(disabledOptions?.map(disabledOptionToKeyedTuple) ?? []);
|
|
11723
11626
|
const comboBoxChildren = useCallback9((item) => /* @__PURE__ */ jsx56(Item4, { textValue: getOptionLabel(item), children: getOptionMenuLabel(item) }, valueToKey(getOptionValue(item))), [getOptionValue, getOptionLabel, getOptionMenuLabel]);
|
|
11724
11627
|
const selectedKeys = useMemo16(() => {
|
|
@@ -11952,10 +11855,10 @@ function Autocomplete(props) {
|
|
|
11952
11855
|
...others
|
|
11953
11856
|
};
|
|
11954
11857
|
const state = useComboBoxState3(comboBoxProps);
|
|
11955
|
-
const inputWrapRef =
|
|
11956
|
-
const inputRef =
|
|
11957
|
-
const listBoxRef =
|
|
11958
|
-
const popoverRef =
|
|
11858
|
+
const inputWrapRef = useRef23(null);
|
|
11859
|
+
const inputRef = useRef23(null);
|
|
11860
|
+
const listBoxRef = useRef23(null);
|
|
11861
|
+
const popoverRef = useRef23(null);
|
|
11959
11862
|
const { inputProps, listBoxProps, labelProps } = useComboBox3(
|
|
11960
11863
|
{
|
|
11961
11864
|
...comboBoxProps,
|
|
@@ -12022,7 +11925,7 @@ function Autocomplete(props) {
|
|
|
12022
11925
|
}
|
|
12023
11926
|
|
|
12024
11927
|
// src/inputs/Checkbox.tsx
|
|
12025
|
-
import { useRef as
|
|
11928
|
+
import { useRef as useRef24 } from "react";
|
|
12026
11929
|
import { useCheckbox } from "react-aria";
|
|
12027
11930
|
import { useToggleState } from "react-stately";
|
|
12028
11931
|
import { jsx as jsx58 } from "react/jsx-runtime";
|
|
@@ -12032,7 +11935,7 @@ function Checkbox(props) {
|
|
|
12032
11935
|
const isIndeterminate = selected === "indeterminate";
|
|
12033
11936
|
const ariaProps = { isSelected, isDisabled: !!disabled, isIndeterminate, ...otherProps };
|
|
12034
11937
|
const checkboxProps = { ...ariaProps, "aria-label": label };
|
|
12035
|
-
const ref =
|
|
11938
|
+
const ref = useRef24(null);
|
|
12036
11939
|
const toggleState = useToggleState(ariaProps);
|
|
12037
11940
|
const { inputProps } = useCheckbox(checkboxProps, toggleState, ref);
|
|
12038
11941
|
return /* @__PURE__ */ jsx58(
|
|
@@ -12051,7 +11954,7 @@ function Checkbox(props) {
|
|
|
12051
11954
|
}
|
|
12052
11955
|
|
|
12053
11956
|
// src/inputs/CheckboxGroup.tsx
|
|
12054
|
-
import { useRef as
|
|
11957
|
+
import { useRef as useRef25 } from "react";
|
|
12055
11958
|
import { useCheckboxGroup, useCheckboxGroupItem } from "react-aria";
|
|
12056
11959
|
import { useCheckboxGroupState } from "react-stately";
|
|
12057
11960
|
import { trussProps as trussProps40 } from "@homebound/truss/runtime";
|
|
@@ -12126,7 +12029,7 @@ function CheckboxGroupItem(props) {
|
|
|
12126
12029
|
...ariaProps,
|
|
12127
12030
|
"aria-label": label
|
|
12128
12031
|
};
|
|
12129
|
-
const ref =
|
|
12032
|
+
const ref = useRef25(null);
|
|
12130
12033
|
const {
|
|
12131
12034
|
inputProps
|
|
12132
12035
|
} = useCheckboxGroupItem(checkboxProps, groupState, ref);
|
|
@@ -12140,7 +12043,7 @@ import { jsx as jsx60 } from "react/jsx-runtime";
|
|
|
12140
12043
|
function DateFieldMock(props) {
|
|
12141
12044
|
const { onChange = () => {
|
|
12142
12045
|
}, errorMsg, onBlur, onFocus } = props;
|
|
12143
|
-
const [value, setValue] = useState20(props.value ? format3(
|
|
12046
|
+
const [value, setValue] = useState20(props.value ? format3(props.value, "MM/dd/yy") : "");
|
|
12144
12047
|
const tid = useTestIds(props, "date");
|
|
12145
12048
|
return /* @__PURE__ */ jsx60(
|
|
12146
12049
|
"input",
|
|
@@ -12151,8 +12054,7 @@ function DateFieldMock(props) {
|
|
|
12151
12054
|
onChange: (e) => {
|
|
12152
12055
|
const { value: value2 } = e.target;
|
|
12153
12056
|
setValue(value2);
|
|
12154
|
-
|
|
12155
|
-
onChange(Number.isNaN(parsed.getTime()) ? void 0 : jsDateToPlainDate(parsed));
|
|
12057
|
+
onChange(parse(value2, "MM/dd/yy", /* @__PURE__ */ new Date()));
|
|
12156
12058
|
},
|
|
12157
12059
|
onBlur: () => maybeCall(onBlur),
|
|
12158
12060
|
onFocus: () => maybeCall(onFocus),
|
|
@@ -12164,13 +12066,13 @@ function DateFieldMock(props) {
|
|
|
12164
12066
|
}
|
|
12165
12067
|
|
|
12166
12068
|
// src/inputs/DateFields/DateFieldBase.tsx
|
|
12167
|
-
import { useCallback as useCallback11, useEffect as useEffect15, useRef as
|
|
12069
|
+
import { useCallback as useCallback11, useEffect as useEffect15, useRef as useRef26, useState as useState21 } from "react";
|
|
12168
12070
|
import { FocusScope as FocusScope3, useButton as useButton8, useOverlayPosition as useOverlayPosition6, useOverlayTrigger, useTextField as useTextField2 } from "react-aria";
|
|
12071
|
+
import { isDateRange } from "react-day-picker";
|
|
12169
12072
|
import { useOverlayTriggerState } from "react-stately";
|
|
12170
12073
|
|
|
12171
12074
|
// src/inputs/DateFields/utils.ts
|
|
12172
12075
|
import { format as dateFnsFormat, parse as dateFnsParse, isDate } from "date-fns";
|
|
12173
|
-
import { Temporal as Temporal2 } from "temporal-polyfill";
|
|
12174
12076
|
var dateFormats = {
|
|
12175
12077
|
short: "MM/dd/yy",
|
|
12176
12078
|
medium: "EEE, MMM d",
|
|
@@ -12181,13 +12083,13 @@ function getDateFormat(format4) {
|
|
|
12181
12083
|
}
|
|
12182
12084
|
function formatDate(date, format4) {
|
|
12183
12085
|
if (!date) return "";
|
|
12184
|
-
return dateFnsFormat(
|
|
12086
|
+
return dateFnsFormat(date, format4);
|
|
12185
12087
|
}
|
|
12186
12088
|
function formatDateRange(date, format4) {
|
|
12187
12089
|
if (!date) return "";
|
|
12188
12090
|
const { from, to } = date;
|
|
12189
|
-
const fromFormatted = from ? dateFnsFormat(
|
|
12190
|
-
const toFormatted = to ? dateFnsFormat(
|
|
12091
|
+
const fromFormatted = from ? dateFnsFormat(from, format4) : "";
|
|
12092
|
+
const toFormatted = to ? dateFnsFormat(to, format4) : "";
|
|
12191
12093
|
return !fromFormatted && !toFormatted ? void 0 : `${fromFormatted} - ${toFormatted}`;
|
|
12192
12094
|
}
|
|
12193
12095
|
function parseDate(str, format4) {
|
|
@@ -12197,7 +12099,7 @@ function parseDateRange(str, format4) {
|
|
|
12197
12099
|
const [from = "", to = ""] = str.split("-");
|
|
12198
12100
|
const fromDate = parseDateString(from.trim(), format4);
|
|
12199
12101
|
const toDate = parseDateString(to.trim(), format4);
|
|
12200
|
-
if (toDate && fromDate &&
|
|
12102
|
+
if (toDate && fromDate && toDate < fromDate) {
|
|
12201
12103
|
return { from: toDate, to: fromDate };
|
|
12202
12104
|
}
|
|
12203
12105
|
if (toDate === void 0 && fromDate === void 0) {
|
|
@@ -12219,16 +12121,13 @@ function parseDateString(str, format4) {
|
|
|
12219
12121
|
if (isNaN(year) || String(year).length > 4 || isNaN(month) || isNaN(day) || day <= 0 || day > 31 || month < 0 || month >= 12) {
|
|
12220
12122
|
return void 0;
|
|
12221
12123
|
}
|
|
12222
|
-
const parsed = dateFnsParse(str, format4,
|
|
12223
|
-
if (!
|
|
12124
|
+
const parsed = dateFnsParse(str, format4, /* @__PURE__ */ new Date());
|
|
12125
|
+
if (!isValidDate(parsed)) {
|
|
12224
12126
|
return void 0;
|
|
12225
12127
|
}
|
|
12226
|
-
return
|
|
12128
|
+
return parsed;
|
|
12227
12129
|
}
|
|
12228
12130
|
function isValidDate(d) {
|
|
12229
|
-
return d !== void 0 && isPlainDate(d);
|
|
12230
|
-
}
|
|
12231
|
-
function isValidJsDate(d) {
|
|
12232
12131
|
return d !== void 0 && isDate(d) && d.toString() !== "Invalid Date";
|
|
12233
12132
|
}
|
|
12234
12133
|
|
|
@@ -12260,11 +12159,11 @@ function DateFieldBase(props) {
|
|
|
12260
12159
|
...others
|
|
12261
12160
|
} = props;
|
|
12262
12161
|
const isRangeMode = mode === "range";
|
|
12263
|
-
const inputRef =
|
|
12264
|
-
const inputWrapRef =
|
|
12265
|
-
const buttonRef =
|
|
12266
|
-
const overlayRef =
|
|
12267
|
-
const isFocused =
|
|
12162
|
+
const inputRef = useRef26(null);
|
|
12163
|
+
const inputWrapRef = useRef26(null);
|
|
12164
|
+
const buttonRef = useRef26(null);
|
|
12165
|
+
const overlayRef = useRef26(null);
|
|
12166
|
+
const isFocused = useRef26(false);
|
|
12268
12167
|
const dateFormat = getDateFormat(format4);
|
|
12269
12168
|
const [wipValue, setWipValue] = useState21(value);
|
|
12270
12169
|
const [inputValue, setInputValue] = useState21((isRangeMode ? formatDateRange(props.value, dateFormat) : formatDate(props.value, dateFormat)) ?? "");
|
|
@@ -12354,11 +12253,11 @@ function DateFieldBase(props) {
|
|
|
12354
12253
|
(d) => {
|
|
12355
12254
|
setWipValue(d);
|
|
12356
12255
|
if (d && isParsedDateValid(d)) {
|
|
12357
|
-
if (isRangeMode &&
|
|
12256
|
+
if (isRangeMode && isDateRange(d)) {
|
|
12358
12257
|
props.onChange(d);
|
|
12359
12258
|
return;
|
|
12360
12259
|
}
|
|
12361
|
-
if (!isRangeMode && !
|
|
12260
|
+
if (!isRangeMode && !isDateRange(d)) {
|
|
12362
12261
|
props.onChange(d);
|
|
12363
12262
|
return;
|
|
12364
12263
|
}
|
|
@@ -12433,10 +12332,7 @@ function DateFieldBase(props) {
|
|
|
12433
12332
|
] });
|
|
12434
12333
|
}
|
|
12435
12334
|
function isParsedDateValid(d) {
|
|
12436
|
-
return d !== void 0 && (!
|
|
12437
|
-
}
|
|
12438
|
-
function isDateRangeValue(value) {
|
|
12439
|
-
return typeof value === "object" && value !== null && ("from" in value || "to" in value);
|
|
12335
|
+
return d !== void 0 && (!isDateRange(d) || isDateRange(d) && isValidDate(d.from) && isValidDate(d.to));
|
|
12440
12336
|
}
|
|
12441
12337
|
|
|
12442
12338
|
// src/utils/withTestMock.tsx
|
|
@@ -12623,7 +12519,7 @@ function MultiSelectField(props) {
|
|
|
12623
12519
|
|
|
12624
12520
|
// src/inputs/NumberField.tsx
|
|
12625
12521
|
import { NumberParser } from "@internationalized/number";
|
|
12626
|
-
import { useMemo as useMemo18, useRef as
|
|
12522
|
+
import { useMemo as useMemo18, useRef as useRef27, useState as useState23 } from "react";
|
|
12627
12523
|
import { mergeProps as mergeProps15, useLocale, useNumberField } from "react-aria";
|
|
12628
12524
|
import { useNumberFieldState } from "react-stately";
|
|
12629
12525
|
import { jsx as jsx68 } from "react/jsx-runtime";
|
|
@@ -12710,11 +12606,11 @@ function NumberField(props) {
|
|
|
12710
12606
|
};
|
|
12711
12607
|
}, [type, numberFormatOptions, defaultFormatOptions, numFractionDigits]);
|
|
12712
12608
|
const numberParser = useMemo18(() => new NumberParser(locale, formatOptions), [locale, formatOptions]);
|
|
12713
|
-
const valueRef =
|
|
12609
|
+
const valueRef = useRef27({
|
|
12714
12610
|
wip: false
|
|
12715
12611
|
});
|
|
12716
|
-
const lastSentRef =
|
|
12717
|
-
const focusValueRef =
|
|
12612
|
+
const lastSentRef = useRef27(void 0);
|
|
12613
|
+
const focusValueRef = useRef27(void 0);
|
|
12718
12614
|
const [, forceRender] = useState23(0);
|
|
12719
12615
|
const propValue = value === void 0 ? Number.NaN : value / factor;
|
|
12720
12616
|
if (valueRef.current.wip && !Object.is(valueRef.current.value, propValue)) {
|
|
@@ -12762,7 +12658,7 @@ function NumberField(props) {
|
|
|
12762
12658
|
...otherProps
|
|
12763
12659
|
};
|
|
12764
12660
|
const state = useNumberFieldState(useProps);
|
|
12765
|
-
const inputRef =
|
|
12661
|
+
const inputRef = useRef27(null);
|
|
12766
12662
|
const {
|
|
12767
12663
|
labelProps,
|
|
12768
12664
|
inputProps,
|
|
@@ -12814,7 +12710,7 @@ function formatValue(value, factor, numFractionDigits, numIntegerDigits, positiv
|
|
|
12814
12710
|
}
|
|
12815
12711
|
|
|
12816
12712
|
// src/inputs/RadioGroupField.tsx
|
|
12817
|
-
import { Fragment as Fragment19, useMemo as useMemo19, useRef as
|
|
12713
|
+
import { Fragment as Fragment19, useMemo as useMemo19, useRef as useRef28 } from "react";
|
|
12818
12714
|
import { useFocusRing as useFocusRing6, useHover as useHover12, useRadio, useRadioGroup } from "react-aria";
|
|
12819
12715
|
import { useRadioGroupState } from "react-stately";
|
|
12820
12716
|
import { trussProps as trussProps44 } from "@homebound/truss/runtime";
|
|
@@ -12890,7 +12786,7 @@ function Radio(props) {
|
|
|
12890
12786
|
} = props;
|
|
12891
12787
|
const labelId = `${parentId}-${value}-label`;
|
|
12892
12788
|
const descriptionId = `${parentId}-${value}-description`;
|
|
12893
|
-
const ref =
|
|
12789
|
+
const ref = useRef28(null);
|
|
12894
12790
|
const {
|
|
12895
12791
|
inputProps,
|
|
12896
12792
|
isDisabled
|
|
@@ -13060,7 +12956,7 @@ var radioDisabled = {
|
|
|
13060
12956
|
|
|
13061
12957
|
// src/inputs/RichTextField.tsx
|
|
13062
12958
|
import DOMPurify from "dompurify";
|
|
13063
|
-
import { createElement, useEffect as useEffect16, useMemo as useMemo20, useRef as
|
|
12959
|
+
import { createElement, useEffect as useEffect16, useMemo as useMemo20, useRef as useRef29, useState as useState25 } from "react";
|
|
13064
12960
|
|
|
13065
12961
|
// src/inputs/RichTextField.mock.tsx
|
|
13066
12962
|
import { camelCase as camelCase3 } from "change-case";
|
|
@@ -13116,13 +13012,13 @@ function RichTextFieldImpl(props) {
|
|
|
13116
13012
|
fullWidth = fieldProps?.fullWidth ?? false
|
|
13117
13013
|
} = props;
|
|
13118
13014
|
const [editor, setEditor] = useState25();
|
|
13119
|
-
const editorElement =
|
|
13120
|
-
const currentHtml =
|
|
13121
|
-
const onChangeRef =
|
|
13015
|
+
const editorElement = useRef29();
|
|
13016
|
+
const currentHtml = useRef29(void 0);
|
|
13017
|
+
const onChangeRef = useRef29(onChange);
|
|
13122
13018
|
onChangeRef.current = onChange;
|
|
13123
|
-
const onBlurRef =
|
|
13019
|
+
const onBlurRef = useRef29(onBlur);
|
|
13124
13020
|
onBlurRef.current = onBlur;
|
|
13125
|
-
const onFocusRef =
|
|
13021
|
+
const onFocusRef = useRef29(onFocus);
|
|
13126
13022
|
onFocusRef.current = onFocus;
|
|
13127
13023
|
const id = useMemo20(() => {
|
|
13128
13024
|
if (readOnly) return;
|
|
@@ -13273,7 +13169,7 @@ function SelectField(props) {
|
|
|
13273
13169
|
}
|
|
13274
13170
|
|
|
13275
13171
|
// src/inputs/Switch.tsx
|
|
13276
|
-
import { useRef as
|
|
13172
|
+
import { useRef as useRef30 } from "react";
|
|
13277
13173
|
import { useFocusRing as useFocusRing7, useHover as useHover13, useSwitch, VisuallyHidden as VisuallyHidden5 } from "react-aria";
|
|
13278
13174
|
import { trussProps as trussProps46 } from "@homebound/truss/runtime";
|
|
13279
13175
|
import { jsx as jsx73, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
@@ -13306,7 +13202,7 @@ function Switch(props) {
|
|
|
13306
13202
|
...otherProps
|
|
13307
13203
|
};
|
|
13308
13204
|
const state = toToggleState(isSelected, onChange);
|
|
13309
|
-
const ref =
|
|
13205
|
+
const ref = useRef30(null);
|
|
13310
13206
|
const {
|
|
13311
13207
|
inputProps
|
|
13312
13208
|
} = useSwitch({
|
|
@@ -13458,7 +13354,7 @@ function switchCircleSelectedStyles(isCompact) {
|
|
|
13458
13354
|
}
|
|
13459
13355
|
|
|
13460
13356
|
// src/inputs/TextAreaField.tsx
|
|
13461
|
-
import { useRef as
|
|
13357
|
+
import { useRef as useRef31 } from "react";
|
|
13462
13358
|
import { mergeProps as mergeProps16, useTextField as useTextField3 } from "react-aria";
|
|
13463
13359
|
import { jsx as jsx74 } from "react/jsx-runtime";
|
|
13464
13360
|
function TextAreaField(props) {
|
|
@@ -13476,8 +13372,8 @@ function TextAreaField(props) {
|
|
|
13476
13372
|
const isDisabled = !!disabled;
|
|
13477
13373
|
const isReadOnly = !!readOnly;
|
|
13478
13374
|
const textFieldProps = { ...otherProps, value, isDisabled, isReadOnly };
|
|
13479
|
-
const inputRef =
|
|
13480
|
-
const inputWrapRef =
|
|
13375
|
+
const inputRef = useRef31(null);
|
|
13376
|
+
const inputWrapRef = useRef31(null);
|
|
13481
13377
|
useGrowingTextField({ inputRef, inputWrapRef, value, maxLines });
|
|
13482
13378
|
const { labelProps, inputProps } = useTextField3(
|
|
13483
13379
|
{
|
|
@@ -13515,7 +13411,7 @@ function TextAreaField(props) {
|
|
|
13515
13411
|
}
|
|
13516
13412
|
|
|
13517
13413
|
// src/inputs/TextField.tsx
|
|
13518
|
-
import { useRef as
|
|
13414
|
+
import { useRef as useRef32 } from "react";
|
|
13519
13415
|
import { mergeProps as mergeProps17, useTextField as useTextField4 } from "react-aria";
|
|
13520
13416
|
import { jsx as jsx75 } from "react/jsx-runtime";
|
|
13521
13417
|
function TextField(props) {
|
|
@@ -13543,7 +13439,7 @@ function TextField(props) {
|
|
|
13543
13439
|
validationState: errorMsg ? "invalid" : "valid",
|
|
13544
13440
|
value
|
|
13545
13441
|
};
|
|
13546
|
-
const inputRef =
|
|
13442
|
+
const inputRef = useRef32(null);
|
|
13547
13443
|
const { labelProps, inputProps } = useTextField4(
|
|
13548
13444
|
{
|
|
13549
13445
|
...textFieldProps,
|
|
@@ -13579,7 +13475,7 @@ function TextField(props) {
|
|
|
13579
13475
|
}
|
|
13580
13476
|
|
|
13581
13477
|
// src/inputs/ToggleButton.tsx
|
|
13582
|
-
import { useRef as
|
|
13478
|
+
import { useRef as useRef33, useState as useState26 } from "react";
|
|
13583
13479
|
import { useFocusRing as useFocusRing8, useHover as useHover14, usePress, useSwitch as useSwitch2, VisuallyHidden as VisuallyHidden6 } from "react-aria";
|
|
13584
13480
|
import { useToggleState as useToggleState3 } from "react-stately";
|
|
13585
13481
|
import { trussProps as trussProps47 } from "@homebound/truss/runtime";
|
|
@@ -13613,8 +13509,8 @@ function ToggleButton(props) {
|
|
|
13613
13509
|
return result;
|
|
13614
13510
|
}
|
|
13615
13511
|
});
|
|
13616
|
-
const labelRef =
|
|
13617
|
-
const ref =
|
|
13512
|
+
const labelRef = useRef33(null);
|
|
13513
|
+
const ref = useRef33(null);
|
|
13618
13514
|
const tid = useTestIds(otherProps, label);
|
|
13619
13515
|
const {
|
|
13620
13516
|
isPressed: isPressedFromEvents,
|
|
@@ -13700,7 +13596,7 @@ var togglePressStyles = {
|
|
|
13700
13596
|
};
|
|
13701
13597
|
|
|
13702
13598
|
// src/inputs/ToggleChipGroup.tsx
|
|
13703
|
-
import { useRef as
|
|
13599
|
+
import { useRef as useRef34 } from "react";
|
|
13704
13600
|
import { useCheckboxGroup as useCheckboxGroup2, useCheckboxGroupItem as useCheckboxGroupItem2, useFocusRing as useFocusRing9, VisuallyHidden as VisuallyHidden7 } from "react-aria";
|
|
13705
13601
|
import { useCheckboxGroupState as useCheckboxGroupState2 } from "react-stately";
|
|
13706
13602
|
import { trussProps as trussProps48 } from "@homebound/truss/runtime";
|
|
@@ -13773,7 +13669,7 @@ function ToggleChip2(props) {
|
|
|
13773
13669
|
} = props;
|
|
13774
13670
|
const isDisabled = !!disabled;
|
|
13775
13671
|
const isReadOnly = !!readonly;
|
|
13776
|
-
const ref =
|
|
13672
|
+
const ref = useRef34(null);
|
|
13777
13673
|
const {
|
|
13778
13674
|
inputProps
|
|
13779
13675
|
} = useCheckboxGroupItem2({
|
|
@@ -14823,9 +14719,9 @@ function maybeApply(maybeFn) {
|
|
|
14823
14719
|
}
|
|
14824
14720
|
|
|
14825
14721
|
// src/components/Table/hooks/useColumnResizeHandlers.ts
|
|
14826
|
-
import { useCallback as useCallback12, useRef as
|
|
14722
|
+
import { useCallback as useCallback12, useRef as useRef35 } from "react";
|
|
14827
14723
|
function useColumnResizeHandlers(columns, columnSizes, tableWidth, setResizedWidth, setResizedWidths) {
|
|
14828
|
-
const hasLockedColumnsRef =
|
|
14724
|
+
const hasLockedColumnsRef = useRef35(false);
|
|
14829
14725
|
const distributeAdjustment = useCallback12(
|
|
14830
14726
|
(rightColumns, totalRightWidth, adjustment) => {
|
|
14831
14727
|
const updates = {};
|
|
@@ -14954,7 +14850,7 @@ function useScrollStorage(tableId, enabled = true) {
|
|
|
14954
14850
|
|
|
14955
14851
|
// src/components/Table/hooks/useSetupColumnSizes.ts
|
|
14956
14852
|
import { useResizeObserver } from "@react-aria/utils";
|
|
14957
|
-
import { useCallback as useCallback14, useEffect as useEffect18, useRef as
|
|
14853
|
+
import { useCallback as useCallback14, useEffect as useEffect18, useRef as useRef36, useState as useState28 } from "react";
|
|
14958
14854
|
|
|
14959
14855
|
// src/components/Table/hooks/useColumnResizing.ts
|
|
14960
14856
|
import { useCallback as useCallback13, useEffect as useEffect17, useState as useState27 } from "react";
|
|
@@ -15013,9 +14909,9 @@ function useSetupColumnSizes(style, columns, resizeRef, expandedColumnIds, visib
|
|
|
15013
14909
|
const { resizedWidths, setResizedWidth, setResizedWidths, resetColumnWidths } = useColumnResizing(
|
|
15014
14910
|
disableColumnResizing ? void 0 : visibleColumnsStorageKey
|
|
15015
14911
|
);
|
|
15016
|
-
const calculateImmediately =
|
|
14912
|
+
const calculateImmediately = useRef36(true);
|
|
15017
14913
|
const [tableWidth, setTableWidth] = useState28();
|
|
15018
|
-
const prevTableWidthRef =
|
|
14914
|
+
const prevTableWidthRef = useRef36(tableWidth);
|
|
15019
14915
|
const [columnSizes, setColumnSizes] = useState28(
|
|
15020
14916
|
calcColumnSizes(columns, tableWidth, style.minWidthPx, expandedColumnIds, resizedWidths)
|
|
15021
14917
|
);
|
|
@@ -15082,9 +14978,9 @@ function useSetupColumnSizes(style, columns, resizeRef, expandedColumnIds, visib
|
|
|
15082
14978
|
}
|
|
15083
14979
|
|
|
15084
14980
|
// src/hooks/useRenderCount.ts
|
|
15085
|
-
import { useCallback as useCallback15, useRef as
|
|
14981
|
+
import { useCallback as useCallback15, useRef as useRef37 } from "react";
|
|
15086
14982
|
function useRenderCount() {
|
|
15087
|
-
const ref =
|
|
14983
|
+
const ref = useRef37(/* @__PURE__ */ new Map());
|
|
15088
14984
|
const getCount = useCallback15((id) => {
|
|
15089
14985
|
const count = ref.current.get(id) || 1;
|
|
15090
14986
|
ref.current.set(id, count + 1);
|
|
@@ -15141,10 +15037,10 @@ function GridTable(props) {
|
|
|
15141
15037
|
disableColumnResizing = false
|
|
15142
15038
|
} = props;
|
|
15143
15039
|
const columnsWithIds = useMemo24(() => assignDefaultColumnIds(_columns), [_columns]);
|
|
15144
|
-
const virtuosoRef =
|
|
15145
|
-
const virtuosoRangeRef =
|
|
15146
|
-
const resizeRef =
|
|
15147
|
-
const tableContainerRef =
|
|
15040
|
+
const virtuosoRef = useRef38(null);
|
|
15041
|
+
const virtuosoRangeRef = useRef38(null);
|
|
15042
|
+
const resizeRef = useRef38(null);
|
|
15043
|
+
const tableContainerRef = useRef38(null);
|
|
15148
15044
|
const api = useMemo24(
|
|
15149
15045
|
() => {
|
|
15150
15046
|
const api2 = props.api ?? new GridTableApiImpl();
|
|
@@ -15159,7 +15055,7 @@ function GridTable(props) {
|
|
|
15159
15055
|
[props.api]
|
|
15160
15056
|
);
|
|
15161
15057
|
const [draggedRow, _setDraggedRow] = useState29(void 0);
|
|
15162
|
-
const draggedRowRef =
|
|
15058
|
+
const draggedRowRef = useRef38(draggedRow);
|
|
15163
15059
|
const setDraggedRow = (row) => {
|
|
15164
15060
|
draggedRowRef.current = row;
|
|
15165
15061
|
_setDraggedRow(row);
|
|
@@ -16005,17 +15901,17 @@ var variantStyles2 = {
|
|
|
16005
15901
|
};
|
|
16006
15902
|
|
|
16007
15903
|
// src/components/BeamContext.tsx
|
|
16008
|
-
import { createContext as createContext7, useContext as useContext17, useMemo as useMemo40, useReducer, useRef as
|
|
15904
|
+
import { createContext as createContext7, useContext as useContext17, useMemo as useMemo40, useReducer, useRef as useRef45 } from "react";
|
|
16009
15905
|
import { OverlayProvider } from "react-aria";
|
|
16010
15906
|
|
|
16011
15907
|
// src/components/Modal/Modal.tsx
|
|
16012
15908
|
import { useResizeObserver as useResizeObserver3 } from "@react-aria/utils";
|
|
16013
|
-
import { useCallback as useCallback17, useEffect as useEffect23, useRef as
|
|
15909
|
+
import { useCallback as useCallback17, useEffect as useEffect23, useRef as useRef40, useState as useState32 } from "react";
|
|
16014
15910
|
import { FocusScope as FocusScope4, OverlayContainer as OverlayContainer2, useDialog, useModal as useModal2, useOverlay as useOverlay2, usePreventScroll } from "react-aria";
|
|
16015
15911
|
import { createPortal as createPortal3 } from "react-dom";
|
|
16016
15912
|
|
|
16017
15913
|
// src/components/Modal/useModal.tsx
|
|
16018
|
-
import { useEffect as useEffect22, useMemo as useMemo27, useRef as
|
|
15914
|
+
import { useEffect as useEffect22, useMemo as useMemo27, useRef as useRef39 } from "react";
|
|
16019
15915
|
|
|
16020
15916
|
// src/components/Modal/ModalContext.tsx
|
|
16021
15917
|
import { createContext as createContext4, useContext as useContext13, useMemo as useMemo26 } from "react";
|
|
@@ -16033,8 +15929,8 @@ function useModalContext() {
|
|
|
16033
15929
|
function useModal() {
|
|
16034
15930
|
const { modalState, modalCanCloseChecks } = useBeamContext();
|
|
16035
15931
|
const { inModal } = useModalContext();
|
|
16036
|
-
const lastCanClose =
|
|
16037
|
-
const api =
|
|
15932
|
+
const lastCanClose = useRef39();
|
|
15933
|
+
const api = useRef39();
|
|
16038
15934
|
useEffect22(() => {
|
|
16039
15935
|
return () => {
|
|
16040
15936
|
modalCanCloseChecks.current = modalCanCloseChecks.current.filter((c) => c !== lastCanClose.current);
|
|
@@ -16087,7 +15983,7 @@ function Modal(props) {
|
|
|
16087
15983
|
allowClosing = true
|
|
16088
15984
|
} = props;
|
|
16089
15985
|
const isFixedHeight = typeof size !== "string";
|
|
16090
|
-
const ref =
|
|
15986
|
+
const ref = useRef40(null);
|
|
16091
15987
|
const {
|
|
16092
15988
|
modalBodyDiv,
|
|
16093
15989
|
modalFooterDiv,
|
|
@@ -16118,9 +16014,9 @@ function Modal(props) {
|
|
|
16118
16014
|
role: "dialog"
|
|
16119
16015
|
}, ref);
|
|
16120
16016
|
const [[width2, height], setSize] = useState32(getSize(size));
|
|
16121
|
-
const modalBodyRef =
|
|
16122
|
-
const modalFooterRef =
|
|
16123
|
-
const modalHeaderRef =
|
|
16017
|
+
const modalBodyRef = useRef40(null);
|
|
16018
|
+
const modalFooterRef = useRef40(null);
|
|
16019
|
+
const modalHeaderRef = useRef40(null);
|
|
16124
16020
|
const testId = useTestIds({}, testIdPrefix);
|
|
16125
16021
|
usePreventScroll();
|
|
16126
16022
|
const {
|
|
@@ -16416,7 +16312,7 @@ function useSnackbarContext() {
|
|
|
16416
16312
|
|
|
16417
16313
|
// src/components/SuperDrawer/SuperDrawer.tsx
|
|
16418
16314
|
import { AnimatePresence, motion } from "framer-motion";
|
|
16419
|
-
import { useEffect as useEffect24, useRef as
|
|
16315
|
+
import { useEffect as useEffect24, useRef as useRef41 } from "react";
|
|
16420
16316
|
import { createPortal as createPortal4 } from "react-dom";
|
|
16421
16317
|
|
|
16422
16318
|
// src/components/SuperDrawer/utils.ts
|
|
@@ -16438,7 +16334,7 @@ function SuperDrawer() {
|
|
|
16438
16334
|
const {
|
|
16439
16335
|
closeDrawer
|
|
16440
16336
|
} = useSuperDrawer();
|
|
16441
|
-
const headerRef =
|
|
16337
|
+
const headerRef = useRef41(null);
|
|
16442
16338
|
const testId = useTestIds({}, "superDrawer");
|
|
16443
16339
|
const currentContent = contentStack.current[contentStack.current.length - 1]?.opts;
|
|
16444
16340
|
const {
|
|
@@ -16533,7 +16429,7 @@ function SuperDrawer() {
|
|
|
16533
16429
|
}
|
|
16534
16430
|
|
|
16535
16431
|
// src/components/Layout/FormPageLayout.tsx
|
|
16536
|
-
import React16, { createRef, useCallback as useCallback21, useEffect as useEffect25, useMemo as useMemo33, useRef as
|
|
16432
|
+
import React16, { createRef, useCallback as useCallback21, useEffect as useEffect25, useMemo as useMemo33, useRef as useRef42, useState as useState39 } from "react";
|
|
16537
16433
|
import { useButton as useButton9, useFocusRing as useFocusRing11 } from "react-aria";
|
|
16538
16434
|
|
|
16539
16435
|
// src/forms/BoundCheckboxField.tsx
|
|
@@ -18201,7 +18097,7 @@ function SectionNavLink(props) {
|
|
|
18201
18097
|
});
|
|
18202
18098
|
}, [sectionRef]);
|
|
18203
18099
|
const tids = useTestIds(props);
|
|
18204
|
-
const buttonRef =
|
|
18100
|
+
const buttonRef = useRef42(null);
|
|
18205
18101
|
const {
|
|
18206
18102
|
buttonProps,
|
|
18207
18103
|
isPressed
|
|
@@ -18351,7 +18247,7 @@ function invertSpacing(value) {
|
|
|
18351
18247
|
import React17, { useEffect as useEffect27, useMemo as useMemo38, useState as useState42 } from "react";
|
|
18352
18248
|
|
|
18353
18249
|
// src/components/ButtonMenu.tsx
|
|
18354
|
-
import { useRef as
|
|
18250
|
+
import { useRef as useRef43 } from "react";
|
|
18355
18251
|
import { useMenuTrigger as useMenuTrigger2 } from "react-aria";
|
|
18356
18252
|
import { useMenuTriggerState as useMenuTriggerState2 } from "react-stately";
|
|
18357
18253
|
import { jsx as jsx125 } from "react/jsx-runtime";
|
|
@@ -18363,7 +18259,7 @@ function ButtonMenu(props) {
|
|
|
18363
18259
|
onChange = props.onChange;
|
|
18364
18260
|
}
|
|
18365
18261
|
const state = useMenuTriggerState2({ isOpen: defaultOpen });
|
|
18366
|
-
const buttonRef =
|
|
18262
|
+
const buttonRef = useRef43(null);
|
|
18367
18263
|
const { menuTriggerProps, menuProps } = useMenuTrigger2({ isDisabled: !!disabled }, state, buttonRef);
|
|
18368
18264
|
const tid = useTestIds(
|
|
18369
18265
|
props,
|
|
@@ -18470,14 +18366,6 @@ function dateFilter(props) {
|
|
|
18470
18366
|
}
|
|
18471
18367
|
var anyOption = {};
|
|
18472
18368
|
var DateFilter = class extends BaseFilter {
|
|
18473
|
-
hydrate(value) {
|
|
18474
|
-
if (!isDateFilterValue(value)) return void 0;
|
|
18475
|
-
const hydratedValue = parsePersistedPlainDate(value.value);
|
|
18476
|
-
return hydratedValue ? { op: value.op, value: hydratedValue } : void 0;
|
|
18477
|
-
}
|
|
18478
|
-
dehydrate(value) {
|
|
18479
|
-
return value ? { op: value.op, value: dehydratePlainDate(value.value) } : void 0;
|
|
18480
|
-
}
|
|
18481
18369
|
render(value, setValue, tid, inModal, vertical) {
|
|
18482
18370
|
const { label, operations, getOperationValue, getOperationLabel } = this.props;
|
|
18483
18371
|
return /* @__PURE__ */ jsxs65(Fragment28, { children: [
|
|
@@ -18497,7 +18385,7 @@ var DateFilter = class extends BaseFilter {
|
|
|
18497
18385
|
value: value?.op,
|
|
18498
18386
|
onSelect: (op) => (
|
|
18499
18387
|
// default the selected date to today if it doesn't exist in the filter's value
|
|
18500
|
-
setValue(op ? { op, value: value?.value
|
|
18388
|
+
setValue(op ? { op, value: value?.value ? new Date(value.value) : /* @__PURE__ */ new Date() } : void 0)
|
|
18501
18389
|
),
|
|
18502
18390
|
label: inModal ? `${label} date filter operation` : label,
|
|
18503
18391
|
labelStyle: !inModal && !vertical ? "inline" : inModal || vertical ? "hidden" : "above",
|
|
@@ -18509,13 +18397,9 @@ var DateFilter = class extends BaseFilter {
|
|
|
18509
18397
|
DateField,
|
|
18510
18398
|
{
|
|
18511
18399
|
labelStyle: "inline",
|
|
18512
|
-
value: value?.value
|
|
18400
|
+
value: value?.value ? new Date(value.value) : /* @__PURE__ */ new Date(),
|
|
18513
18401
|
label: "Date",
|
|
18514
|
-
onChange: (d) => {
|
|
18515
|
-
if (d && value) {
|
|
18516
|
-
setValue({ ...value, value: d });
|
|
18517
|
-
}
|
|
18518
|
-
},
|
|
18402
|
+
onChange: (d) => setValue({ ...value, value: d }),
|
|
18519
18403
|
disabled: !value,
|
|
18520
18404
|
...tid[`${defaultTestId(this.label)}_dateField`]
|
|
18521
18405
|
}
|
|
@@ -18524,9 +18408,6 @@ var DateFilter = class extends BaseFilter {
|
|
|
18524
18408
|
] });
|
|
18525
18409
|
}
|
|
18526
18410
|
};
|
|
18527
|
-
function isDateFilterValue(value) {
|
|
18528
|
-
return typeof value === "object" && value !== null && "op" in value && "value" in value;
|
|
18529
|
-
}
|
|
18530
18411
|
|
|
18531
18412
|
// src/components/Filters/DateRangeFilter.tsx
|
|
18532
18413
|
import { Fragment as Fragment29, jsx as jsx128, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
@@ -18534,17 +18415,6 @@ function dateRangeFilter(props) {
|
|
|
18534
18415
|
return (key) => new DateRangeFilter(key, props);
|
|
18535
18416
|
}
|
|
18536
18417
|
var DateRangeFilter = class extends BaseFilter {
|
|
18537
|
-
hydrate(value) {
|
|
18538
|
-
if (!isDateRangeFilterValue(value)) return void 0;
|
|
18539
|
-
const hydratedValue = hydrateDateRange(value.value);
|
|
18540
|
-
return hydratedValue ? { op: value.op, value: hydratedValue } : void 0;
|
|
18541
|
-
}
|
|
18542
|
-
dehydrate(value) {
|
|
18543
|
-
return value ? {
|
|
18544
|
-
op: value.op,
|
|
18545
|
-
value: value.value ? { from: dehydratePlainDate(value.value.from), to: dehydratePlainDate(value.value.to) } : void 0
|
|
18546
|
-
} : void 0;
|
|
18547
|
-
}
|
|
18548
18418
|
render(value, setValue, tid, inModal, vertical) {
|
|
18549
18419
|
const { label, placeholderText, disabledDays, testFieldLabel, defaultValue } = this.props;
|
|
18550
18420
|
return /* @__PURE__ */ jsxs66(Fragment29, { children: [
|
|
@@ -18556,17 +18426,8 @@ var DateRangeFilter = class extends BaseFilter {
|
|
|
18556
18426
|
isRangeFilterField: true,
|
|
18557
18427
|
placeholder: placeholderText,
|
|
18558
18428
|
label: testFieldLabel ?? "Date",
|
|
18559
|
-
value: value?.value,
|
|
18560
|
-
onChange: (d) => {
|
|
18561
|
-
if (!d) {
|
|
18562
|
-
setValue(void 0);
|
|
18563
|
-
return;
|
|
18564
|
-
}
|
|
18565
|
-
const op = value?.op ?? defaultValue?.op;
|
|
18566
|
-
if (op !== void 0) {
|
|
18567
|
-
setValue({ op, value: d });
|
|
18568
|
-
}
|
|
18569
|
-
},
|
|
18429
|
+
value: value?.value ? { from: new Date(value.value.from), to: new Date(value.value.to) } : void 0,
|
|
18430
|
+
onChange: (d) => d ? setValue({ op: defaultValue?.op, value: d }) : setValue(void 0),
|
|
18570
18431
|
disabledDays,
|
|
18571
18432
|
...tid[`${defaultTestId(this.label)}_dateField`]
|
|
18572
18433
|
}
|
|
@@ -18574,17 +18435,6 @@ var DateRangeFilter = class extends BaseFilter {
|
|
|
18574
18435
|
] });
|
|
18575
18436
|
}
|
|
18576
18437
|
};
|
|
18577
|
-
function isDateRangeFilterValue(value) {
|
|
18578
|
-
return typeof value === "object" && value !== null && "op" in value && "value" in value;
|
|
18579
|
-
}
|
|
18580
|
-
function hydrateDateRange(value) {
|
|
18581
|
-
if (typeof value !== "object" || value === null) return void 0;
|
|
18582
|
-
const { from, to } = value;
|
|
18583
|
-
const hydratedFrom = parsePersistedPlainDate(from);
|
|
18584
|
-
const hydratedTo = parsePersistedPlainDate(to);
|
|
18585
|
-
if (hydratedFrom === void 0 && hydratedTo === void 0) return void 0;
|
|
18586
|
-
return { from: hydratedFrom, to: hydratedTo };
|
|
18587
|
-
}
|
|
18588
18438
|
|
|
18589
18439
|
// src/components/Filters/MultiFilter.tsx
|
|
18590
18440
|
import { jsx as jsx129 } from "react/jsx-runtime";
|
|
@@ -19146,7 +18996,7 @@ function toPageNumberSize(page) {
|
|
|
19146
18996
|
}
|
|
19147
18997
|
|
|
19148
18998
|
// src/components/Table/components/EditColumnsButton.tsx
|
|
19149
|
-
import { Fragment as Fragment33, useCallback as useCallback22, useMemo as useMemo36, useRef as
|
|
18999
|
+
import { Fragment as Fragment33, useCallback as useCallback22, useMemo as useMemo36, useRef as useRef44 } from "react";
|
|
19150
19000
|
import { useMenuTrigger as useMenuTrigger3 } from "react-aria";
|
|
19151
19001
|
import { useMenuTriggerState as useMenuTriggerState3 } from "react-stately";
|
|
19152
19002
|
import { jsx as jsx141, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
@@ -19161,7 +19011,7 @@ function EditColumnsButton(props) {
|
|
|
19161
19011
|
const state = useMenuTriggerState3({
|
|
19162
19012
|
isOpen: defaultOpen
|
|
19163
19013
|
});
|
|
19164
|
-
const buttonRef =
|
|
19014
|
+
const buttonRef = useRef44(null);
|
|
19165
19015
|
const {
|
|
19166
19016
|
menuTriggerProps
|
|
19167
19017
|
} = useMenuTrigger3({
|
|
@@ -19390,10 +19240,10 @@ function useGridTableLayoutState({
|
|
|
19390
19240
|
});
|
|
19391
19241
|
useEffect27(() => {
|
|
19392
19242
|
if (page.limit !== persistedPageSize) setPersistedPageSize(page.limit);
|
|
19393
|
-
setPage((prev) =>
|
|
19243
|
+
setPage((prev) => ({
|
|
19394
19244
|
...prev,
|
|
19395
19245
|
offset: 0
|
|
19396
|
-
});
|
|
19246
|
+
}));
|
|
19397
19247
|
}, [page.limit, persistedPageSize, setPersistedPageSize, filter, searchString]);
|
|
19398
19248
|
return {
|
|
19399
19249
|
filter,
|
|
@@ -19654,18 +19504,18 @@ var BeamContext = createContext7({
|
|
|
19654
19504
|
});
|
|
19655
19505
|
function BeamProvider({ children, ...presentationProps }) {
|
|
19656
19506
|
const [, tick] = useReducer((prev) => prev + 1, 0);
|
|
19657
|
-
const modalRef =
|
|
19507
|
+
const modalRef = useRef45();
|
|
19658
19508
|
const modalHeaderDiv = useMemo40(() => document.createElement("div"), []);
|
|
19659
19509
|
const modalBodyDiv = useMemo40(() => {
|
|
19660
19510
|
const el = document.createElement("div");
|
|
19661
19511
|
el.style.height = "100%";
|
|
19662
19512
|
return el;
|
|
19663
19513
|
}, []);
|
|
19664
|
-
const modalCanCloseChecksRef =
|
|
19514
|
+
const modalCanCloseChecksRef = useRef45([]);
|
|
19665
19515
|
const modalFooterDiv = useMemo40(() => document.createElement("div"), []);
|
|
19666
|
-
const drawerContentStackRef =
|
|
19667
|
-
const drawerCanCloseChecks =
|
|
19668
|
-
const drawerCanCloseDetailsChecks =
|
|
19516
|
+
const drawerContentStackRef = useRef45([]);
|
|
19517
|
+
const drawerCanCloseChecks = useRef45([]);
|
|
19518
|
+
const drawerCanCloseDetailsChecks = useRef45([]);
|
|
19669
19519
|
const sdHeaderDiv = useMemo40(() => document.createElement("div"), []);
|
|
19670
19520
|
const context = useMemo40(() => {
|
|
19671
19521
|
return {
|
|
@@ -19708,14 +19558,14 @@ function useBeamContext() {
|
|
|
19708
19558
|
}
|
|
19709
19559
|
|
|
19710
19560
|
// src/components/ButtonDatePicker.tsx
|
|
19711
|
-
import { useRef as
|
|
19561
|
+
import { useRef as useRef46 } from "react";
|
|
19712
19562
|
import { useMenuTrigger as useMenuTrigger4 } from "react-aria";
|
|
19713
19563
|
import { useMenuTriggerState as useMenuTriggerState4 } from "react-stately";
|
|
19714
19564
|
import { jsx as jsx150 } from "react/jsx-runtime";
|
|
19715
19565
|
function ButtonDatePicker(props) {
|
|
19716
19566
|
const { defaultOpen, disabled, trigger, onSelect, ...datePickerProps } = props;
|
|
19717
19567
|
const state = useMenuTriggerState4({ isOpen: defaultOpen });
|
|
19718
|
-
const buttonRef =
|
|
19568
|
+
const buttonRef = useRef46(null);
|
|
19719
19569
|
const {
|
|
19720
19570
|
menuTriggerProps,
|
|
19721
19571
|
menuProps: { autoFocus: _af, ...menuProps }
|
|
@@ -19738,7 +19588,7 @@ function ButtonDatePicker(props) {
|
|
|
19738
19588
|
}
|
|
19739
19589
|
|
|
19740
19590
|
// src/components/ButtonGroup.tsx
|
|
19741
|
-
import { useRef as
|
|
19591
|
+
import { useRef as useRef47 } from "react";
|
|
19742
19592
|
import { useButton as useButton10, useFocusRing as useFocusRing12, useHover as useHover15 } from "react-aria";
|
|
19743
19593
|
import { trussProps as trussProps73 } from "@homebound/truss/runtime";
|
|
19744
19594
|
import { jsx as jsx151, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
@@ -19786,7 +19636,7 @@ function GroupButton(props) {
|
|
|
19786
19636
|
isDisabled: !!disabled,
|
|
19787
19637
|
...otherProps
|
|
19788
19638
|
};
|
|
19789
|
-
const ref =
|
|
19639
|
+
const ref = useRef47(null);
|
|
19790
19640
|
const {
|
|
19791
19641
|
buttonProps,
|
|
19792
19642
|
isPressed
|
|
@@ -19909,7 +19759,7 @@ import { useHover as useHover16 } from "react-aria";
|
|
|
19909
19759
|
|
|
19910
19760
|
// src/components/Tag.tsx
|
|
19911
19761
|
import { useResizeObserver as useResizeObserver4 } from "@react-aria/utils";
|
|
19912
|
-
import { useRef as
|
|
19762
|
+
import { useRef as useRef48, useState as useState44 } from "react";
|
|
19913
19763
|
import { trussProps as trussProps74 } from "@homebound/truss/runtime";
|
|
19914
19764
|
import { jsx as jsx152, jsxs as jsxs79 } from "react/jsx-runtime";
|
|
19915
19765
|
function Tag(props) {
|
|
@@ -19923,7 +19773,7 @@ function Tag(props) {
|
|
|
19923
19773
|
const typeStyles2 = getStyles(type);
|
|
19924
19774
|
const tid = useTestIds(otherProps);
|
|
19925
19775
|
const [showTooltip, setShowTooltip] = useState44(false);
|
|
19926
|
-
const ref =
|
|
19776
|
+
const ref = useRef48(null);
|
|
19927
19777
|
useResizeObserver4({
|
|
19928
19778
|
ref,
|
|
19929
19779
|
onResize: () => {
|
|
@@ -20132,7 +19982,7 @@ function Copy(props) {
|
|
|
20132
19982
|
|
|
20133
19983
|
// src/components/DnDGrid/DnDGrid.tsx
|
|
20134
19984
|
import equal2 from "fast-deep-equal";
|
|
20135
|
-
import { useCallback as useCallback24, useRef as
|
|
19985
|
+
import { useCallback as useCallback24, useRef as useRef49 } from "react";
|
|
20136
19986
|
|
|
20137
19987
|
// src/components/DnDGrid/DnDGridContext.tsx
|
|
20138
19988
|
import { createContext as createContext8, useContext as useContext18 } from "react";
|
|
@@ -20155,12 +20005,12 @@ function DnDGrid(props) {
|
|
|
20155
20005
|
onReorder,
|
|
20156
20006
|
activeItemStyles
|
|
20157
20007
|
} = props;
|
|
20158
|
-
const gridEl =
|
|
20159
|
-
const dragEl =
|
|
20160
|
-
const cloneEl =
|
|
20161
|
-
const initialOrder =
|
|
20162
|
-
const reorderViaKeyboard =
|
|
20163
|
-
const transformFrom =
|
|
20008
|
+
const gridEl = useRef49(null);
|
|
20009
|
+
const dragEl = useRef49();
|
|
20010
|
+
const cloneEl = useRef49();
|
|
20011
|
+
const initialOrder = useRef49();
|
|
20012
|
+
const reorderViaKeyboard = useRef49(false);
|
|
20013
|
+
const transformFrom = useRef49({
|
|
20164
20014
|
x: 0,
|
|
20165
20015
|
y: 0
|
|
20166
20016
|
});
|
|
@@ -20622,14 +20472,14 @@ function HbSpinnerProvider({
|
|
|
20622
20472
|
|
|
20623
20473
|
// src/components/MaxLines.tsx
|
|
20624
20474
|
import { useLayoutEffect as useLayoutEffect2, useResizeObserver as useResizeObserver5 } from "@react-aria/utils";
|
|
20625
|
-
import { useCallback as useCallback25, useEffect as useEffect30, useRef as
|
|
20475
|
+
import { useCallback as useCallback25, useEffect as useEffect30, useRef as useRef50, useState as useState45 } from "react";
|
|
20626
20476
|
import { trussProps as trussProps80 } from "@homebound/truss/runtime";
|
|
20627
20477
|
import { jsx as jsx160, jsxs as jsxs82 } from "react/jsx-runtime";
|
|
20628
20478
|
function MaxLines({
|
|
20629
20479
|
maxLines,
|
|
20630
20480
|
children
|
|
20631
20481
|
}) {
|
|
20632
|
-
const elRef =
|
|
20482
|
+
const elRef = useRef50(null);
|
|
20633
20483
|
const [hasMore, setHasMore] = useState45(false);
|
|
20634
20484
|
const [expanded, setExpanded] = useState45(false);
|
|
20635
20485
|
useLayoutEffect2(() => {
|
|
@@ -20665,7 +20515,7 @@ function MaxLines({
|
|
|
20665
20515
|
|
|
20666
20516
|
// src/components/ScrollShadows.tsx
|
|
20667
20517
|
import { useResizeObserver as useResizeObserver6 } from "@react-aria/utils";
|
|
20668
|
-
import { useCallback as useCallback26, useMemo as useMemo47, useRef as
|
|
20518
|
+
import { useCallback as useCallback26, useMemo as useMemo47, useRef as useRef51, useState as useState46 } from "react";
|
|
20669
20519
|
import { trussProps as trussProps81 } from "@homebound/truss/runtime";
|
|
20670
20520
|
import { jsx as jsx161, jsxs as jsxs83 } from "react/jsx-runtime";
|
|
20671
20521
|
function ScrollShadows(props) {
|
|
@@ -20685,7 +20535,7 @@ function ScrollShadows(props) {
|
|
|
20685
20535
|
}
|
|
20686
20536
|
const [showStartShadow, setShowStartShadow] = useState46(false);
|
|
20687
20537
|
const [showEndShadow, setShowEndShadow] = useState46(false);
|
|
20688
|
-
const scrollRef =
|
|
20538
|
+
const scrollRef = useRef51(null);
|
|
20689
20539
|
const [startShadowStyles, endShadowStyles] = useMemo47(() => {
|
|
20690
20540
|
const transparentBgColor = bgColor.replace(/,1\)$/, ",0)");
|
|
20691
20541
|
const commonStyles = {
|
|
@@ -20858,7 +20708,7 @@ function useSnackbar() {
|
|
|
20858
20708
|
var snackbarId = 1;
|
|
20859
20709
|
|
|
20860
20710
|
// src/components/Stepper.tsx
|
|
20861
|
-
import { useRef as
|
|
20711
|
+
import { useRef as useRef52 } from "react";
|
|
20862
20712
|
import { useButton as useButton11, useFocusRing as useFocusRing14, useHover as useHover18 } from "react-aria";
|
|
20863
20713
|
import { trussProps as trussProps82 } from "@homebound/truss/runtime";
|
|
20864
20714
|
import { jsx as jsx162, jsxs as jsxs84 } from "react/jsx-runtime";
|
|
@@ -20936,7 +20786,7 @@ function StepButton(props) {
|
|
|
20936
20786
|
onPress: onClick,
|
|
20937
20787
|
isDisabled: disabled
|
|
20938
20788
|
};
|
|
20939
|
-
const ref =
|
|
20789
|
+
const ref = useRef52(null);
|
|
20940
20790
|
const {
|
|
20941
20791
|
buttonProps,
|
|
20942
20792
|
isPressed
|
|
@@ -21330,7 +21180,7 @@ function visit(rows, fn) {
|
|
|
21330
21180
|
|
|
21331
21181
|
// src/components/Tabs.tsx
|
|
21332
21182
|
import { camelCase as camelCase5 } from "change-case";
|
|
21333
|
-
import { useEffect as useEffect32, useMemo as useMemo49, useRef as
|
|
21183
|
+
import { useEffect as useEffect32, useMemo as useMemo49, useRef as useRef53, useState as useState47 } from "react";
|
|
21334
21184
|
import { mergeProps as mergeProps26, useFocusRing as useFocusRing15, useHover as useHover19 } from "react-aria";
|
|
21335
21185
|
import { matchPath, Route } from "react-router";
|
|
21336
21186
|
import { Link as Link5, useLocation } from "react-router-dom";
|
|
@@ -21389,7 +21239,7 @@ function Tabs(props) {
|
|
|
21389
21239
|
} = useFocusRing15();
|
|
21390
21240
|
const tid = useTestIds(others, "tabs");
|
|
21391
21241
|
const [active, setActive] = useState47(selected);
|
|
21392
|
-
const ref =
|
|
21242
|
+
const ref = useRef53(null);
|
|
21393
21243
|
useEffect32(() => setActive(selected), [selected]);
|
|
21394
21244
|
function onKeyUp(e) {
|
|
21395
21245
|
if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
|