@homebound/beam 3.2.0-alpha.2 → 3.2.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 CHANGED
@@ -219,7 +219,6 @@ __export(index_exports, {
219
219
  filterTestIdPrefix: () => filterTestIdPrefix,
220
220
  formatDate: () => formatDate,
221
221
  formatDateRange: () => formatDateRange,
222
- formatPlainDate: () => formatPlainDate,
223
222
  formatValue: () => formatValue,
224
223
  generateColumnId: () => generateColumnId,
225
224
  getAlignment: () => getAlignment,
@@ -5891,47 +5890,24 @@ function useHover2(props) {
5891
5890
  var import_react16 = require("react");
5892
5891
  var import_use_query_params2 = require("use-query-params");
5893
5892
  function usePersistedFilter({ storageKey, filterDefs }) {
5894
- const filterImpls = (0, import_react16.useMemo)(
5895
- () => Object.fromEntries(safeEntries(filterDefs).map(([key, def]) => [key, def(key)])),
5896
- [filterDefs]
5897
- );
5898
- const filterKeys = (0, import_react16.useMemo)(() => Object.keys(filterImpls), [filterImpls]);
5893
+ const filterKeys = Object.keys(filterDefs);
5899
5894
  const defaultFilter = (0, import_react16.useMemo)(
5900
5895
  () => Object.fromEntries(
5901
- safeEntries(filterImpls).filter(([, def]) => def.defaultValue !== void 0).map(([key, def]) => [key, def.defaultValue])
5896
+ safeEntries(filterDefs).filter(([key, def]) => def(key).defaultValue !== void 0).map(([key, def]) => [key, def(key).defaultValue])
5902
5897
  ),
5903
- [filterImpls]
5898
+ [filterDefs]
5904
5899
  );
5905
5900
  const [{ filter: queryParamsFilter }, setQueryParams] = (0, import_use_query_params2.useQueryParams)({ filter: import_use_query_params2.JsonParam });
5906
- const [storedFilter, setStoredFilter] = useSessionStorage(
5907
- storageKey,
5908
- dehydrateFilter(filterImpls, defaultFilter) ?? defaultFilter
5909
- );
5901
+ const [storedFilter, setStoredFilter] = useSessionStorage(storageKey, queryParamsFilter ?? defaultFilter);
5910
5902
  const isQueryParamFilterValid = hasValidFilterKeys(queryParamsFilter, filterKeys);
5911
- const serializedQueryParamsFilter = (0, import_react16.useMemo)(() => JSON.stringify(queryParamsFilter), [queryParamsFilter]);
5912
- const serializedStoredFilter = (0, import_react16.useMemo)(() => JSON.stringify(storedFilter), [storedFilter]);
5913
- const queryParamsFilterSnapshot = (0, import_react16.useMemo)(
5914
- () => parseSerializedValue(serializedQueryParamsFilter),
5915
- [serializedQueryParamsFilter]
5916
- );
5917
- const storedFilterSnapshot = (0, import_react16.useMemo)(() => parseSerializedValue(serializedStoredFilter), [serializedStoredFilter]);
5918
- const hydratedQueryParamsFilter = (0, import_react16.useMemo)(
5919
- () => isQueryParamFilterValid ? hydrateFilter(filterImpls, queryParamsFilterSnapshot) : void 0,
5920
- [filterImpls, isQueryParamFilterValid, queryParamsFilterSnapshot]
5921
- );
5922
- const hydratedStoredFilter = (0, import_react16.useMemo)(
5923
- () => hasValidFilterKeys(storedFilterSnapshot, filterKeys) ? hydrateFilter(filterImpls, storedFilterSnapshot) : void 0,
5924
- [filterImpls, filterKeys, storedFilterSnapshot]
5925
- );
5926
- const rawFilter = hydratedQueryParamsFilter ?? hydratedStoredFilter ?? defaultFilter;
5927
- const filter = useStableValue(rawFilter);
5928
- const setFilter = (filter2) => setQueryParams({ filter: dehydrateFilter(filterImpls, filter2) });
5903
+ const filter = isQueryParamFilterValid ? queryParamsFilter : storedFilter ?? defaultFilter;
5904
+ const setFilter = (filter2) => setQueryParams({ filter: filter2 });
5929
5905
  (0, import_react16.useEffect)(
5930
5906
  () => {
5931
5907
  if (queryParamsFilter === void 0) {
5932
5908
  setQueryParams({ filter: storedFilter }, "replaceIn");
5933
5909
  } else if (!isQueryParamFilterValid) {
5934
- setQueryParams({ filter: dehydrateFilter(filterImpls, defaultFilter) }, "replaceIn");
5910
+ setQueryParams({ filter: defaultFilter }, "replaceIn");
5935
5911
  } else if (JSON.stringify(queryParamsFilter) !== JSON.stringify(storedFilter)) {
5936
5912
  setStoredFilter(queryParamsFilter);
5937
5913
  }
@@ -5943,46 +5919,7 @@ function usePersistedFilter({ storageKey, filterDefs }) {
5943
5919
  return { setFilter, filter };
5944
5920
  }
5945
5921
  function hasValidFilterKeys(queryParamsFilter, definedKeys) {
5946
- return !!queryParamsFilter && safeKeys(queryParamsFilter).every((key) => definedKeys.includes(key));
5947
- }
5948
- function hydrateFilter(filterImpls, value) {
5949
- if (typeof value !== "object" || value === null) return void 0;
5950
- const hydratedEntries = [];
5951
- safeEntries(value).forEach(([key, rawValue]) => {
5952
- const filter = filterImpls[key];
5953
- if (!filter) return;
5954
- const hydratedValue = filter.hydrate ? filter.hydrate(rawValue) : rawValue;
5955
- if (hydratedValue !== void 0) {
5956
- hydratedEntries.push([key, hydratedValue]);
5957
- }
5958
- });
5959
- return Object.fromEntries(hydratedEntries);
5960
- }
5961
- function dehydrateFilter(filterImpls, value) {
5962
- if (!value) return value;
5963
- return Object.fromEntries(
5964
- safeEntries(value).map(([key, rawValue]) => {
5965
- const filter = filterImpls[key];
5966
- return [
5967
- key,
5968
- // Let each filter own serialization so persisted state stays stable for non-plain JSON values like PlainDate.
5969
- filter?.dehydrate ? filter.dehydrate(rawValue) : rawValue
5970
- ];
5971
- })
5972
- );
5973
- }
5974
- function parseSerializedValue(value) {
5975
- return value === void 0 ? void 0 : JSON.parse(value);
5976
- }
5977
- function useStableValue(value) {
5978
- const stableValue = (0, import_react16.useRef)(value);
5979
- const stableKey = (0, import_react16.useRef)(JSON.stringify(value));
5980
- const nextKey = JSON.stringify(value);
5981
- if (stableKey.current !== nextKey) {
5982
- stableValue.current = value;
5983
- stableKey.current = nextKey;
5984
- }
5985
- return stableValue.current;
5922
+ return queryParamsFilter && safeKeys(queryParamsFilter).every((key) => definedKeys.includes(key));
5986
5923
  }
5987
5924
 
5988
5925
  // src/hooks/useSessionStorage.ts
@@ -6412,107 +6349,6 @@ var import_react_stately7 = require("react-stately");
6412
6349
  // src/components/internal/DatePicker/DatePicker.tsx
6413
6350
  var import_react_day_picker3 = require("react-day-picker");
6414
6351
 
6415
- // src/utils/plainDate.ts
6416
- var import_temporal_polyfill = require("temporal-polyfill");
6417
- function jsDateToPlainDate(date) {
6418
- return new import_temporal_polyfill.Temporal.PlainDate(date.getFullYear(), date.getMonth() + 1, date.getDate());
6419
- }
6420
- function formatPlainDate(date, format) {
6421
- switch (format) {
6422
- case "shortDate":
6423
- return date.toLocaleString("en-US", { month: "2-digit", day: "2-digit", year: "2-digit" });
6424
- case "date":
6425
- return date.toLocaleString("en-US", { month: "2-digit", day: "2-digit", year: "numeric" });
6426
- case "shortWeekdayMonthDay":
6427
- return date.toLocaleString("en-US", { weekday: "short", month: "short", day: "numeric" });
6428
- case "longWeekdayMonthDayYear":
6429
- return `${date.toLocaleString("en-US", { weekday: "long" })} ${date.toLocaleString("en-US", { month: "long" })} ${date.day}, ${formatYear(date.year)}`;
6430
- case "monthYear":
6431
- return date.toLocaleString("en-US", { month: "long", year: "numeric" });
6432
- case "shortMonth":
6433
- return date.toLocaleString("en-US", { month: "short" });
6434
- case "year":
6435
- return formatYear(date.year);
6436
- case "weekdayInitial":
6437
- return date.toLocaleString("en-US", { weekday: "narrow" });
6438
- case "weekday":
6439
- return date.toLocaleString("en-US", { weekday: "long" });
6440
- default:
6441
- throw new Error(`Unsupported date format: ${format}`);
6442
- }
6443
- }
6444
- function todayPlainDate() {
6445
- return import_temporal_polyfill.Temporal.Now.plainDateISO();
6446
- }
6447
- function isPlainDate(value) {
6448
- return value instanceof import_temporal_polyfill.Temporal.PlainDate;
6449
- }
6450
- function parsePersistedPlainDate(value) {
6451
- if (isPlainDate(value)) return value;
6452
- if (value instanceof Date && !Number.isNaN(value.getTime())) {
6453
- return jsDateToPlainDate(value);
6454
- }
6455
- if (typeof value !== "string") return void 0;
6456
- try {
6457
- if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
6458
- return import_temporal_polyfill.Temporal.PlainDate.from(value);
6459
- }
6460
- } catch {
6461
- return void 0;
6462
- }
6463
- const date = new Date(value);
6464
- return Number.isNaN(date.getTime()) ? void 0 : jsDateToPlainDate(date);
6465
- }
6466
- function dehydratePlainDate(value) {
6467
- return value?.toString();
6468
- }
6469
- function padNumber(value, length) {
6470
- return Math.abs(value).toString().padStart(length, "0");
6471
- }
6472
- function formatYear(year) {
6473
- return `${year < 0 ? "-" : ""}${padNumber(year, 4)}`;
6474
- }
6475
-
6476
- // src/components/internal/DatePicker/dates.ts
6477
- function plainDateToJsDate(date) {
6478
- return new Date(date.year, date.month - 1, date.day, 12);
6479
- }
6480
- function dateRangeToJsDateRange(range) {
6481
- if (!range) return void 0;
6482
- return {
6483
- from: range.from ? plainDateToJsDate(range.from) : void 0,
6484
- to: range.to ? plainDateToJsDate(range.to) : void 0
6485
- };
6486
- }
6487
- function jsDateRangeToDateRange(range) {
6488
- if (!range) return void 0;
6489
- return {
6490
- from: range.from ? jsDateToPlainDate(range.from) : void 0,
6491
- to: range.to ? jsDateToPlainDate(range.to) : void 0
6492
- };
6493
- }
6494
- function dateMatcherToDayPickerMatcher(matcher) {
6495
- if (typeof matcher === "function") {
6496
- return function dayPickerMatcher(date) {
6497
- return matcher(jsDateToPlainDate(date));
6498
- };
6499
- }
6500
- if (Array.isArray(matcher)) {
6501
- return matcher.map(plainDateToJsDate);
6502
- }
6503
- if (isPlainDate(matcher)) {
6504
- return plainDateToJsDate(matcher);
6505
- }
6506
- return {
6507
- from: matcher.from ? plainDateToJsDate(matcher.from) : void 0,
6508
- to: matcher.to ? plainDateToJsDate(matcher.to) : void 0
6509
- };
6510
- }
6511
- function dateMatchersToDayPickerMatchers(matchers) {
6512
- if (matchers === void 0) return void 0;
6513
- return Array.isArray(matchers) ? matchers.map(dateMatcherToDayPickerMatcher) : dateMatcherToDayPickerMatcher(matchers);
6514
- }
6515
-
6516
6352
  // src/components/internal/DatePicker/Day.tsx
6517
6353
  var import_react21 = require("react");
6518
6354
  var import_react_day_picker = require("react-day-picker");
@@ -6654,12 +6490,11 @@ function Header(props) {
6654
6490
  const {
6655
6491
  displayMonth
6656
6492
  } = props;
6657
- const displayMonthDate = jsDateToPlainDate(displayMonth);
6658
6493
  const {
6659
6494
  goToMonth
6660
6495
  } = (0, import_react_day_picker2.useNavigation)();
6661
6496
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "df jcsb aic ml_12px mr_2px h_32px", children: [
6662
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h1", { className: "fw4 fz_16px lh_24px", children: formatPlainDate(displayMonthDate, "monthYear") }),
6497
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h1", { className: "fw4 fz_16px lh_24px", children: (0, import_date_fns.format)(displayMonth, "MMMM yyyy") }),
6663
6498
  /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { children: [
6664
6499
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(IconButton, { color: "rgba(100, 100, 100, 1)" /* Gray700 */, icon: "chevronLeft", onClick: () => goToMonth((0, import_date_fns.addMonths)(displayMonth, -1)) }),
6665
6500
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(IconButton, { color: "rgba(100, 100, 100, 1)" /* Gray700 */, icon: "chevronRight", onClick: () => goToMonth((0, import_date_fns.addMonths)(displayMonth, 1)) })
@@ -6670,41 +6505,36 @@ function YearSkipHeader(props) {
6670
6505
  const {
6671
6506
  displayMonth
6672
6507
  } = props;
6673
- const displayMonthDate = jsDateToPlainDate(displayMonth);
6674
6508
  const {
6675
6509
  goToMonth
6676
6510
  } = (0, import_react_day_picker2.useNavigation)();
6677
6511
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "df jcsb aic ml_12px mr_12px h_32px", children: [
6678
6512
  /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "df fdr jcsb", children: [
6679
6513
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(IconButton, { color: "rgba(100, 100, 100, 1)" /* Gray700 */, icon: "chevronLeft", onClick: () => goToMonth((0, import_date_fns.addMonths)(displayMonth, -1)) }),
6680
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h1", { className: "fw4 fz_16px lh_24px", children: formatPlainDate(displayMonthDate, "shortMonth") }),
6514
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h1", { className: "fw4 fz_16px lh_24px", children: (0, import_date_fns.format)(displayMonth, "MMM") }),
6681
6515
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(IconButton, { color: "rgba(100, 100, 100, 1)" /* Gray700 */, icon: "chevronRight", onClick: () => goToMonth((0, import_date_fns.addMonths)(displayMonth, 1)) })
6682
6516
  ] }),
6683
6517
  /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "df fdr jcsb", children: [
6684
6518
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(IconButton, { color: "rgba(100, 100, 100, 1)" /* Gray700 */, icon: "chevronLeft", onClick: () => goToMonth((0, import_date_fns.addYears)(displayMonth, -1)) }),
6685
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h1", { className: "fw4 fz_16px lh_24px", children: formatPlainDate(displayMonthDate, "year") }),
6519
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h1", { className: "fw4 fz_16px lh_24px", children: (0, import_date_fns.format)(displayMonth, "yyyy") }),
6686
6520
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(IconButton, { color: "rgba(100, 100, 100, 1)" /* Gray700 */, icon: "chevronRight", onClick: () => goToMonth((0, import_date_fns.addYears)(displayMonth, 1)) })
6687
6521
  ] })
6688
6522
  ] });
6689
6523
  }
6690
6524
 
6691
6525
  // src/components/internal/DatePicker/WeekHeader.tsx
6526
+ var import_date_fns2 = require("date-fns");
6692
6527
  var import_jsx_runtime18 = require("react/jsx-runtime");
6693
6528
  function WeekHeader() {
6694
- const today = todayPlainDate();
6695
- const start = today.subtract({
6696
- days: today.dayOfWeek % 7
6697
- });
6529
+ const start = (0, import_date_fns2.startOfWeek)(/* @__PURE__ */ new Date());
6698
6530
  const days = [];
6699
6531
  for (let i = 0; i < 7; i++) {
6700
- days.push(start.add({
6701
- days: i
6702
- }));
6532
+ days.push((0, import_date_fns2.addDays)(start, i));
6703
6533
  }
6704
6534
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("thead", { className: "rdp-head", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("tr", { className: "rdp-head_row", children: days.map((day) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("th", { scope: "col", className: "pt1 pb_12px pr1 pl1 fw4 fz_12px lh_16px gray400", children: [
6705
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { "aria-hidden": "true", children: formatPlainDate(day, "weekdayInitial") }),
6706
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "rdp-vhidden", children: formatPlainDate(day, "weekday") })
6707
- ] }, formatPlainDate(day, "weekday"))) }) });
6535
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { "aria-hidden": "true", children: (0, import_date_fns2.format)(day, "EEEEE") }),
6536
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "rdp-vhidden", children: (0, import_date_fns2.format)(day, "EEEE") })
6537
+ ] }, (0, import_date_fns2.format)(day, "EEEE"))) }) });
6708
6538
  }
