@homebound/beam 3.2.0-alpha.3 → 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
 
@@ -7922,7 +7752,6 @@ var RowState = class {
7922
7752
  };
7923
7753
 
7924
7754
  // src/components/Table/utils/sortRows.ts
7925
- var import_temporal_polyfill2 = require("temporal-polyfill");
7926
7755
  function sortRows(columns, rows, sortState, caseSensitive) {
7927
7756
  const fn = sortFn(columns, sortState, caseSensitive);
7928
7757
  const sorted = [...rows].sort(fn);
@@ -7987,7 +7816,7 @@ function sortValue(value, caseSensitive) {
7987
7816
  if (maybeFn instanceof Function) {
7988
7817
  maybeFn = maybeFn();
7989
7818
  }
7990
- return normalizeSortValue(maybeFn, caseSensitive);
7819
+ return typeof maybeFn === "string" && !caseSensitive ? maybeFn.toLowerCase() : maybeFn;
7991
7820
  }
7992
7821
  function ensureClientSideSortValueIsSortable(sortOn, isHeader, column2, idx, maybeContent) {
7993
7822
  if (process.env.NODE_ENV !== "production" && !isHeader && sortOn === "client" && column2.clientSideSort !== false) {
@@ -8002,24 +7831,7 @@ function ensureClientSideSortValueIsSortable(sortOn, isHeader, column2, idx, may
8002
7831
  }
8003
7832
  function canClientSideSort(value) {
8004
7833
  const t = typeof value;
8005
- return value === null || t === "undefined" || t === "number" || t === "string" || t === "bigint" || t === "boolean" || value instanceof Date || isPlainDate2(value) || isZonedDateTime(value);
8006
- }
8007
- function normalizeSortValue(value, caseSensitive) {
8008
- if (isPlainDate2(value)) {
8009
- return value.toString();
8010
- } else if (isZonedDateTime(value)) {
8011
- return value.epochNanoseconds;
8012
- } else if (typeof value === "string" && !caseSensitive) {
8013
- return value.toLowerCase();
8014
- } else {
8015
- return value;
8016
- }
8017
- }
8018
- function isPlainDate2(value) {
8019
- return value instanceof import_temporal_polyfill2.Temporal.PlainDate;
8020
- }
8021
- function isZonedDateTime(value) {
8022
- return value instanceof import_temporal_polyfill2.Temporal.ZonedDateTime;
7834
+ return value === null || t === "undefined" || t === "number" || t === "string" || t === "boolean" || value instanceof Date;
8023
7835
  }
8024
7836
 
8025
7837
  // src/components/Table/components/Row.tsx
@@ -11295,6 +11107,7 @@ function VirtualizedOptions(props) {
11295
11107
  // eslint-disable-next-line react-hooks/exhaustive-deps
11296
11108
  [focusedItem]
11297
11109
  );
11110
+ const key = process.env.NODE_ENV === "test" ? items.length : "virtuoso";
11298
11111
  return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
11299
11112
  import_react_virtuoso.Virtuoso,
11300
11113
  {
@@ -11302,11 +11115,6 @@ function VirtualizedOptions(props) {
11302
11115
  totalListHeightChanged: onListHeightChange,
11303
11116
  totalCount: items.length,
11304
11117
  ...process.env.NODE_ENV === "test" ? {
11305
- // In tests, we render all rows so assertions can see expands/async-loaded items. However,
11306
- // the `initialItemCount` (next prop) is only applied on amount, so we set `key={items.length}`
11307
- // to force a remount when our list changes -- and we only want/need this in tests, b/c otherwise
11308
- // in production a Virtuoso remount causes visible flashing.
11309
- key: items.length,
11310
11118
  // We don't really need to set this, but it's handy for tests, which would otherwise render
11311
11119
  // just 1 row. A better way to do this would be to jest.mock out Virtuoso with an impl that
11312
11120
  // just rendered everything, but doing this for now.
@@ -11349,7 +11157,8 @@ function VirtualizedOptions(props) {
11349
11157
  components: !loading ? {} : {
11350
11158
  Footer: typeof loading === "function" ? loading : () => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(LoadingDots, { contrast })
11351
11159
  }
11352
- }
11160
+ },
11161
+ key
11353
11162
  );
11354
11163
  }
11355
11164
 
@@ -11476,7 +11285,7 @@ function ListBox(props) {
11476
11285
  boxShadow: "bshBasic h_bshHover"
11477
11286
  } : {}
11478
11287
  }), ref: listBoxRef, ...listBoxProps, children: [
11479
- 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))) }),
11480
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)(
11481
11290
  ListBoxSection,
11482
11291
  {
@@ -11627,14 +11436,15 @@ function TreeSelectFieldBase(props) {
11627
11436
  if (!maybeOption) return [];
11628
11437
  return [maybeOption.option];
11629
11438
  });
11630
- 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);
11631
11440
  return {
11632
11441
  selectedKeys: [...selectedKeys],
11633
11442
  searchValue: void 0,
11634
- 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 : "",
11635
11444
  selectedOptions,
11445
+ selectedChipOptions: selectedChipState.options,
11636
11446
  allOptions: initialOptions,
11637
- selectedOptionsLabels,
11447
+ selectedOptionsLabels: selectedChipState.labels,
11638
11448
  optionsLoading: false,
11639
11449
  allowCollapsing: true
11640
11450
  };