6709
6539
 
6710
6540
  // src/components/internal/DatePicker/DatePicker.tsx
@@ -6726,15 +6556,15 @@ function DatePicker(props) {
6726
6556
  Head: WeekHeader,
6727
6557
  Day
6728
6558
  },
6729
- selected: value ? [plainDateToJsDate(value)] : [],
6730
- defaultMonth: plainDateToJsDate(value ?? todayPlainDate()),
6559
+ selected: value ? [value] : [],
6560
+ defaultMonth: value ?? /* @__PURE__ */ new Date(),
6731
6561
  onDayClick: (day, modifiers) => {
6732
6562
  if (modifiers.disabled) return;
6733
- onSelect(jsDateToPlainDate(day));
6563
+ onSelect(day);
6734
6564
  },
6735
- disabled: dateMatchersToDayPickerMatchers(disabledDays),
6565
+ disabled: disabledDays,
6736
6566
  modifiers: {
6737
- indicatorDot: dateMatchersToDayPickerMatchers(dottedDays) ?? []
6567
+ indicatorDot: dottedDays ?? []
6738
6568
  }
6739
6569
  }
6740
6570
  ) });
@@ -6761,15 +6591,15 @@ function DateRangePicker(props) {
6761
6591
  useYearPicker
6762
6592
  } = props;
6763
6593
  const tid = useTestIds(props, "datePicker");
6764
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "dib bgWhite fw4 fz_12px lh_16px", ...tid, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_day_picker4.DayPicker, { mode: "range", selected: dateRangeToJsDateRange(range), components: {
6594
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "dib bgWhite fw4 fz_12px lh_16px", ...tid, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_day_picker4.DayPicker, { mode: "range", selected: range, components: {
6765
6595
  Caption: useYearPicker ? YearSkipHeader : Header,
6766
6596
  Head: WeekHeader,
6767
6597
  Day
6768
- }, defaultMonth: plainDateToJsDate(range?.to ?? range?.from ?? todayPlainDate()), onSelect: (selection, day, activeModifiers) => {
6598
+ }, defaultMonth: range?.to ?? /* @__PURE__ */ new Date(), onSelect: (selection, day, activeModifiers) => {
6769
6599
  if (activeModifiers.disabled) return;
6770
- onSelect(jsDateRangeToDateRange(selection));
6771
- }, disabled: dateMatchersToDayPickerMatchers(disabledDays), modifiers: {
6772
- indicatorDot: dateMatchersToDayPickerMatchers(dottedDays) ?? []
6600
+ onSelect(selection);
6601
+ }, disabled: disabledDays, modifiers: {
6602
+ indicatorDot: dottedDays ?? []
6773
6603
  } }) });
6774
6604
  }
6775
6605
 
@@ -11277,6 +11107,7 @@ function VirtualizedOptions(props) {
11277
11107
  // eslint-disable-next-line react-hooks/exhaustive-deps
11278
11108
  [focusedItem]
11279
11109
  );
11110
+ const key = process.env.NODE_ENV === "test" ? items.length : "virtuoso";
11280
11111
  return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11281
11112
  import_react_virtuoso.Virtuoso,
11282
11113
  {
@@ -11284,11 +11115,6 @@ function VirtualizedOptions(props) {
11284
11115
  totalListHeightChanged: onListHeightChange,
11285
11116
  totalCount: items.length,
11286
11117
  ...process.env.NODE_ENV === "test" ? {
11287
- // In tests, we render all rows so assertions can see expands/async-loaded items. However,
11288
- // the `initialItemCount` (next prop) is only applied on amount, so we set `key={items.length}`
11289
- // to force a remount when our list changes -- and we only want/need this in tests, b/c otherwise
11290
- // in production a Virtuoso remount causes visible flashing.
11291
- key: items.length,
11292
11118
  // We don't really need to set this, but it's handy for tests, which would otherwise render
11293
11119
  // just 1 row. A better way to do this would be to jest.mock out Virtuoso with an impl that
11294
11120
  // just rendered everything, but doing this for now.
@@ -11331,7 +11157,8 @@ function VirtualizedOptions(props) {
11331
11157
  components: !loading ? {} : {
11332
11158
  Footer: typeof loading === "function" ? loading : () => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(LoadingDots, { contrast })
11333
11159
  }
11334
- }
11160
+ },
11161
+ key
11335
11162
  );
11336
11163
  }
11337
11164
 
@@ -11458,7 +11285,7 @@ function ListBox(props) {
11458
11285
  boxShadow: "bshBasic h_bshHover"
11459
11286
  } : {}