@@ -11733,7 +11543,9 @@ function TreeSelectFieldBase(props) {
11733
11543
  searchValue: void 0,
11734
11544
  allowCollapsing: true,
11735
11545
  selectedKeys: [],
11736
- selectedOptions: []
11546
+ selectedOptions: [],
11547
+ selectedChipOptions: [],
11548
+ selectedOptionsLabels: []
11737
11549
  }));
11738
11550
  onSelect({
11739
11551
  all: {
@@ -11800,6 +11612,7 @@ function TreeSelectFieldBase(props) {
11800
11612
  const rootValues = rootOptions.map(getOptionValue);
11801
11613
  const leafOptions = selectedOptions.filter((o) => !o.children || o.children.length === 0);
11802
11614
  const leafValues = leafOptions.map(getOptionValue);
11615
+ const selectedChipState = getSelectedChipState(fieldState.allOptions, selectedOptions, selectedKeys, chipDisplay, getOptionLabel, getOptionValue);
11803
11616
  setFieldState((prevState) => ({
11804
11617
  ...prevState,
11805
11618
  // Since we reset the list of options upon selection changes, then set the `inputValue` to empty string to reflect that.
@@ -11807,7 +11620,8 @@ function TreeSelectFieldBase(props) {
11807
11620
  searchValue: void 0,
11808
11621
  selectedKeys: [...selectedKeys],
11809
11622
  selectedOptions,
11810
- selectedOptionsLabels: chipDisplay === "root" ? rootOptions.map(getOptionLabel) : chipDisplay === "leaf" ? leafOptions.map(getOptionLabel) : selectedOptions.map(getOptionLabel)
11623
+ selectedChipOptions: selectedChipState.options,
11624
+ selectedOptionsLabels: selectedChipState.labels
11811
11625
  }));
11812
11626
  onSelect({
11813
11627
  all: {
@@ -11906,7 +11720,7 @@ function TreeSelectFieldBase(props) {
11906
11720
  onClose: () => state.toggle(),
11907
11721
  isOpen: state.isOpen,
11908
11722
  minWidth: 320,
11909
- 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 })
11910
11724
  }
11911
11725
  )
11912
11726
  ] });
@@ -11936,6 +11750,25 @@ function isOptionFullySelected(option, selectedKeys, disabledKeys, groupKeys, ge
11936
11750
  if (!option.children || option.children.length === 0) return false;
11937
11751
  return option.children.every((child) => isOptionFullySelected(child, selectedKeys, disabledKeys, groupKeys, getOptionValue));
11938
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
+ }
11939
11772
 
11940
11773
  // src/inputs/internal/ComboBoxInput.tsx
11941
11774
  var import_jsx_runtime55 = require("react/jsx-runtime");
@@ -11974,7 +11807,6 @@ function ComboBoxInput(props) {
11974
11807
  } = useTreeSelectFieldProvider();
11975
11808
  const [isFocused, setIsFocused] = (0, import_react45.useState)(false);
11976
11809
  const isMultiSelect = state.selectionManager.selectionMode === "multiple";
11977
- const showNumSelection = isMultiSelect && state.selectionManager.selectedKeys.size > 1;
11978
11810
  const showChipSelection = isMultiSelect && state.selectionManager.selectedKeys.size > 0;
11979
11811
  const showFieldDecoration = (!isMultiSelect || isMultiSelect && !isFocused) && fieldDecoration && selectedOptions.length === 1;
11980
11812
  const multilineProps = allowWrap ? {
@@ -11982,6 +11814,8 @@ function ComboBoxInput(props) {
11982
11814
  multiline: true
11983
11815
  } : {};
11984
11816
  const chipLabels = isTree ? selectedOptionsLabels || [] : selectedOptions.map((o) => getOptionLabel(o));
11817
+ const selectedChipCount = chipLabels.length;
11818
+ const showNumSelection = isMultiSelect && selectedChipCount > 1;
11985
11819
  useGrowingTextField({
11986
11820
  // This says: When using a multiselect, then only enable the growing textfield when we are focused on it.
11987
11821
  // Because otherwise, we're not displaying the input element that dictates the height (we're displaying <Chips/>). This would cause incorrect calculations
@@ -11992,7 +11826,7 @@ function ComboBoxInput(props) {
11992
11826
  });
11993
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 ? {
11994
11828
  fontWeight: "fw5"
11995
- } : 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)({
11996
11830
  ...{
11997
11831
  borderRadius: "br4",
11998
11832
  outline: "outline0",
@@ -12630,37 +12464,69 @@ function CheckboxGroupItem(props) {
12630
12464
  }
12631
12465
 
12632
12466
  // src/inputs/DateFields/DateField.mock.tsx
12467
+ var import_date_fns3 = require("date-fns");
12633
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");
12634
12500
 
12635
12501
  // src/inputs/DateFields/utils.ts
12636
- var import_temporal_polyfill3 = require("temporal-polyfill");
12502
+ var import_date_fns4 = require("date-fns");
12637
12503
  var dateFormats = {
12638
- short: "shortDate",
12639
- medium: "shortWeekdayMonthDay",
12640
- long: "longWeekdayMonthDayYear"
12504
+ short: "MM/dd/yy",
12505
+ medium: "EEE, MMM d",
12506
+ long: "EEEE LLLL d, uuuu"
12641
12507
  };
12642
- function getDateFormat(format) {
12643
- return format ? dateFormats[format] : dateFormats.short;
12508
+ function getDateFormat(format4) {
12509
+ return format4 ? dateFormats[format4] : dateFormats.short;
12644
12510
  }
12645
- function formatDate(date, format) {
12511
+ function formatDate(date, format4) {
12646
12512
  if (!date) return "";
12647
- return formatPlainDate(date, format);
12513
+ return (0, import_date_fns4.format)(date, format4);
12648
12514
  }
12649
- function formatDateRange(date, format) {
12515
+ function formatDateRange(date, format4) {
12650
12516
  if (!date) return "";
12651
12517
  const { from, to } = date;
12652
- const fromFormatted = from ? formatPlainDate(from, format) : "";
12653
- 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) : "";
12654
12520
  return !fromFormatted && !toFormatted ? void 0 : `${fromFormatted} - ${toFormatted}`;
12655
12521
  }
12656
- function parseDate(str, format) {
12657
- return parseDateString(str, format);
12522
+ function parseDate(str, format4) {
12523
+ return parseDateString(str, format4);
12658
12524
  }
12659
- function parseDateRange(str, format) {
12525
+ function parseDateRange(str, format4) {
12660
12526
  const [from = "", to = ""] = str.split("-");
12661
- const fromDate = parseDateString(from.trim(), format);
12662
- const toDate = parseDateString(to.trim(), format);
12663
- if (toDate && fromDate && import_temporal_polyfill3.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) {
12664
12530
  return { from: toDate, to: fromDate };
12665
12531
  }
12666
12532
  if (toDate === void 0 && fromDate === void 0) {
@@ -12668,81 +12534,31 @@ function parseDateRange(str, format) {
12668
12534
  }
12669
12535
  return { from: fromDate, to: toDate };
12670
12536
  }
12671
- function parseDateString(str, format) {
12672
- if (format !== dateFormats.short && format !== "date") {
12673
- return void 0;
12674
- }
12537
+ function parseDateString(str, format4) {
12675
12538
  const split = str.split("/");
12676
12539
  if (split.length !== 3) {
12677
12540
  return void 0;
12678
12541
  }
12679
- const yearLength = format === dateFormats.short ? 2 : 4;
12680
- if (split[2].length !== yearLength) {
12542
+ if (split[2].length !== 2) {
12681
12543
  return void 0;
12682
12544
  }
12683
- const month = parseInt(split[0], 10);
12545
+ const month = parseInt(split[0], 10) - 1;
12684
12546
  const day = parseInt(split[1], 10);
12685
12547
  const year = parseInt(split[2], 10);
12686
- 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) {
12687
12549
  return void 0;
12688
12550
  }
12689
- try {
12690
- return import_temporal_polyfill3.Temporal.PlainDate.from({
12691
- year: yearLength === 2 ? normalizeTwoDigitYear(year, todayPlainDate().year) : year,
12692
- month,
12693
- day
12694
- });
12695
- } catch {
12551
+ const parsed = (0, import_date_fns4.parse)(str, format4, /* @__PURE__ */ new Date());
12552
+ if (!isValidDate(parsed)) {
12696
12553
  return void 0;
12697
12554
  }
12555
+ return parsed;
12698
12556
  }
12699
12557
  function isValidDate(d) {
12700
- return d !== void 0 && isPlainDate(d);
12701
- }
12702
- function normalizeTwoDigitYear(twoDigitYear, currentYear) {
12703
- const isCommonEra = currentYear > 0;
12704
- const absCurrentYear = isCommonEra ? currentYear : 1 - currentYear;
12705
- if (absCurrentYear <= 50) {
12706
- return isCommonEra ? twoDigitYear || 100 : 1 - (twoDigitYear || 100);
12707
- }
12708
- const rangeEnd = absCurrentYear + 50;
12709
- const rangeEndCentury = Math.floor(rangeEnd / 100) * 100;
12710
- const isPreviousCentury = twoDigitYear >= rangeEnd % 100;
12711
- const normalizedYear = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0);
12712
- return isCommonEra ? normalizedYear : 1 - normalizedYear;
12713
- }
12714
-
12715
- // src/inputs/DateFields/DateField.mock.tsx
12716
- var import_jsx_runtime60 = require("react/jsx-runtime");
12717
- function DateFieldMock(props) {
12718
- const { onChange = () => {
12719
- }, errorMsg, onBlur, onFocus } = props;
12720
- const [value, setValue] = (0, import_react50.useState)(formatDate(props.value, dateFormats.short));
12721
- const tid = useTestIds(props, "date");
12722
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
12723
- "input",
12724
- {
12725
- ...tid,
12726
- "data-error": !!errorMsg,
12727
- value,
12728
- onChange: (e) => {
12729
- const { value: value2 } = e.target;
12730
- setValue(value2);
12731
- onChange(parseDate(value2, dateFormats.short));
12732
- },
12733
- onBlur: () => maybeCall(onBlur),
12734
- onFocus: () => maybeCall(onFocus),
12735
- disabled: !!props.disabled,
12736
- readOnly: !!props.readOnly,
12737
- "data-disabled-days": JSON.stringify(props.disabledDays)
12738
- }
12739
- );
12558
+ return d !== void 0 && (0, import_date_fns4.isDate)(d) && d.toString() !== "Invalid Date";
12740
12559
  }
12741
12560
 
12742
12561
  // src/inputs/DateFields/DateFieldBase.tsx
12743
- var import_react51 = require("react");
12744
- var import_react_aria31 = require("react-aria");
12745
- var import_react_stately10 = require("react-stately");
12746
12562
  var import_runtime43 = require("@homebound/truss/runtime");
12747
12563
  var import_jsx_runtime61 = require("react/jsx-runtime");
12748
12564
  function DateFieldBase(props) {
@@ -12758,7 +12574,7 @@ function DateFieldBase(props) {
12758
12574
  errorMsg,
12759
12575
  helperText,
12760
12576
  readOnly,
12761
- format = "short",
12577
+ format: format4 = "short",
12762
12578
  iconLeft = false,
12763
12579
  hideCalendarIcon = false,
12764
12580
  disabledDays,
@@ -12775,7 +12591,7 @@ function DateFieldBase(props) {
12775
12591
  const buttonRef = (0, import_react51.useRef)(null);
12776
12592
  const overlayRef = (0, import_react51.useRef)(null);
12777
12593
  const isFocused = (0, import_react51.useRef)(false);
12778
- const dateFormat = getDateFormat(format);
12594
+ const dateFormat = getDateFormat(format4);
12779
12595
  const [wipValue, setWipValue] = (0, import_react51.useState)(value);
12780
12596
  const [inputValue, setInputValue] = (0, import_react51.useState)((isRangeMode ? formatDateRange(props.value, dateFormat) : formatDate(props.value, dateFormat)) ?? "");
12781
12597
  const tid = useTestIds(props, defaultTestId(label));
@@ -12864,20 +12680,16 @@ function DateFieldBase(props) {
12864
12680
  (d) => {
12865
12681
  setWipValue(d);
12866
12682
  if (d && isParsedDateValid(d)) {
12867
- if (isRangeMode && isDateRangeValue(d)) {
12683
+ if (isRangeMode && (0, import_react_day_picker5.isDateRange)(d)) {
12868
12684
  props.onChange(d);
12869
12685
  return;
12870
12686
  }
12871
- if (!isRangeMode && !isDateRangeValue(d)) {
12687
+ if (!isRangeMode && !(0, import_react_day_picker5.isDateRange)(d)) {
12872
12688
  props.onChange(d);
12873
12689
  return;
12874
12690
  }
12875
12691
  } else {
12876
- if (isRangeMode) {
12877
- props.onChange(void 0);
12878
- } else {
12879
- props.onChange(void 0);
12880
- }
12692
+ props.onChange(void 0);
12881
12693
  return;
12882
12694
  }
12883
12695
  },
@@ -12885,7 +12697,7 @@ function DateFieldBase(props) {
12885
12697
  // eslint-disable-next-line react-hooks/exhaustive-deps
12886
12698
  [isRangeMode, props.onChange]
12887
12699
  );
12888
- 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;
12889
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: () => {
12890
12702
  setInputValue("");
12891
12703
  onChange(void 0);
@@ -12947,10 +12759,7 @@ function DateFieldBase(props) {
12947
12759
  ] });
12948
12760
  }
12949
12761
  function isParsedDateValid(d) {
12950
- return d !== void 0 && (!isDateRangeValue(d) || isValidDate(d.from) && isValidDate(d.to));
12951
- }
12952
- function isDateRangeValue(value) {
12953
- 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));
12954
12763
  }
12955
12764
 
12956
12765
  // src/utils/withTestMock.tsx
@@ -15467,7 +15276,7 @@ function useScrollStorage(tableId, enabled = true) {
15467
15276
  }
15468
15277
 
15469
15278
  // src/components/Table/hooks/useSetupColumnSizes.ts
15470
- var import_utils67 = require("@react-aria/utils");
15279
+ var import_utils66 = require("@react-aria/utils");
15471
15280
  var import_react70 = require("react");
15472
15281
 
15473
15282
  // src/components/Table/hooks/useColumnResizing.ts
@@ -15591,7 +15400,7 @@ function useSetupColumnSizes(style, columns, resizeRef, expandedColumnIds, visib
15591
15400
  // eslint-disable-next-line react-hooks/exhaustive-deps
15592
15401
  [tableWidth, setTableAndColumnWidths, setTableAndColumnWidthsDebounced]
15593
15402
  );
15594
- (0, import_utils67.useResizeObserver)({ ref: resizeRef, onResize });
15403
+ (0, import_utils66.useResizeObserver)({ ref: resizeRef, onResize });
15595
15404
  return { columnSizes, tableWidth, resizedWidths, setResizedWidth, setResizedWidths, resetColumnWidths };
15596
15405
  }
15597
15406
 
@@ -16184,7 +15993,7 @@ function ToggleChips(props) {
16184
15993
  }
16185
15994
 
16186
15995
  // src/components/Accordion.tsx
16187
- var import_utils70 = require("@react-aria/utils");
15996
+ var import_utils69 = require("@react-aria/utils");
16188
15997
  var import_react73 = require("react");
16189
15998
  var import_react_aria40 = require("react-aria");
16190
15999
  var import_runtime54 = require("@homebound/truss/runtime");
@@ -16210,7 +16019,7 @@ function Accordion(props) {
16210
16019
  xss
16211
16020
  } = props;
16212
16021
  const tid = useTestIds(props, "accordion");
16213
- const id = (0, import_utils70.useId)();
16022
+ const id = (0, import_utils69.useId)();
16214
16023
  const [expanded, setExpanded] = (0, import_react73.useState)(defaultExpanded && !disabled);
16215
16024
  const {
16216
16025
  isFocusVisible,
@@ -16232,7 +16041,7 @@ function Accordion(props) {
16232
16041
  setContentHeight(`${contentEl.scrollHeight}px`);
16233
16042
  }
16234
16043
  }, [expanded, contentEl, setContentHeight]);
16235
- (0, import_utils70.useResizeObserver)({
16044
+ (0, import_utils69.useResizeObserver)({
16236
16045
  ref: contentRef,
16237
16046
  onResize
16238
16047
  });
@@ -16523,7 +16332,7 @@ var import_react102 = require("react");
16523
16332
  var import_react_aria46 = require("react-aria");
16524
16333
 
16525
16334
  // src/components/Modal/Modal.tsx
16526
- var import_utils74 = require("@react-aria/utils");
16335
+ var import_utils73 = require("@react-aria/utils");
16527
16336
  var import_react78 = require("react");
16528
16337
  var import_react_aria41 = require("react-aria");
16529
16338
  var import_react_dom3 = require("react-dom");
@@ -16646,7 +16455,7 @@ function Modal(props) {
16646
16455
  };
16647
16456
  }
16648
16457
  const [hasScroll, setHasScroll] = (0, import_react78.useState)(forceScrolling ?? false);
16649
- (0, import_utils74.useResizeObserver)({
16458
+ (0, import_utils73.useResizeObserver)({
16650
16459
  ref: modalBodyRef,
16651
16460
  onResize: (0, import_react78.useCallback)(
16652
16461
  () => {
@@ -18286,7 +18095,7 @@ function FormHeading(props) {
18286
18095
  FormHeading.isFormHeading = true;
18287
18096
 
18288
18097
  // src/forms/StaticField.tsx
18289
- var import_utils102 = require("@react-aria/utils");
18098
+ var import_utils101 = require("@react-aria/utils");
18290
18099
  var import_runtime65 = require("@homebound/truss/runtime");
18291
18100
  var import_jsx_runtime118 = require("react/jsx-runtime");
18292
18101
  function StaticField(props) {
@@ -18300,7 +18109,7 @@ function StaticField(props) {
18300
18109
  children
18301
18110
  } = props;
18302
18111
  const tid = useTestIds(props, typeof label === "string" ? defaultTestId(label) : "staticField");
18303
- const id = (0, import_utils102.useId)();
18112
+ const id = (0, import_utils101.useId)();
18304
18113
  return /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("div", { ...(0, import_runtime65.trussProps)({
18305
18114
  ...labelStyle === "left" ? {
18306
18115
  display: "df",
@@ -18984,16 +18793,8 @@ function dateFilter(props) {
18984
18793
  }
18985
18794
  var anyOption = {};
18986
18795
  var DateFilter = class extends BaseFilter {
18987
- hydrate(value) {
18988
- if (!isDateFilterValue(value)) return void 0;
18989
- const hydratedValue = parsePersistedPlainDate(value.value);
18990
- return hydratedValue ? { op: value.op, value: hydratedValue } : void 0;
18991
- }
18992
- dehydrate(value) {
18993
- return value ? { op: value.op, value: dehydratePlainDate(value.value) } : void 0;
18994
- }
18995
18796
  render(value, setValue, tid, inModal, vertical) {
18996
- const { label, operations, getOperationValue, getOperationLabel, defaultValue } = this.props;
18797
+ const { label, operations, getOperationValue, getOperationLabel } = this.props;
18997
18798
  return /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(import_jsx_runtime127.Fragment, { children: [
18998
18799
  vertical && /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(Label, { label }),
18999
18800
  /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(CompoundField, { children: [
@@ -19010,8 +18811,8 @@ var DateFilter = class extends BaseFilter {
19010
18811
  getOptionLabel: (o) => o === anyOption ? "Any" : getOperationLabel(o),
19011
18812
  value: value?.op,
19012
18813
  onSelect: (op) => (
19013
- // default the selected date to the filter's default date or today if it doesn't exist in the filter's value
19014
- 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)
19015
18816
  ),
19016
18817
  label: inModal ? `${label} date filter operation` : label,
19017
18818
  labelStyle: !inModal && !vertical ? "inline" : inModal || vertical ? "hidden" : "above",
@@ -19023,13 +18824,9 @@ var DateFilter = class extends BaseFilter {
19023
18824
  DateField,
19024
18825
  {
19025
18826
  labelStyle: "inline",
19026
- value: value?.value ?? defaultValue?.value ?? todayPlainDate(),
18827
+ value: value?.value ? new Date(value.value) : /* @__PURE__ */ new Date(),
19027
18828
  label: "Date",
19028
- onChange: (d) => {
19029
- if (d && value) {
19030
- setValue({ ...value, value: d });
19031
- }
19032
- },
18829
+ onChange: (d) => setValue({ ...value, value: d }),
19033
18830
  disabled: !value,
19034
18831
  ...tid[`${defaultTestId(this.label)}_dateField`]
19035
18832
  }
@@ -19038,9 +18835,6 @@ var DateFilter = class extends BaseFilter {
19038
18835
  ] });
19039
18836
  }
19040
18837
  };
19041
- function isDateFilterValue(value) {
19042
- return typeof value === "object" && value !== null && "op" in value && "value" in value;
19043
- }
19044
18838
 
19045
18839
  // src/components/Filters/DateRangeFilter.tsx
19046
18840
  var import_jsx_runtime128 = require("react/jsx-runtime");
@@ -19048,17 +18842,6 @@ function dateRangeFilter(props) {
19048
18842
  return (key) => new DateRangeFilter(key, props);
19049
18843
  }
19050
18844
  var DateRangeFilter = class extends BaseFilter {
19051
- hydrate(value) {
19052
- if (!isDateRangeFilterValue(value)) return void 0;
19053
- const hydratedValue = hydrateDateRange(value.value);
19054
- return hydratedValue ? { op: value.op, value: hydratedValue } : void 0;
19055
- }
19056
- dehydrate(value) {
19057
- return value ? {
19058
- op: value.op,
19059
- value: value.value ? { from: dehydratePlainDate(value.value.from), to: dehydratePlainDate(value.value.to) } : void 0
19060
- } : void 0;
19061
- }
19062
18845
  render(value, setValue, tid, inModal, vertical) {
19063
18846
  const { label, placeholderText, disabledDays, testFieldLabel, defaultValue } = this.props;
19064
18847
  return /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)(import_jsx_runtime128.Fragment, { children: [
@@ -19070,17 +18853,8 @@ var DateRangeFilter = class extends BaseFilter {
19070
18853
  isRangeFilterField: true,
19071
18854
  placeholder: placeholderText,
19072
18855
  label: testFieldLabel ?? "Date",
19073
- value: value?.value,
19074
- onChange: (d) => {
19075
- if (!d) {
19076
- setValue(void 0);
19077
- return;
19078
- }
19079
- const op = value?.op ?? defaultValue?.op;
19080
- if (op !== void 0) {
19081
- setValue({ op, value: d });
19082
- }
19083
- },
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),
19084
18858
  disabledDays,
19085
18859
  ...tid[`${defaultTestId(this.label)}_dateField`]
19086
18860
  }
@@ -19088,17 +18862,6 @@ var DateRangeFilter = class extends BaseFilter {
19088
18862
  ] });
19089
18863
  }
19090
18864
  };
19091
- function isDateRangeFilterValue(value) {
19092
- return typeof value === "object" && value !== null && "op" in value && "value" in value;
19093
- }
19094
- function hydrateDateRange(value) {
19095
- if (typeof value !== "object" || value === null) return void 0;
19096
- const { from, to } = value;
19097
- const hydratedFrom = parsePersistedPlainDate(from);
19098
- const hydratedTo = parsePersistedPlainDate(to);
19099
- if (hydratedFrom === void 0 && hydratedTo === void 0) return void 0;
19100
- return { from: hydratedFrom, to: hydratedTo };
19101
- }
19102
18865
 
19103
18866
  // src/components/Filters/MultiFilter.tsx
19104
18867
  var import_jsx_runtime129 = require("react/jsx-runtime");
@@ -19904,10 +19667,10 @@ function useGridTableLayoutState({
19904
19667
  });
19905
19668
  (0, import_react99.useEffect)(() => {
19906
19669
  if (page.limit !== persistedPageSize) setPersistedPageSize(page.limit);
19907
- setPage((prev) => prev.offset === 0 ? prev : {
19670
+ setPage((prev) => ({
19908
19671
  ...prev,
19909
19672
  offset: 0
19910
- });
19673
+ }));
19911
19674
  }, [page.limit, persistedPageSize, setPersistedPageSize, filter, searchString]);
19912
19675
  return {
19913
19676
  filter,
@@ -20422,7 +20185,7 @@ var import_react106 = require("react");
20422
20185
  var import_react_aria49 = require("react-aria");
20423
20186
 
20424
20187
  // src/components/Tag.tsx
20425
- var import_utils119 = require("@react-aria/utils");
20188
+ var import_utils118 = require("@react-aria/utils");
20426
20189
  var import_react105 = require("react");
20427
20190
  var import_runtime78 = require("@homebound/truss/runtime");
20428
20191
  var import_jsx_runtime152 = require("react/jsx-runtime");
@@ -20438,7 +20201,7 @@ function Tag(props) {
20438
20201
  const tid = useTestIds(otherProps);
20439
20202
  const [showTooltip, setShowTooltip] = (0, import_react105.useState)(false);
20440
20203
  const ref = (0, import_react105.useRef)(null);
20441
- (0, import_utils119.useResizeObserver)({
20204
+ (0, import_utils118.useResizeObserver)({
20442
20205
  ref,
20443
20206
  onResize: () => {
20444
20207
  if (ref.current) {
@@ -21135,7 +20898,7 @@ function HbSpinnerProvider({
21135
20898
  }
21136
20899
 
21137
20900
  // src/components/MaxLines.tsx
21138
- var import_utils127 = require("@react-aria/utils");
20901
+ var import_utils126 = require("@react-aria/utils");
21139
20902
  var import_react115 = require("react");
21140
20903
  var import_runtime85 = require("@homebound/truss/runtime");
21141
20904
  var import_jsx_runtime160 = require("react/jsx-runtime");
@@ -21146,7 +20909,7 @@ function MaxLines({
21146
20909
  const elRef = (0, import_react115.useRef)(null);
21147
20910
  const [hasMore, setHasMore] = (0, import_react115.useState)(false);
21148
20911
  const [expanded, setExpanded] = (0, import_react115.useState)(false);
21149
- (0, import_utils127.useLayoutEffect)(() => {
20912
+ (0, import_utils126.useLayoutEffect)(() => {
21150
20913
  if (!elRef.current) return;
21151
20914
  setHasMore(elRef.current.scrollHeight > elRef.current.clientHeight);
21152
20915
  }, []);
@@ -21157,7 +20920,7 @@ function MaxLines({
21157
20920
  if (!elRef.current) return;
21158
20921
  !expanded && setHasMore(elRef.current.scrollHeight > elRef.current.clientHeight);
21159
20922
  }, [expanded]);
21160
- (0, import_utils127.useResizeObserver)({
20923
+ (0, import_utils126.useResizeObserver)({
21161
20924
  ref: elRef,
21162
20925
  onResize
21163
20926
  });
@@ -21178,7 +20941,7 @@ function MaxLines({
21178
20941
  }
21179
20942
 
21180
20943
  // src/components/ScrollShadows.tsx
21181
- var import_utils128 = require("@react-aria/utils");
20944
+ var import_utils127 = require("@react-aria/utils");
21182
20945
  var import_react116 = require("react");
21183
20946
  var import_runtime86 = require("@homebound/truss/runtime");
21184
20947
  var import_jsx_runtime161 = require("react/jsx-runtime");
@@ -21265,7 +21028,7 @@ function ScrollShadows(props) {
21265
21028
  setShowEndShadow(start + boxSize < end);
21266
21029
  }, [horizontal]);
21267
21030
  const onResize = (0, import_react116.useCallback)(() => scrollRef.current && updateScrollProps(scrollRef.current), [updateScrollProps]);
21268
- (0, import_utils128.useResizeObserver)({
21031
+ (0, import_utils127.useResizeObserver)({
21269
21032
  ref: scrollRef,
21270
21033
  onResize
21271
21034
  });
@@ -22302,7 +22065,6 @@ function useToast() {
22302
22065
  filterTestIdPrefix,
22303
22066
  formatDate,
22304
22067
  formatDateRange,
22305
- formatPlainDate,
22306
22068
  formatValue,
22307
22069
  generateColumnId,
22308
22070
  getAlignment,