11460
11287
  }), ref: listBoxRef, ...listBoxProps, children: [
11461
- isMultiSelect && !isTree && state.selectionManager.selectedKeys.size > 0 && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("ul", { className: "p_0 m_0 lis_none pt2 pl2 pb1 pr1 df bbs_solid bbw_1px bcGray200 flexWrap_wrap maxh_50 oa", ref: selectedList, children: selectedOptions.map((o) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ListBoxToggleChip, { state, option: o, getOptionValue, getOptionLabel, disabled: state.disabledKeys.has(getOptionValue(o)) }, getOptionValue(o))) }),
11288
+ isMultiSelect && selectedOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("ul", { className: "p_0 m_0 lis_none pt2 pl2 pb1 pr1 df bbs_solid bbw_1px bcGray200 flexWrap_wrap maxh_50 oa", ref: selectedList, children: selectedOptions.map((o) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ListBoxToggleChip, { state, option: o, getOptionValue, getOptionLabel, disabled: state.disabledKeys.has(getOptionValue(o)) }, getOptionValue(o))) }),
11462
11289
  /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("ul", { className: "p_0 m_0 lis_none fg1", children: hasSections ? [...state.collection].map((section) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
11463
11290
  ListBoxSection,
11464
11291
  {
@@ -11609,14 +11436,15 @@ function TreeSelectFieldBase(props) {
11609
11436
  if (!maybeOption) return [];
11610
11437
  return [maybeOption.option];
11611
11438
  });
11612
- 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);
11439
+ const selectedChipState = getSelectedChipState(initialOptions, selectedOptions, selectedKeys, chipDisplay, getOptionLabel, getOptionValue);
11613
11440
  return {
11614
11441
  selectedKeys: [...selectedKeys],
11615
11442
  searchValue: void 0,
11616
- inputValue: selectedOptions.length === 1 ? getOptionLabel([...selectedOptions][0]) : isReadOnly && selectedOptions.length > 0 ? selectedOptionsLabels.join(", ") : selectedOptions.length === 0 ? nothingSelectedText : "",
11443
+ inputValue: selectedOptions.length === 1 ? getOptionLabel([...selectedOptions][0]) : isReadOnly && selectedOptions.length > 0 ? selectedChipState.labels.join(", ") : selectedOptions.length === 0 ? nothingSelectedText : "",
11617
11444
  selectedOptions,
11445
+ selectedChipOptions: selectedChipState.options,
11618
11446
  allOptions: initialOptions,
11619
- selectedOptionsLabels,
11447
+ selectedOptionsLabels: selectedChipState.labels,
11620
11448
  optionsLoading: false,
11621
11449
  allowCollapsing: true
11622
11450
  };
@@ -11715,7 +11543,9 @@ function TreeSelectFieldBase(props) {
11715
11543
  searchValue: void 0,
11716
11544
  allowCollapsing: true,
11717
11545
  selectedKeys: [],
11718
- selectedOptions: []
11546
+ selectedOptions: [],
11547
+ selectedChipOptions: [],
11548
+ selectedOptionsLabels: []
11719
11549
  }));
11720
11550
  onSelect({
11721
11551
  all: {
@@ -11782,6 +11612,7 @@ function TreeSelectFieldBase(props) {
11782
11612
  const rootValues = rootOptions.map(getOptionValue);
11783
11613
  const leafOptions = selectedOptions.filter((o) => !o.children || o.children.length === 0);
11784
11614
  const leafValues = leafOptions.map(getOptionValue);
11615
+ const selectedChipState = getSelectedChipState(fieldState.allOptions, selectedOptions, selectedKeys, chipDisplay, getOptionLabel, getOptionValue);
11785
11616
  setFieldState((prevState) => ({
11786
11617
  ...prevState,
11787
11618
  // Since we reset the list of options upon selection changes, then set the `inputValue` to empty string to reflect that.
@@ -11789,7 +11620,8 @@ function TreeSelectFieldBase(props) {
11789
11620
  searchValue: void 0,
11790
11621
  selectedKeys: [...selectedKeys],
11791
11622
  selectedOptions,
11792
- selectedOptionsLabels: chipDisplay === "root" ? rootOptions.map(getOptionLabel) : chipDisplay === "leaf" ? leafOptions.map(getOptionLabel) : selectedOptions.map(getOptionLabel)
11623
+ selectedChipOptions: selectedChipState.options,
11624
+ selectedOptionsLabels: selectedChipState.labels
11793
11625
  }));
11794
11626
  onSelect({
11795
11627
  all: {
@@ -11888,7 +11720,7 @@ function TreeSelectFieldBase(props) {
11888
11720
  onClose: () => state.toggle(),
11889
11721
  isOpen: state.isOpen,
11890
11722
  minWidth: 320,
11891
- children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ListBox, { ...listBoxProps, positionProps, state, listBoxRef, selectedOptions: fieldState.selectedOptions, getOptionLabel, getOptionValue: (o) => valueToKey(getOptionValue(o)), contrast, horizontalLayout: labelStyle === "left", loading: fieldState.optionsLoading, allowCollapsing: fieldState.allowCollapsing, isTree: true })
11723
+ children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ListBox, { ...listBoxProps, positionProps, state, listBoxRef, selectedOptions: fieldState.selectedChipOptions, getOptionLabel, getOptionValue: (o) => valueToKey(getOptionValue(o)), contrast, horizontalLayout: labelStyle === "left", loading: fieldState.optionsLoading, allowCollapsing: fieldState.allowCollapsing, isTree: true })
11892
11724
  }
11893
11725
  )
11894
11726
  ] });
@@ -11918,6 +11750,25 @@ function isOptionFullySelected(option, selectedKeys, disabledKeys, groupKeys, ge
11918
11750
  if (!option.children || option.children.length === 0) return false;
11919
11751
  return option.children.every((child) => isOptionFullySelected(child, selectedKeys, disabledKeys, groupKeys, getOptionValue));
11920
11752
  }
11753
+ function getSelectedChipState(allOptions, selectedOptions, selectedKeys, chipDisplay, getOptionLabel, getOptionValue) {
11754
+ const options = chipDisplay === "root" ? dedupeOptionsByValue(allOptions.flatMap((option) => getTopLevelSelections(option, selectedKeys, getOptionValue)), getOptionValue) : chipDisplay === "leaf" ? selectedOptions.filter(isLeafOption) : selectedOptions;
11755
+ return {
11756
+ options,
11757
+ labels: options.map(getOptionLabel)
11758
+ };
11759
+ }
11760
+ function dedupeOptionsByValue(options, getOptionValue) {
11761
+ const seen = /* @__PURE__ */ new Set();
11762
+ return options.filter(function filterOption(option) {
11763
+ const key = valueToKey(getOptionValue(option));
11764
+ if (seen.has(key)) return false;
11765
+ seen.add(key);
11766
+ return true;
11767
+ });
11768
+ }
11769
+ function isLeafOption(option) {
11770
+ return !option.children || option.children.length === 0;
11771
+ }
11921
11772
 
11922
11773
  // src/inputs/internal/ComboBoxInput.tsx
11923
11774
  var import_jsx_runtime55 = require("react/jsx-runtime");
@@ -11956,7 +11807,6 @@ function ComboBoxInput(props) {
11956
11807
  } = useTreeSelectFieldProvider();
11957
11808
  const [isFocused, setIsFocused] = (0, import_react45.useState)(false);
11958
11809
  const isMultiSelect = state.selectionManager.selectionMode === "multiple";
11959
- const showNumSelection = isMultiSelect && state.selectionManager.selectedKeys.size > 1;
11960
11810
  const showChipSelection = isMultiSelect && state.selectionManager.selectedKeys.size > 0;
11961
11811
  const showFieldDecoration = (!isMultiSelect || isMultiSelect && !isFocused) && fieldDecoration && selectedOptions.length === 1;
11962
11812
  const multilineProps = allowWrap ? {
@@ -11964,6 +11814,8 @@ function ComboBoxInput(props) {
11964
11814
  multiline: true
11965
11815
  } : {};
11966
11816
  const chipLabels = isTree ? selectedOptionsLabels || [] : selectedOptions.map((o) => getOptionLabel(o));
11817
+ const selectedChipCount = chipLabels.length;
11818
+ const showNumSelection = isMultiSelect && selectedChipCount > 1;
11967
11819
  useGrowingTextField({
11968
11820
  // This says: When using a multiselect, then only enable the growing textfield when we are focused on it.
11969
11821
  // Because otherwise, we're not displaying the input element that dictates the height (we're displaying <Chips/>). This would cause incorrect calculations
@@ -11974,7 +11826,7 @@ function ComboBoxInput(props) {
11974
11826
  });
11975
11827
  return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TextFieldBase, { ...otherProps, ...multilineProps, unfocusedPlaceholder: showChipSelection && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Chips, { compact: otherProps.compact, values: chipLabels, wrap: allowWrap }), inputRef, inputWrapRef, errorMsg, contrast, xss: otherProps.labelStyle !== "inline" && !inputProps.readOnly ? {
11976
11828
  fontWeight: "fw5"
11977
- } : void 0, startAdornment: showNumSelection && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Tooltip, { title: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(SelectedOptionBullets, { labels: chipLabels }), children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(CountBadge, { count: isTree ? selectedOptionsLabels?.length ?? 0 : state.selectionManager.selectedKeys.size, "data-testid": "selectedOptionsCount" }) }) || showFieldDecoration && fieldDecoration(selectedOptions[0]), endAdornment: !inputProps.readOnly && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("button", { ...buttonProps, disabled: inputProps.disabled, ref: buttonRef, ...(0, import_runtime40.trussProps)({
11829
+ } : void 0, startAdornment: showNumSelection && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Tooltip, { title: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(SelectedOptionBullets, { labels: chipLabels }), children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(CountBadge, { count: selectedChipCount, "data-testid": "selectedOptionsCount" }) }) || showFieldDecoration && fieldDecoration(selectedOptions[0]), endAdornment: !inputProps.readOnly && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("button", { ...buttonProps, disabled: inputProps.disabled, ref: buttonRef, ...(0, import_runtime40.trussProps)({
11978
11830
  ...{
11979
11831
  borderRadius: "br4",
11980
11832
  outline: "outline0",
@@ -12612,37 +12464,69 @@ function CheckboxGroupItem(props) {
12612
12464
  }
12613
12465
 
12614
12466
  // src/inputs/DateFields/DateField.mock.tsx
12467
+ var import_date_fns3 = require("date-fns");
12615
12468
  var import_react50 = require("react");
12469
+ var import_jsx_runtime60 = require("react/jsx-runtime");
12470
+ function DateFieldMock(props) {
12471
+ const { onChange = () => {
12472
+ }, errorMsg, onBlur, onFocus } = props;
12473
+ const [value, setValue] = (0, import_react50.useState)(props.value ? (0, import_date_fns3.format)(props.value, "MM/dd/yy") : "");
12474
+ const tid = useTestIds(props, "date");
12475
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
12476
+ "input",
12477
+ {
12478
+ ...tid,
12479
+ "data-error": !!errorMsg,
12480
+ value,
12481
+ onChange: (e) => {
12482
+ const { value: value2 } = e.target;
12483
+ setValue(value2);
12484
+ onChange((0, import_date_fns3.parse)(value2, "MM/dd/yy", /* @__PURE__ */ new Date()));
12485
+ },
12486
+ onBlur: () => maybeCall(onBlur),
12487
+ onFocus: () => maybeCall(onFocus),
12488
+ disabled: !!props.disabled,
12489
+ readOnly: !!props.readOnly,
12490
+ "data-disabled-days": JSON.stringify(props.disabledDays)
12491
+ }
12492
+ );
12493
+ }
12494
+
12495
+ // src/inputs/DateFields/DateFieldBase.tsx
12496
+ var import_react51 = require("react");
12497
+ var import_react_aria31 = require("react-aria");
12498
+ var import_react_day_picker5 = require("react-day-picker");
12499
+ var import_react_stately10 = require("react-stately");
12616
12500
 
12617
12501
  // src/inputs/DateFields/utils.ts
12618
- var import_temporal_polyfill2 = require("temporal-polyfill");
12502
+ var import_date_fns4 = require("date-fns");
12619
12503
  var dateFormats = {
12620
- short: "shortDate",
12621
- medium: "shortWeekdayMonthDay",
12622
- long: "longWeekdayMonthDayYear"
12504
+ short: "MM/dd/yy",
12505
+ medium: "EEE, MMM d",
12506
+ long: "EEEE LLLL d, uuuu"
12623
12507
  };
12624
- function getDateFormat(format) {
12625
- return format ? dateFormats[format] : dateFormats.short;
12508
+ function getDateFormat(format4) {
12509
+ return format4 ? dateFormats[format4] : dateFormats.short;
12626
12510
  }
12627
- function formatDate(date, format) {
12511
+ function formatDate(date, format4) {
12628
12512
  if (!date) return "";
12629
- return formatPlainDate(date, format);
12513
+ return (0, import_date_fns4.format)(date, format4);
12630
12514
  }
12631
- function formatDateRange(date, format) {
12515
+ function formatDateRange(date, format4) {
12632
12516
  if (!date) return "";
12633
12517
  const { from, to } = date;
12634
- const fromFormatted = from ? formatPlainDate(from, format) : "";
12635
- const toFormatted = to ? formatPlainDate(to, format) : "";
12518
+ const fromFormatted = from ? (0, import_date_fns4.format)(from, format4) : "";
12519
+ const toFormatted = to ? (0, import_date_fns4.format)(to, format4) : "";
12636
12520
  return !fromFormatted && !toFormatted ? void 0 : `${fromFormatted} - ${toFormatted}`;
12637
12521
  }
12638
- function parseDate(str, format) {
12639
- return parseDateString(str, format);
12522
+ function parseDate(str, format4) {
12523
+ return parseDateString(str, format4);
12640
12524
  }
12641
- function parseDateRange(str, format) {
12525
+ function parseDateRange(str, format4) {
12642
12526
  const [from = "", to = ""] = str.split("-");
12643
- const fromDate = parseDateString(from.trim(), format);
12644
- const toDate = parseDateString(to.trim(), format);
12645
- if (toDate && fromDate && import_temporal_polyfill2.Temporal.PlainDate.compare(toDate, fromDate) < 0) {
12527
+ const fromDate = parseDateString(from.trim(), format4);
12528
+ const toDate = parseDateString(to.trim(), format4);
12529
+ if (toDate && fromDate && toDate < fromDate) {
12646
12530
  return { from: toDate, to: fromDate };
12647
12531
  }
12648
12532
  if (toDate === void 0 && fromDate === void 0) {
@@ -12650,81 +12534,31 @@ function parseDateRange(str, format) {
12650
12534
  }
12651
12535
  return { from: fromDate, to: toDate };
12652
12536
  }
12653
- function parseDateString(str, format) {
12654
- if (format !== dateFormats.short && format !== "date") {
12655
- return void 0;
12656
- }
12537
+ function parseDateString(str, format4) {
12657
12538
  const split = str.split("/");
12658
12539
  if (split.length !== 3) {
12659
12540
  return void 0;
12660
12541
  }
12661
- const yearLength = format === dateFormats.short ? 2 : 4;
12662
- if (split[2].length !== yearLength) {
12542
+ if (split[2].length !== 2) {
12663
12543
  return void 0;
12664
12544
  }
12665
- const month = parseInt(split[0], 10);
12545
+ const month = parseInt(split[0], 10) - 1;
12666
12546
  const day = parseInt(split[1], 10);
12667
12547
  const year = parseInt(split[2], 10);
12668
- if (Number.isNaN(year) || Number.isNaN(month) || Number.isNaN(day) || day <= 0 || day > 31 || month <= 0 || month > 12) {
12548
+ if (isNaN(year) || String(year).length > 4 || isNaN(month) || isNaN(day) || day <= 0 || day > 31 || month < 0 || month >= 12) {
12669
12549
  return void 0;
12670
12550
  }
12671
- try {
12672
- return import_temporal_polyfill2.Temporal.PlainDate.from({
12673
- year: yearLength === 2 ? normalizeTwoDigitYear(year, todayPlainDate().year) : year,
12674
- month,
12675
- day
12676
- });
12677
- } catch {
12551
+ const parsed = (0, import_date_fns4.parse)(str, format4, /* @__PURE__ */ new Date());
12552
+ if (!isValidDate(parsed)) {
12678
12553
  return void 0;
12679
12554
  }
12555
+ return parsed;
12680
12556
  }
12681
12557
  function isValidDate(d) {
12682
- return d !== void 0 && isPlainDate(d);
12683
- }
12684
- function normalizeTwoDigitYear(twoDigitYear, currentYear) {
12685
- const isCommonEra = currentYear > 0;
12686
- const absCurrentYear = isCommonEra ? currentYear : 1 - currentYear;
12687
- if (absCurrentYear <= 50) {
12688
- return isCommonEra ? twoDigitYear || 100 : 1 - (twoDigitYear || 100);
12689
- }
12690
- const rangeEnd = absCurrentYear + 50;
12691
- const rangeEndCentury = Math.floor(rangeEnd / 100) * 100;
12692
- const isPreviousCentury = twoDigitYear >= rangeEnd % 100;
12693
- const normalizedYear = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0);
12694
- return isCommonEra ? normalizedYear : 1 - normalizedYear;
12695
- }
12696
-
12697
- // src/inputs/DateFields/DateField.mock.tsx
12698
- var import_jsx_runtime60 = require("react/jsx-runtime");
12699
- function DateFieldMock(props) {
12700
- const { onChange = () => {
12701
- }, errorMsg, onBlur, onFocus } = props;
12702
- const [value, setValue] = (0, import_react50.useState)(formatDate(props.value, dateFormats.short));
12703
- const tid = useTestIds(props, "date");
12704
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
12705
- "input",
12706
- {
12707
- ...tid,
12708
- "data-error": !!errorMsg,
12709
- value,
12710
- onChange: (e) => {
12711
- const { value: value2 } = e.target;
12712
- setValue(value2);
12713
- onChange(parseDate(value2, dateFormats.short));
12714
- },
12715
- onBlur: () => maybeCall(onBlur),
12716
- onFocus: () => maybeCall(onFocus),
12717
- disabled: !!props.disabled,
12718
- readOnly: !!props.readOnly,
12719
- "data-disabled-days": JSON.stringify(props.disabledDays)
12720
- }
12721
- );
12558
+ return d !== void 0 && (0, import_date_fns4.isDate)(d) && d.toString() !== "Invalid Date";
12722
12559
  }
12723
12560
 
12724
12561
  // src/inputs/DateFields/DateFieldBase.tsx
12725
- var import_react51 = require("react");
12726
- var import_react_aria31 = require("react-aria");
12727
- var import_react_stately10 = require("react-stately");
12728
12562
  var import_runtime43 = require("@homebound/truss/runtime");
12729
12563
  var import_jsx_runtime61 = require("react/jsx-runtime");
12730
12564
  function DateFieldBase(props) {
@@ -12740,7 +12574,7 @@ function DateFieldBase(props) {
12740
12574
  errorMsg,
12741
12575
  helperText,
12742
12576
  readOnly,
12743
- format = "short",
12577
+ format: format4 = "short",
12744
12578
  iconLeft = false,
12745
12579
  hideCalendarIcon = false,
12746
12580
  disabledDays,
@@ -12757,7 +12591,7 @@ function DateFieldBase(props) {
12757
12591
  const buttonRef = (0, import_react51.useRef)(null);
12758
12592
  const overlayRef = (0, import_react51.useRef)(null);
12759
12593
  const isFocused = (0, import_react51.useRef)(false);
12760
- const dateFormat = getDateFormat(format);
12594
+ const dateFormat = getDateFormat(format4);
12761
12595
  const [wipValue, setWipValue] = (0, import_react51.useState)(value);
12762
12596
  const [inputValue, setInputValue] = (0, import_react51.useState)((isRangeMode ? formatDateRange(props.value, dateFormat) : formatDate(props.value, dateFormat)) ?? "");
12763
12597
  const tid = useTestIds(props, defaultTestId(label));
@@ -12846,20 +12680,16 @@ function DateFieldBase(props) {
12846
12680
  (d) => {
12847
12681
  setWipValue(d);
12848
12682
  if (d && isParsedDateValid(d)) {
12849
- if (isRangeMode && isDateRangeValue(d)) {
12683
+ if (isRangeMode && (0, import_react_day_picker5.isDateRange)(d)) {
12850
12684
  props.onChange(d);
12851
12685
  return;
12852
12686
  }
12853
- if (!isRangeMode && !isDateRangeValue(d)) {
12687
+ if (!isRangeMode && !(0, import_react_day_picker5.isDateRange)(d)) {
12854
12688
  props.onChange(d);
12855
12689
  return;
12856
12690
  }
12857
12691
  } else {
12858
- if (isRangeMode) {
12859
- props.onChange(void 0);
12860
- } else {
12861
- props.onChange(void 0);
12862
- }
12692
+ props.onChange(void 0);
12863
12693
  return;
12864
12694
  }
12865
12695
  },
@@ -12867,7 +12697,7 @@ function DateFieldBase(props) {
12867
12697
  // eslint-disable-next-line react-hooks/exhaustive-deps
12868
12698
  [isRangeMode, props.onChange]
12869
12699
  );
12870
- const inputSize = !isRangeMode ? format === "short" ? 8 : format === "medium" ? 10 : void 0 : void 0;
12700
+ const inputSize = !isRangeMode ? format4 === "short" ? 8 : format4 === "medium" ? 10 : void 0 : void 0;
12871
12701
  const clearButton = /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_jsx_runtime61.Fragment, { children: inputValue !== "" && !state.isOpen && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(IconButton, { icon: "xCircle", color: "rgba(100, 100, 100, 1)" /* Gray700 */, onClick: () => {
12872
12702
  setInputValue("");
12873
12703
  onChange(void 0);
@@ -12929,10 +12759,7 @@ function DateFieldBase(props) {
12929
12759
  ] });
12930
12760
  }
12931
12761
  function isParsedDateValid(d) {
12932
- return d !== void 0 && (!isDateRangeValue(d) || isValidDate(d.from) && isValidDate(d.to));
12933
- }
12934
- function isDateRangeValue(value) {
12935
- return typeof value === "object" && value !== null && ("from" in value || "to" in value);
12762
+ return d !== void 0 && (!(0, import_react_day_picker5.isDateRange)(d) || (0, import_react_day_picker5.isDateRange)(d) && isValidDate(d.from) && isValidDate(d.to));
12936
12763
  }
12937
12764
 
12938
12765
  // src/utils/withTestMock.tsx
@@ -15449,7 +15276,7 @@ function useScrollStorage(tableId, enabled = true) {
15449
15276
  }
15450
15277
 
15451
15278
  // src/components/Table/hooks/useSetupColumnSizes.ts
15452
- var import_utils67 = require("@react-aria/utils");
15279
+ var import_utils66 = require("@react-aria/utils");
15453
15280
  var import_react70 = require("react");
15454
15281
 
15455
15282
  // src/components/Table/hooks/useColumnResizing.ts
@@ -15573,7 +15400,7 @@ function useSetupColumnSizes(style, columns, resizeRef, expandedColumnIds, visib
15573
15400
  // eslint-disable-next-line react-hooks/exhaustive-deps
15574
15401
  [tableWidth, setTableAndColumnWidths, setTableAndColumnWidthsDebounced]
15575
15402
  );
15576
- (0, import_utils67.useResizeObserver)({ ref: resizeRef, onResize });
15403
+ (0, import_utils66.useResizeObserver)({ ref: resizeRef, onResize });
15577
15404
  return { columnSizes, tableWidth, resizedWidths, setResizedWidth, setResizedWidths, resetColumnWidths };
15578
15405
  }
15579
15406
 
@@ -16166,7 +15993,7 @@ function ToggleChips(props) {
16166
15993
  }
16167
15994
 
16168
15995
  // src/components/Accordion.tsx
16169
- var import_utils70 = require("@react-aria/utils");
15996
+ var import_utils69 = require("@react-aria/utils");
16170
15997
  var import_react73 = require("react");
16171
15998
  var import_react_aria40 = require("react-aria");
16172
15999
  var import_runtime54 = require("@homebound/truss/runtime");
@@ -16192,7 +16019,7 @@ function Accordion(props) {
16192
16019
  xss
16193
16020
  } = props;
16194
16021
  const tid = useTestIds(props, "accordion");
16195
- const id = (0, import_utils70.useId)();
16022
+ const id = (0, import_utils69.useId)();
16196
16023
  const [expanded, setExpanded] = (0, import_react73.useState)(defaultExpanded && !disabled);
16197
16024
  const {
16198
16025
  isFocusVisible,
@@ -16214,7 +16041,7 @@ function Accordion(props) {
16214
16041
  setContentHeight(`${contentEl.scrollHeight}px`);
16215
16042
  }
16216
16043
  }, [expanded, contentEl, setContentHeight]);
16217
- (0, import_utils70.useResizeObserver)({
16044
+ (0, import_utils69.useResizeObserver)({
16218
16045
  ref: contentRef,
16219
16046
  onResize
16220
16047
  });
@@ -16505,7 +16332,7 @@ var import_react102 = require("react");
16505
16332
  var import_react_aria46 = require("react-aria");
16506
16333
 
16507
16334
  // src/components/Modal/Modal.tsx
16508
- var import_utils74 = require("@react-aria/utils");
16335
+ var import_utils73 = require("@react-aria/utils");
16509
16336
  var import_react78 = require("react");
16510
16337
  var import_react_aria41 = require("react-aria");
16511
16338
  var import_react_dom3 = require("react-dom");
@@ -16628,7 +16455,7 @@ function Modal(props) {
16628
16455
  };
16629
16456
  }
16630
16457
  const [hasScroll, setHasScroll] = (0, import_react78.useState)(forceScrolling ?? false);
16631
- (0, import_utils74.useResizeObserver)({
16458
+ (0, import_utils73.useResizeObserver)({
16632
16459
  ref: modalBodyRef,
16633
16460
  onResize: (0, import_react78.useCallback)(
16634
16461
  () => {
@@ -18268,7 +18095,7 @@ function FormHeading(props) {
18268
18095
  FormHeading.isFormHeading = true;
18269
18096
 
18270
18097
  // src/forms/StaticField.tsx
18271
- var import_utils102 = require("@react-aria/utils");
18098
+ var import_utils101 = require("@react-aria/utils");
18272
18099
  var import_runtime65 = require("@homebound/truss/runtime");
18273
18100
  var import_jsx_runtime118 = require("react/jsx-runtime");
18274
18101
  function StaticField(props) {
@@ -18282,7 +18109,7 @@ function StaticField(props) {
18282
18109
  children
18283
18110
  } = props;
18284
18111
  const tid = useTestIds(props, typeof label === "string" ? defaultTestId(label) : "staticField");
18285
- const id = (0, import_utils102.useId)();
18112
+ const id = (0, import_utils101.useId)();
18286
18113
  return /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("div", { ...(0, import_runtime65.trussProps)({
18287
18114
  ...labelStyle === "left" ? {
18288
18115
  display: "df",
@@ -18966,16 +18793,8 @@ function dateFilter(props) {
18966
18793
  }
18967
18794
  var anyOption = {};
18968
18795
  var DateFilter = class extends BaseFilter {
18969
- hydrate(value) {
18970
- if (!isDateFilterValue(value)) return void 0;
18971
- const hydratedValue = parsePersistedPlainDate(value.value);
18972
- return hydratedValue ? { op: value.op, value: hydratedValue } : void 0;
18973
- }
18974
- dehydrate(value) {
18975
- return value ? { op: value.op, value: dehydratePlainDate(value.value) } : void 0;
18976
- }
18977
18796
  render(value, setValue, tid, inModal, vertical) {
18978
- const { label, operations, getOperationValue, getOperationLabel, defaultValue } = this.props;
18797
+ const { label, operations, getOperationValue, getOperationLabel } = this.props;
18979
18798
  return /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(import_jsx_runtime127.Fragment, { children: [
18980
18799
  vertical && /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(Label, { label }),
18981
18800
  /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(CompoundField, { children: [
@@ -18992,8 +18811,8 @@ var DateFilter = class extends BaseFilter {
18992
18811
  getOptionLabel: (o) => o === anyOption ? "Any" : getOperationLabel(o),
18993
18812
  value: value?.op,
18994
18813
  onSelect: (op) => (
18995
- // default the selected date to the filter's default date or today if it doesn't exist in the filter's value
18996
- setValue(op ? { op, value: value?.value ?? defaultValue?.value ?? todayPlainDate() } : void 0)
18814
+ // default the selected date to today if it doesn't exist in the filter's value
18815
+ setValue(op ? { op, value: value?.value ? new Date(value.value) : /* @__PURE__ */ new Date() } : void 0)
18997
18816
  ),
18998
18817
  label: inModal ? `${label} date filter operation` : label,
18999
18818
  labelStyle: !inModal && !vertical ? "inline" : inModal || vertical ? "hidden" : "above",
@@ -19005,13 +18824,9 @@ var DateFilter = class extends BaseFilter {
19005
18824
  DateField,
19006
18825
  {
19007
18826
  labelStyle: "inline",
19008
- value: value?.value ?? defaultValue?.value ?? todayPlainDate(),
18827
+ value: value?.value ? new Date(value.value) : /* @__PURE__ */ new Date(),
19009
18828
  label: "Date",
19010
- onChange: (d) => {
19011
- if (d && value) {
19012
- setValue({ ...value, value: d });
19013
- }
19014
- },
18829
+ onChange: (d) => setValue({ ...value, value: d }),
19015
18830
  disabled: !value,
19016
18831
  ...tid[`${defaultTestId(this.label)}_dateField`]
19017
18832
  }
@@ -19020,9 +18835,6 @@ var DateFilter = class extends BaseFilter {
19020
18835
  ] });
19021
18836
  }
19022
18837
  };
19023
- function isDateFilterValue(value) {
19024
- return typeof value === "object" && value !== null && "op" in value && "value" in value;
19025
- }
19026
18838
 
19027
18839
  // src/components/Filters/DateRangeFilter.tsx
19028
18840
  var import_jsx_runtime128 = require("react/jsx-runtime");
@@ -19030,17 +18842,6 @@ function dateRangeFilter(props) {
19030
18842
  return (key) => new DateRangeFilter(key, props);
19031
18843
  }
19032
18844
  var DateRangeFilter = class extends BaseFilter {
19033
- hydrate(value) {
19034
- if (!isDateRangeFilterValue(value)) return void 0;
19035
- const hydratedValue = hydrateDateRange(value.value);
19036
- return hydratedValue ? { op: value.op, value: hydratedValue } : void 0;
19037
- }
19038
- dehydrate(value) {
19039
- return value ? {
19040
- op: value.op,
19041
- value: value.value ? { from: dehydratePlainDate(value.value.from), to: dehydratePlainDate(value.value.to) } : void 0
19042
- } : void 0;
19043
- }
19044
18845
  render(value, setValue, tid, inModal, vertical) {
19045
18846
  const { label, placeholderText, disabledDays, testFieldLabel, defaultValue } = this.props;
19046
18847
  return /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)(import_jsx_runtime128.Fragment, { children: [
@@ -19052,17 +18853,8 @@ var DateRangeFilter = class extends BaseFilter {
19052
18853
  isRangeFilterField: true,
19053
18854
  placeholder: placeholderText,
19054
18855
  label: testFieldLabel ?? "Date",
19055
- value: value?.value,
19056
- onChange: (d) => {
19057
- if (!d) {
19058
- setValue(void 0);
19059
- return;
19060
- }
19061
- const op = value?.op ?? defaultValue?.op;
19062
- if (op !== void 0) {
19063
- setValue({ op, value: d });
19064
- }
19065
- },
18856
+ value: value?.value ? { from: new Date(value.value.from), to: new Date(value.value.to) } : void 0,
18857
+ onChange: (d) => d ? setValue({ op: defaultValue?.op, value: d }) : setValue(void 0),
19066
18858
  disabledDays,
19067
18859
  ...tid[`${defaultTestId(this.label)}_dateField`]
19068
18860
  }
@@ -19070,17 +18862,6 @@ var DateRangeFilter = class extends BaseFilter {
19070
18862
  ] });
19071
18863
  }
19072
18864
  };
19073
- function isDateRangeFilterValue(value) {
19074
- return typeof value === "object" && value !== null && "op" in value && "value" in value;
19075
- }
19076
- function hydrateDateRange(value) {
19077
- if (typeof value !== "object" || value === null) return void 0;
19078
- const { from, to } = value;
19079
- const hydratedFrom = parsePersistedPlainDate(from);
19080
- const hydratedTo = parsePersistedPlainDate(to);
19081
- if (hydratedFrom === void 0 && hydratedTo === void 0) return void 0;
19082
- return { from: hydratedFrom, to: hydratedTo };
19083
- }
19084
18865
 
19085
18866
  // src/components/Filters/MultiFilter.tsx
19086
18867
  var import_jsx_runtime129 = require("react/jsx-runtime");
@@ -19886,10 +19667,10 @@ function useGridTableLayoutState({
19886
19667
  });
19887
19668
  (0, import_react99.useEffect)(() => {
19888
19669
  if (page.limit !== persistedPageSize) setPersistedPageSize(page.limit);
19889
- setPage((prev) => prev.offset === 0 ? prev : {
19670
+ setPage((prev) => ({
19890
19671
  ...prev,
19891
19672
  offset: 0
19892
- });
19673
+ }));
19893
19674
  }, [page.limit, persistedPageSize, setPersistedPageSize, filter, searchString]);
19894
19675
  return {
19895
19676
  filter,
@@ -20404,7 +20185,7 @@ var import_react106 = require("react");
20404
20185
  var import_react_aria49 = require("react-aria");
20405
20186
 
20406
20187
  // src/components/Tag.tsx
20407
- var import_utils119 = require("@react-aria/utils");
20188
+ var import_utils118 = require("@react-aria/utils");
20408
20189
  var import_react105 = require("react");
20409
20190
  var import_runtime78 = require("@homebound/truss/runtime");
20410
20191
  var import_jsx_runtime152 = require("react/jsx-runtime");
@@ -20420,7 +20201,7 @@ function Tag(props) {
20420
20201
  const tid = useTestIds(otherProps);
20421
20202
  const [showTooltip, setShowTooltip] = (0, import_react105.useState)(false);
20422
20203
  const ref = (0, import_react105.useRef)(null);
20423
- (0, import_utils119.useResizeObserver)({
20204
+ (0, import_utils118.useResizeObserver)({
20424
20205
  ref,
20425
20206
  onResize: () => {
20426
20207
  if (ref.current) {
@@ -21117,7 +20898,7 @@ function HbSpinnerProvider({
21117
20898
  }
21118
20899
 
21119
20900
  // src/components/MaxLines.tsx
21120
- var import_utils127 = require("@react-aria/utils");
20901
+ var import_utils126 = require("@react-aria/utils");
21121
20902
  var import_react115 = require("react");
21122
20903
  var import_runtime85 = require("@homebound/truss/runtime");
21123
20904
  var import_jsx_runtime160 = require("react/jsx-runtime");
@@ -21128,7 +20909,7 @@ function MaxLines({
21128
20909
  const elRef = (0, import_react115.useRef)(null);
21129
20910
  const [hasMore, setHasMore] = (0, import_react115.useState)(false);
21130
20911
  const [expanded, setExpanded] = (0, import_react115.useState)(false);
21131
- (0, import_utils127.useLayoutEffect)(() => {
20912
+ (0, import_utils126.useLayoutEffect)(() => {
21132
20913
  if (!elRef.current) return;
21133
20914
  setHasMore(elRef.current.scrollHeight > elRef.current.clientHeight);
21134
20915
  }, []);
@@ -21139,7 +20920,7 @@ function MaxLines({
21139
20920
  if (!elRef.current) return;
21140
20921
  !expanded && setHasMore(elRef.current.scrollHeight > elRef.current.clientHeight);
21141
20922
  }, [expanded]);
21142
- (0, import_utils127.useResizeObserver)({
20923
+ (0, import_utils126.useResizeObserver)({
21143
20924
  ref: elRef,
21144
20925
  onResize
21145
20926
  });
@@ -21160,7 +20941,7 @@ function MaxLines({
21160
20941
  }
21161
20942
 
21162
20943
  // src/components/ScrollShadows.tsx
21163
- var import_utils128 = require("@react-aria/utils");
20944
+ var import_utils127 = require("@react-aria/utils");
21164
20945
  var import_react116 = require("react");
21165
20946
  var import_runtime86 = require("@homebound/truss/runtime");
21166
20947
  var import_jsx_runtime161 = require("react/jsx-runtime");
@@ -21247,7 +21028,7 @@ function ScrollShadows(props) {
21247
21028
  setShowEndShadow(start + boxSize < end);
21248
21029
  }, [horizontal]);
21249
21030
  const onResize = (0, import_react116.useCallback)(() => scrollRef.current && updateScrollProps(scrollRef.current), [updateScrollProps]);
21250
- (0, import_utils128.useResizeObserver)({
21031
+ (0, import_utils127.useResizeObserver)({
21251
21032
  ref: scrollRef,
21252
21033
  onResize
21253
21034
  });
@@ -22284,7 +22065,6 @@ function useToast() {
22284
22065
  filterTestIdPrefix,
22285
22066
  formatDate,
22286
22067
  formatDateRange,
22287
- formatPlainDate,
22288
22068
  formatValue,
22289
22069
  generateColumnId,
22290
22070
  getAlignment,