@homebound/beam 3.1.0 → 3.2.0-alpha.1

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.js CHANGED
@@ -4902,7 +4902,7 @@ function Chips(props) {
4902
4902
  // src/components/Table/GridTable.tsx
4903
4903
  import memoizeOne from "memoize-one";
4904
4904
  import { runInAction } from "mobx";
4905
- import React13, { useEffect as useEffect19, useMemo as useMemo24, useRef as useRef38, useState as useState29 } from "react";
4905
+ import React13, { useEffect as useEffect19, useMemo as useMemo24, useRef as useRef39, useState as useState29 } from "react";
4906
4906
  import { Virtuoso as Virtuoso2 } from "react-virtuoso";
4907
4907
 
4908
4908
  // src/components/Layout/ScrollableContent.tsx
@@ -5482,27 +5482,50 @@ function useHover2(props) {
5482
5482
  }
5483
5483
 
5484
5484
  // src/hooks/usePersistedFilter.ts
5485
- import { useEffect as useEffect6, useMemo as useMemo8 } from "react";
5485
+ import { useEffect as useEffect6, useMemo as useMemo8, useRef as useRef6 } from "react";
5486
5486
  import { JsonParam, useQueryParams as useQueryParams2 } from "use-query-params";
5487
5487
  function usePersistedFilter({ storageKey, filterDefs }) {
5488
- const filterKeys = Object.keys(filterDefs);
5488
+ const filterImpls = useMemo8(
5489
+ () => Object.fromEntries(safeEntries(filterDefs).map(([key, def]) => [key, def(key)])),
5490
+ [filterDefs]
5491
+ );
5492
+ const filterKeys = useMemo8(() => Object.keys(filterImpls), [filterImpls]);
5489
5493
  const defaultFilter = useMemo8(
5490
5494
  () => Object.fromEntries(
5491
- safeEntries(filterDefs).filter(([key, def]) => def(key).defaultValue !== void 0).map(([key, def]) => [key, def(key).defaultValue])
5495
+ safeEntries(filterImpls).filter(([, def]) => def.defaultValue !== void 0).map(([key, def]) => [key, def.defaultValue])
5492
5496
  ),
5493
- [filterDefs]
5497
+ [filterImpls]
5494
5498
  );
5495
5499
  const [{ filter: queryParamsFilter }, setQueryParams] = useQueryParams2({ filter: JsonParam });
5496
- const [storedFilter, setStoredFilter] = useSessionStorage(storageKey, queryParamsFilter ?? defaultFilter);
5500
+ const [storedFilter, setStoredFilter] = useSessionStorage(
5501
+ storageKey,
5502
+ dehydrateFilter(filterImpls, defaultFilter) ?? defaultFilter
5503
+ );
5497
5504
  const isQueryParamFilterValid = hasValidFilterKeys(queryParamsFilter, filterKeys);
5498
- const filter = isQueryParamFilterValid ? queryParamsFilter : storedFilter ?? defaultFilter;
5499
- const setFilter = (filter2) => setQueryParams({ filter: filter2 });
5505
+ const serializedQueryParamsFilter = useMemo8(() => JSON.stringify(queryParamsFilter), [queryParamsFilter]);
5506
+ const serializedStoredFilter = useMemo8(() => JSON.stringify(storedFilter), [storedFilter]);
5507
+ const queryParamsFilterSnapshot = useMemo8(
5508
+ () => parseSerializedValue(serializedQueryParamsFilter),
5509
+ [serializedQueryParamsFilter]
5510
+ );
5511
+ const storedFilterSnapshot = useMemo8(() => parseSerializedValue(serializedStoredFilter), [serializedStoredFilter]);
5512
+ const hydratedQueryParamsFilter = useMemo8(
5513
+ () => isQueryParamFilterValid ? hydrateFilter(filterImpls, queryParamsFilterSnapshot) : void 0,
5514
+ [filterImpls, isQueryParamFilterValid, queryParamsFilterSnapshot]
5515
+ );
5516
+ const hydratedStoredFilter = useMemo8(
5517
+ () => hasValidFilterKeys(storedFilterSnapshot, filterKeys) ? hydrateFilter(filterImpls, storedFilterSnapshot) : void 0,
5518
+ [filterImpls, filterKeys, storedFilterSnapshot]
5519
+ );
5520
+ const rawFilter = hydratedQueryParamsFilter ?? hydratedStoredFilter ?? defaultFilter;
5521
+ const filter = useStableValue(rawFilter);
5522
+ const setFilter = (filter2) => setQueryParams({ filter: dehydrateFilter(filterImpls, filter2) });
5500
5523
  useEffect6(
5501
5524
  () => {
5502
5525
  if (queryParamsFilter === void 0) {
5503
5526
  setQueryParams({ filter: storedFilter }, "replaceIn");
5504
5527
  } else if (!isQueryParamFilterValid) {
5505
- setQueryParams({ filter: defaultFilter }, "replaceIn");
5528
+ setQueryParams({ filter: dehydrateFilter(filterImpls, defaultFilter) }, "replaceIn");
5506
5529
  } else if (JSON.stringify(queryParamsFilter) !== JSON.stringify(storedFilter)) {
5507
5530
  setStoredFilter(queryParamsFilter);
5508
5531
  }
@@ -5514,7 +5537,46 @@ function usePersistedFilter({ storageKey, filterDefs }) {
5514
5537
  return { setFilter, filter };
5515
5538
  }
5516
5539
  function hasValidFilterKeys(queryParamsFilter, definedKeys) {
5517
- return queryParamsFilter && safeKeys(queryParamsFilter).every((key) => definedKeys.includes(key));
5540
+ return !!queryParamsFilter && safeKeys(queryParamsFilter).every((key) => definedKeys.includes(key));
5541
+ }
5542
+ function hydrateFilter(filterImpls, value) {
5543
+ if (typeof value !== "object" || value === null) return void 0;
5544
+ const hydratedEntries = [];
5545
+ safeEntries(value).forEach(([key, rawValue]) => {
5546
+ const filter = filterImpls[key];
5547
+ if (!filter) return;
5548
+ const hydratedValue = filter.hydrate ? filter.hydrate(rawValue) : rawValue;
5549
+ if (hydratedValue !== void 0) {
5550
+ hydratedEntries.push([key, hydratedValue]);
5551
+ }
5552
+ });
5553
+ return Object.fromEntries(hydratedEntries);
5554
+ }
5555
+ function dehydrateFilter(filterImpls, value) {
5556
+ if (!value) return value;
5557
+ return Object.fromEntries(
5558
+ safeEntries(value).map(([key, rawValue]) => {
5559
+ const filter = filterImpls[key];
5560
+ return [
5561
+ key,
5562
+ // Let each filter own serialization so persisted state stays stable for non-plain JSON values like PlainDate.
5563
+ filter?.dehydrate ? filter.dehydrate(rawValue) : rawValue
5564
+ ];
5565
+ })
5566
+ );
5567
+ }
5568
+ function parseSerializedValue(value) {
5569
+ return value === void 0 ? void 0 : JSON.parse(value);
5570
+ }
5571
+ function useStableValue(value) {
5572
+ const stableValue = useRef6(value);
5573
+ const stableKey = useRef6(JSON.stringify(value));
5574
+ const nextKey = JSON.stringify(value);
5575
+ if (stableKey.current !== nextKey) {
5576
+ stableValue.current = value;
5577
+ stableKey.current = nextKey;
5578
+ }
5579
+ return stableValue.current;
5518
5580
  }
5519
5581
 
5520
5582
  // src/hooks/useSessionStorage.ts
@@ -5937,21 +5999,122 @@ function CollapseToggle(props) {
5937
5999
  import { useContext as useContext12 } from "react";
5938
6000
 
5939
6001
  // src/inputs/Autocomplete.tsx
5940
- import { useCallback as useCallback10, useRef as useRef23 } from "react";
6002
+ import { useCallback as useCallback10, useRef as useRef24 } from "react";
5941
6003
  import { useComboBox as useComboBox3, useOverlayPosition as useOverlayPosition5 } from "react-aria";
5942
6004
  import { Item as Item5, useComboBoxState as useComboBoxState3 } from "react-stately";
5943
6005
 
5944
6006
  // src/components/internal/DatePicker/DatePicker.tsx
5945
6007
  import { DayPicker } from "react-day-picker";
5946
6008
 
6009
+ // src/utils/plainDate.ts
6010
+ import { Temporal } from "temporal-polyfill";
6011
+ function jsDateToPlainDate(date) {
6012
+ return new Temporal.PlainDate(date.getFullYear(), date.getMonth() + 1, date.getDate());
6013
+ }
6014
+ function formatPlainDate(date, format) {
6015
+ switch (format) {
6016
+ case "shortDate":
6017
+ return date.toLocaleString("en-US", { month: "2-digit", day: "2-digit", year: "2-digit" });
6018
+ case "date":
6019
+ return date.toLocaleString("en-US", { month: "2-digit", day: "2-digit", year: "numeric" });
6020
+ case "shortWeekdayMonthDay":
6021
+ return date.toLocaleString("en-US", { weekday: "short", month: "short", day: "numeric" });
6022
+ case "longWeekdayMonthDayYear":
6023
+ return `${date.toLocaleString("en-US", { weekday: "long" })} ${date.toLocaleString("en-US", { month: "long" })} ${date.day}, ${formatYear(date.year)}`;
6024
+ case "monthYear":
6025
+ return date.toLocaleString("en-US", { month: "long", year: "numeric" });
6026
+ case "shortMonth":
6027
+ return date.toLocaleString("en-US", { month: "short" });
6028
+ case "year":
6029
+ return formatYear(date.year);
6030
+ case "weekdayInitial":
6031
+ return date.toLocaleString("en-US", { weekday: "narrow" });
6032
+ case "weekday":
6033
+ return date.toLocaleString("en-US", { weekday: "long" });
6034
+ default:
6035
+ throw new Error(`Unsupported date format: ${format}`);
6036
+ }
6037
+ }
6038
+ function todayPlainDate() {
6039
+ return Temporal.Now.plainDateISO();
6040
+ }
6041
+ function isPlainDate(value) {
6042
+ return value instanceof Temporal.PlainDate;
6043
+ }
6044
+ function parsePersistedPlainDate(value) {
6045
+ if (isPlainDate(value)) return value;
6046
+ if (value instanceof Date && !Number.isNaN(value.getTime())) {
6047
+ return jsDateToPlainDate(value);
6048
+ }
6049
+ if (typeof value !== "string") return void 0;
6050
+ try {
6051
+ if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
6052
+ return Temporal.PlainDate.from(value);
6053
+ }
6054
+ } catch {
6055
+ return void 0;
6056
+ }
6057
+ const date = new Date(value);
6058
+ return Number.isNaN(date.getTime()) ? void 0 : jsDateToPlainDate(date);
6059
+ }
6060
+ function dehydratePlainDate(value) {
6061
+ return value?.toString();
6062
+ }
6063
+ function padNumber(value, length) {
6064
+ return Math.abs(value).toString().padStart(length, "0");
6065
+ }
6066
+ function formatYear(year) {
6067
+ return `${year < 0 ? "-" : ""}${padNumber(year, 4)}`;
6068
+ }
6069
+
6070
+ // src/components/internal/DatePicker/dates.ts
6071
+ function plainDateToJsDate(date) {
6072
+ return new Date(date.year, date.month - 1, date.day, 12);
6073
+ }
6074
+ function dateRangeToJsDateRange(range) {
6075
+ if (!range) return void 0;
6076
+ return {
6077
+ from: range.from ? plainDateToJsDate(range.from) : void 0,
6078
+ to: range.to ? plainDateToJsDate(range.to) : void 0
6079
+ };
6080
+ }
6081
+ function jsDateRangeToDateRange(range) {
6082
+ if (!range) return void 0;
6083
+ return {
6084
+ from: range.from ? jsDateToPlainDate(range.from) : void 0,
6085
+ to: range.to ? jsDateToPlainDate(range.to) : void 0
6086
+ };
6087
+ }
6088
+ function dateMatcherToDayPickerMatcher(matcher) {
6089
+ if (typeof matcher === "function") {
6090
+ return function dayPickerMatcher(date) {
6091
+ return matcher(jsDateToPlainDate(date));
6092
+ };
6093
+ }
6094
+ if (Array.isArray(matcher)) {
6095
+ return matcher.map(plainDateToJsDate);
6096
+ }
6097
+ if (isPlainDate(matcher)) {
6098
+ return plainDateToJsDate(matcher);
6099
+ }
6100
+ return {
6101
+ from: matcher.from ? plainDateToJsDate(matcher.from) : void 0,
6102
+ to: matcher.to ? plainDateToJsDate(matcher.to) : void 0
6103
+ };
6104
+ }
6105
+ function dateMatchersToDayPickerMatchers(matchers) {
6106
+ if (matchers === void 0) return void 0;
6107
+ return Array.isArray(matchers) ? matchers.map(dateMatcherToDayPickerMatcher) : dateMatcherToDayPickerMatcher(matchers);
6108
+ }
6109
+
5947
6110
  // src/components/internal/DatePicker/Day.tsx
5948
- import { useRef as useRef6 } from "react";
6111
+ import { useRef as useRef7 } from "react";
5949
6112
  import { useDayRender } from "react-day-picker";
5950
6113
  import { trussProps as trussProps12, mergeProps as mergeProps3 } from "@homebound/truss/runtime";
5951
6114
  import { Fragment as Fragment5, jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
5952
6115
  function Day(props) {
5953
6116
  const tid = useTestIds(props, "datePickerDay");
5954
- const buttonRef = useRef6(null);
6117
+ const buttonRef = useRef7(null);
5955
6118
  const {
5956
6119
  isHidden,
5957
6120
  isButton,
@@ -6078,18 +6241,19 @@ var rangeBaseStyles = {
6078
6241
  };
6079
6242
 
6080
6243
  // src/components/internal/DatePicker/Header.tsx
6081
- import { addMonths, addYears, format } from "date-fns";
6244
+ import { addMonths, addYears } from "date-fns";
6082
6245
  import { useNavigation } from "react-day-picker";
6083
6246
  import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
6084
6247
  function Header(props) {
6085
6248
  const {
6086
6249
  displayMonth
6087
6250
  } = props;
6251
+ const displayMonthDate = jsDateToPlainDate(displayMonth);
6088
6252
  const {
6089
6253
  goToMonth
6090
6254
  } = useNavigation();
6091
6255
  return /* @__PURE__ */ jsxs10("div", { className: "df jcsb aic ml_12px mr_2px h_32px", children: [
6092
- /* @__PURE__ */ jsx17("h1", { className: "fw4 fz_16px lh_24px", children: format(displayMonth, "MMMM yyyy") }),
6256
+ /* @__PURE__ */ jsx17("h1", { className: "fw4 fz_16px lh_24px", children: formatPlainDate(displayMonthDate, "monthYear") }),
6093
6257
  /* @__PURE__ */ jsxs10("div", { children: [
6094
6258
  /* @__PURE__ */ jsx17(IconButton, { color: "rgba(100, 100, 100, 1)" /* Gray700 */, icon: "chevronLeft", onClick: () => goToMonth(addMonths(displayMonth, -1)) }),
6095
6259
  /* @__PURE__ */ jsx17(IconButton, { color: "rgba(100, 100, 100, 1)" /* Gray700 */, icon: "chevronRight", onClick: () => goToMonth(addMonths(displayMonth, 1)) })
@@ -6100,36 +6264,41 @@ function YearSkipHeader(props) {
6100
6264
  const {
6101
6265
  displayMonth
6102
6266
  } = props;
6267
+ const displayMonthDate = jsDateToPlainDate(displayMonth);
6103
6268
  const {
6104
6269
  goToMonth
6105
6270
  } = useNavigation();
6106
6271
  return /* @__PURE__ */ jsxs10("div", { className: "df jcsb aic ml_12px mr_12px h_32px", children: [
6107
6272
  /* @__PURE__ */ jsxs10("div", { className: "df fdr jcsb", children: [
6108
6273
  /* @__PURE__ */ jsx17(IconButton, { color: "rgba(100, 100, 100, 1)" /* Gray700 */, icon: "chevronLeft", onClick: () => goToMonth(addMonths(displayMonth, -1)) }),
6109
- /* @__PURE__ */ jsx17("h1", { className: "fw4 fz_16px lh_24px", children: format(displayMonth, "MMM") }),
6274
+ /* @__PURE__ */ jsx17("h1", { className: "fw4 fz_16px lh_24px", children: formatPlainDate(displayMonthDate, "shortMonth") }),
6110
6275
  /* @__PURE__ */ jsx17(IconButton, { color: "rgba(100, 100, 100, 1)" /* Gray700 */, icon: "chevronRight", onClick: () => goToMonth(addMonths(displayMonth, 1)) })
6111
6276
  ] }),
6112
6277
  /* @__PURE__ */ jsxs10("div", { className: "df fdr jcsb", children: [
6113
6278
  /* @__PURE__ */ jsx17(IconButton, { color: "rgba(100, 100, 100, 1)" /* Gray700 */, icon: "chevronLeft", onClick: () => goToMonth(addYears(displayMonth, -1)) }),
6114
- /* @__PURE__ */ jsx17("h1", { className: "fw4 fz_16px lh_24px", children: format(displayMonth, "yyyy") }),
6279
+ /* @__PURE__ */ jsx17("h1", { className: "fw4 fz_16px lh_24px", children: formatPlainDate(displayMonthDate, "year") }),
6115
6280
  /* @__PURE__ */ jsx17(IconButton, { color: "rgba(100, 100, 100, 1)" /* Gray700 */, icon: "chevronRight", onClick: () => goToMonth(addYears(displayMonth, 1)) })
6116
6281
  ] })
6117
6282
  ] });
6118
6283
  }
6119
6284
 
6120
6285
  // src/components/internal/DatePicker/WeekHeader.tsx
6121
- import { addDays, format as format2, startOfWeek } from "date-fns";
6122
6286
  import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
6123
6287
  function WeekHeader() {
6124
- const start = startOfWeek(/* @__PURE__ */ new Date());
6288
+ const today = todayPlainDate();
6289
+ const start = today.subtract({
6290
+ days: today.dayOfWeek % 7
6291
+ });
6125
6292
  const days = [];
6126
6293
  for (let i = 0; i < 7; i++) {
6127
- days.push(addDays(start, i));
6294
+ days.push(start.add({
6295
+ days: i
6296
+ }));
6128
6297
  }
6129
6298
  return /* @__PURE__ */ jsx18("thead", { className: "rdp-head", children: /* @__PURE__ */ jsx18("tr", { className: "rdp-head_row", children: days.map((day) => /* @__PURE__ */ jsxs11("th", { scope: "col", className: "pt1 pb_12px pr1 pl1 fw4 fz_12px lh_16px gray400", children: [
6130
- /* @__PURE__ */ jsx18("span", { "aria-hidden": "true", children: format2(day, "EEEEE") }),
6131
- /* @__PURE__ */ jsx18("span", { className: "rdp-vhidden", children: format2(day, "EEEE") })
6132
- ] }, format2(day, "EEEE"))) }) });
6299
+ /* @__PURE__ */ jsx18("span", { "aria-hidden": "true", children: formatPlainDate(day, "weekdayInitial") }),
6300
+ /* @__PURE__ */ jsx18("span", { className: "rdp-vhidden", children: formatPlainDate(day, "weekday") })
6301
+ ] }, formatPlainDate(day, "weekday"))) }) });
6133
6302
  }
6134
6303
 
6135
6304
  // src/components/internal/DatePicker/DatePicker.tsx
@@ -6151,15 +6320,15 @@ function DatePicker(props) {
6151
6320
  Head: WeekHeader,
6152
6321
  Day
6153
6322
  },
6154
- selected: value ? [value] : [],
6155
- defaultMonth: value ?? /* @__PURE__ */ new Date(),
6323
+ selected: value ? [plainDateToJsDate(value)] : [],
6324
+ defaultMonth: plainDateToJsDate(value ?? todayPlainDate()),
6156
6325
  onDayClick: (day, modifiers) => {
6157
6326
  if (modifiers.disabled) return;
6158
- onSelect(day);
6327
+ onSelect(jsDateToPlainDate(day));
6159
6328
  },
6160
- disabled: disabledDays,
6329
+ disabled: dateMatchersToDayPickerMatchers(disabledDays),
6161
6330
  modifiers: {
6162
- indicatorDot: dottedDays ?? []
6331
+ indicatorDot: dateMatchersToDayPickerMatchers(dottedDays) ?? []
6163
6332
  }
6164
6333
  }
6165
6334
  ) });
@@ -6186,21 +6355,21 @@ function DateRangePicker(props) {
6186
6355
  useYearPicker
6187
6356
  } = props;
6188
6357
  const tid = useTestIds(props, "datePicker");
6189
- return /* @__PURE__ */ jsx21("div", { className: "dib bgWhite fw4 fz_12px lh_16px", ...tid, children: /* @__PURE__ */ jsx21(DayPicker2, { mode: "range", selected: range, components: {
6358
+ return /* @__PURE__ */ jsx21("div", { className: "dib bgWhite fw4 fz_12px lh_16px", ...tid, children: /* @__PURE__ */ jsx21(DayPicker2, { mode: "range", selected: dateRangeToJsDateRange(range), components: {
6190
6359
  Caption: useYearPicker ? YearSkipHeader : Header,
6191
6360
  Head: WeekHeader,
6192
6361
  Day
6193
- }, defaultMonth: range?.to ?? /* @__PURE__ */ new Date(), onSelect: (selection, day, activeModifiers) => {
6362
+ }, defaultMonth: plainDateToJsDate(range?.to ?? range?.from ?? todayPlainDate()), onSelect: (selection, day, activeModifiers) => {
6194
6363
  if (activeModifiers.disabled) return;
6195
- onSelect(selection);
6196
- }, disabled: disabledDays, modifiers: {
6197
- indicatorDot: dottedDays ?? []
6364
+ onSelect(jsDateRangeToDateRange(selection));
6365
+ }, disabled: dateMatchersToDayPickerMatchers(disabledDays), modifiers: {
6366
+ indicatorDot: dateMatchersToDayPickerMatchers(dottedDays) ?? []
6198
6367
  } }) });
6199
6368
  }
6200
6369
 
6201
6370
  // src/components/internal/Menu.tsx
6202
6371
  import { camelCase } from "change-case";
6203
- import { useEffect as useEffect8, useMemo as useMemo9, useRef as useRef10, useState as useState11 } from "react";
6372
+ import { useEffect as useEffect8, useMemo as useMemo9, useRef as useRef11, useState as useState11 } from "react";
6204
6373
  import { FocusScope, useFilter as useFilter2, useMenu } from "react-aria";
6205
6374
  import { Item, Section, useTreeData, useTreeState } from "react-stately";
6206
6375
 
@@ -6245,7 +6414,7 @@ import { trussProps as trussProps21 } from "@homebound/truss/runtime";
6245
6414
 
6246
6415
  // src/inputs/internal/MenuSearchField.tsx
6247
6416
  import { useTextField } from "@react-aria/textfield";
6248
- import { useRef as useRef9 } from "react";
6417
+ import { useRef as useRef10 } from "react";
6249
6418
 
6250
6419
  // src/inputs/TextFieldBase.tsx
6251
6420
  import { useState as useState10 } from "react";
@@ -6344,7 +6513,7 @@ function InlineLabel({
6344
6513
 
6345
6514
  // src/components/Table/components/Row.tsx
6346
6515
  import { observer } from "mobx-react";
6347
- import React6, { useCallback as useCallback6, useContext as useContext10, useRef as useRef8 } from "react";
6516
+ import React6, { useCallback as useCallback6, useContext as useContext10, useRef as useRef9 } from "react";
6348
6517
  import { mergeProps as mergeProps5 } from "react-aria";
6349
6518
 
6350
6519
  // src/components/Table/components/cell.tsx
@@ -6410,7 +6579,7 @@ var rowClickRenderFn = (as, api, colSpan) => (key, css2, content, row, rowStyle,
6410
6579
  };
6411
6580
 
6412
6581
  // src/components/Table/components/ColumnResizeHandle.tsx
6413
- import { useCallback as useCallback5, useContext as useContext8, useEffect as useEffect7, useRef as useRef7, useState as useState9 } from "react";
6582
+ import { useCallback as useCallback5, useContext as useContext8, useEffect as useEffect7, useRef as useRef8, useState as useState9 } from "react";
6414
6583
  import { trussProps as trussProps16 } from "@homebound/truss/runtime";
6415
6584
  import { Fragment as Fragment7, jsx as jsx26, jsxs as jsxs14 } from "react/jsx-runtime";
6416
6585
  function findScrollableParent(element) {
@@ -6448,13 +6617,13 @@ function ColumnResizeHandle({
6448
6617
  const [guideLineX, setGuideLineX] = useState9(null);
6449
6618
  const [guideLineTop, setGuideLineTop] = useState9(0);
6450
6619
  const [guideLineHeight, setGuideLineHeight] = useState9(0);
6451
- const startXRef = useRef7(0);
6452
- const startWidthRef = useRef7(0);
6453
- const startHandleRightRef = useRef7(0);
6454
- const handleRef = useRef7(null);
6455
- const rafRef = useRef7(null);
6456
- const pendingMouseXRef = useRef7(null);
6457
- const scrollableParentRef = useRef7(null);
6620
+ const startXRef = useRef8(0);
6621
+ const startWidthRef = useRef8(0);
6622
+ const startHandleRightRef = useRef8(0);
6623
+ const handleRef = useRef8(null);
6624
+ const rafRef = useRef8(null);
6625
+ const pendingMouseXRef = useRef8(null);
6626
+ const scrollableParentRef = useRef8(null);
6458
6627
  const tid = useTestIds({}, "columnResizeHandle");
6459
6628
  const handleMouseDown = useCallback5((e) => {
6460
6629
  e.preventDefault();
@@ -7596,7 +7765,7 @@ function RowImpl(props) {
7596
7765
  let foundFirstContentColumn = false;
7597
7766
  let minStickyLeftOffset = 0;
7598
7767
  let expandColumnHidden = false;
7599
- const ref = useRef8(null);
7768
+ const ref = useRef9(null);
7600
7769
  const dragOverCallback = useCallback6((row2, evt) => onDragOver?.(row2, evt), [onDragOver]);
7601
7770
  const onDragOverDebounced = useDebouncedCallback2(dragOverCallback, 100);
7602
7771
  const RowContent = () => /* @__PURE__ */ jsx28(RowTag, { ...mergeProps_12(BorderHoverParent, void 0, rowCss), ...others, "data-gridrow": true, ...getCount(row.id), ref, children: isKeptGroupRow ? /* @__PURE__ */ jsx28(KeptGroupRow, { as, style, columnSizes, row, colSpan: columns.length, isLastBodyRow }) : columns.map((column2, columnIndex) => {
@@ -8362,7 +8531,7 @@ var textFieldBaseMultilineTopPadding = 11;
8362
8531
  import { jsx as jsx31 } from "react/jsx-runtime";
8363
8532
  function MenuSearchField(props) {
8364
8533
  const tid = useTestIds(props);
8365
- const inputRef = useRef9(null);
8534
+ const inputRef = useRef10(null);
8366
8535
  const { labelProps, inputProps } = useTextField({ ...props }, inputRef);
8367
8536
  return /* @__PURE__ */ jsx31(
8368
8537
  TextFieldBase,
@@ -8446,7 +8615,7 @@ function Menu(props) {
8446
8615
  keys !== "all" && onChange && onChange([...keys.values()].map((k) => k.toString())[0]);
8447
8616
  }
8448
8617
  });
8449
- const menuRef = useRef10(null);
8618
+ const menuRef = useRef11(null);
8450
8619
  const {
8451
8620
  menuProps
8452
8621
  } = useMenu({
@@ -8488,7 +8657,7 @@ function Menu(props) {
8488
8657
  }
8489
8658
 
8490
8659
  // src/components/internal/MenuItem.tsx
8491
- import { useRef as useRef13 } from "react";
8660
+ import { useRef as useRef14 } from "react";
8492
8661
  import { useHover as useHover7, useMenuItem } from "react-aria";
8493
8662
  import { useHistory } from "react-router";
8494
8663
  import { Link as Link3 } from "react-router-dom";
@@ -8743,12 +8912,12 @@ var pressedOverlayCss = {
8743
8912
  };
8744
8913
 
8745
8914
  // src/components/ButtonModal.tsx
8746
- import { useRef as useRef12 } from "react";
8915
+ import { useRef as useRef13 } from "react";
8747
8916
  import { useMenuTrigger } from "react-aria";
8748
8917
  import { useMenuTriggerState } from "react-stately";
8749
8918
 
8750
8919
  // src/components/internal/OverlayTrigger.tsx
8751
- import { useMemo as useMemo13, useRef as useRef11 } from "react";
8920
+ import { useMemo as useMemo13, useRef as useRef12 } from "react";
8752
8921
  import { useOverlayPosition } from "react-aria";
8753
8922
 
8754
8923
  // src/components/Button.tsx
@@ -9438,7 +9607,7 @@ function OverlayTrigger(props) {
9438
9607
  }
9439
9608
  }
9440
9609
  }), [menuTriggerProps, state]);
9441
- const popoverRef = useRef11(null);
9610
+ const popoverRef = useRef12(null);
9442
9611
  const {
9443
9612
  overlayProps: positionProps
9444
9613
  } = useOverlayPosition({
@@ -9500,7 +9669,7 @@ import { jsx as jsx39 } from "react/jsx-runtime";
9500
9669
  function ButtonModal(props) {
9501
9670
  const { storybookDefaultOpen, trigger, disabled, content, title } = props;
9502
9671
  const state = useMenuTriggerState({ isOpen: storybookDefaultOpen });
9503
- const buttonRef = useRef12(null);
9672
+ const buttonRef = useRef13(null);
9504
9673
  const { menuTriggerProps } = useMenuTrigger({ isDisabled: !!disabled }, state, buttonRef);
9505
9674
  const tid = useTestIds(
9506
9675
  props,
@@ -9584,7 +9753,7 @@ function MenuItemImpl(props) {
9584
9753
  const isDisabled = Boolean(disabled);
9585
9754
  const isSelected = state.selectionManager.selectedKeys.has(label);
9586
9755
  const isFocused = state.selectionManager.focusedKey === item.key;
9587
- const ref = useRef13(null);
9756
+ const ref = useRef14(null);
9588
9757
  const history = useHistory();
9589
9758
  const {
9590
9759
  hoverProps,
@@ -9731,7 +9900,7 @@ function Popover(props) {
9731
9900
  }
9732
9901
 
9733
9902
  // src/inputs/internal/ComboBoxBase.tsx
9734
- import { useCallback as useCallback9, useEffect as useEffect14, useMemo as useMemo16, useRef as useRef22, useState as useState19 } from "react";
9903
+ import { useCallback as useCallback9, useEffect as useEffect14, useMemo as useMemo16, useRef as useRef23, useState as useState19 } from "react";
9735
9904
  import { useButton as useButton7, useComboBox as useComboBox2, useFilter as useFilter4, useOverlayPosition as useOverlayPosition4 } from "react-aria";
9736
9905
  import { Item as Item4, useComboBoxState as useComboBoxState2 } from "react-stately";
9737
9906
  import { trussProps as trussProps39 } from "@homebound/truss/runtime";
@@ -9802,13 +9971,13 @@ function useGrowingTextField({ inputRef, inputWrapRef, value, disabled, maxLines
9802
9971
  }
9803
9972
 
9804
9973
  // src/inputs/TreeSelectField/TreeSelectField.tsx
9805
- import React9, { useCallback as useCallback8, useContext as useContext11, useEffect as useEffect13, useMemo as useMemo15, useRef as useRef21, useState as useState17 } from "react";
9974
+ import React9, { useCallback as useCallback8, useContext as useContext11, useEffect as useEffect13, useMemo as useMemo15, useRef as useRef22, useState as useState17 } from "react";
9806
9975
  import { useButton as useButton6, useComboBox, useFilter as useFilter3, useOverlayPosition as useOverlayPosition3 } from "react-aria";
9807
9976
  import { Item as Item3, useComboBoxState } from "react-stately";
9808
9977
  import { trussProps as trussProps37 } from "@homebound/truss/runtime";
9809
9978
 
9810
9979
  // src/inputs/internal/ListBox.tsx
9811
- import { useEffect as useEffect12, useRef as useRef20, useState as useState16 } from "react";
9980
+ import { useEffect as useEffect12, useRef as useRef21, useState as useState16 } from "react";
9812
9981
  import { useListBox } from "react-aria";
9813
9982
  import { trussProps as trussProps36 } from "@homebound/truss/runtime";
9814
9983
 
@@ -9821,17 +9990,17 @@ import { useListBoxSection, useSeparator as useSeparator2 } from "react-aria";
9821
9990
  import { trussProps as trussProps35 } from "@homebound/truss/runtime";
9822
9991
 
9823
9992
  // src/inputs/internal/Option.tsx
9824
- import { useRef as useRef16 } from "react";
9993
+ import { useRef as useRef17 } from "react";
9825
9994
  import { mergeProps as mergeProps12, useHover as useHover8, useOption } from "react-aria";
9826
9995
 
9827
9996
  // src/inputs/ChipSelectField.tsx
9828
9997
  import { camelCase as camelCase2 } from "change-case";
9829
- import { useEffect as useEffect10, useMemo as useMemo14, useRef as useRef15, useState as useState15 } from "react";
9998
+ import { useEffect as useEffect10, useMemo as useMemo14, useRef as useRef16, useState as useState15 } from "react";
9830
9999
  import { mergeProps as mergeProps11, useButton as useButton5, useFocus as useFocus2, useOverlayPosition as useOverlayPosition2, useSelect } from "react-aria";
9831
10000
  import { Item as Item2, Section as Section2, useListData, useSelectState } from "react-stately";
9832
10001
 
9833
10002
  // src/inputs/ChipTextField.tsx
9834
- import { useEffect as useEffect9, useRef as useRef14, useState as useState14 } from "react";
10003
+ import { useEffect as useEffect9, useRef as useRef15, useState as useState14 } from "react";
9835
10004
  import { useFocus } from "react-aria";
9836
10005
  import { trussProps as trussProps28 } from "@homebound/truss/runtime";
9837
10006
  import { jsx as jsx43 } from "react/jsx-runtime";
@@ -9850,7 +10019,7 @@ function ChipTextField(props) {
9850
10019
  const {
9851
10020
  fieldProps
9852
10021
  } = usePresentationContext();
9853
- const valueRef = useRef14(value);
10022
+ const valueRef = useRef15(value);
9854
10023
  const tid = useTestIds(props, "chipField");
9855
10024
  const [isFocused, setIsFocused] = useState14(false);
9856
10025
  const {
@@ -9871,7 +10040,7 @@ function ChipTextField(props) {
9871
10040
  onBlur: () => maybeCall(onBlur),
9872
10041
  onFocusChange: setIsFocused
9873
10042
  });
9874
- const fieldRef = useRef14(null);
10043
+ const fieldRef = useRef15(null);
9875
10044
  useEffect9(
9876
10045
  () => {
9877
10046
  autoFocus && fieldRef.current?.focus();
@@ -9978,7 +10147,7 @@ function defaultOptionLabel(opt) {
9978
10147
  import { trussProps as trussProps30 } from "@homebound/truss/runtime";
9979
10148
  import { Fragment as Fragment15, jsx as jsx45, jsxs as jsxs29 } from "react/jsx-runtime";
9980
10149
  function ChipSelectField(props) {
9981
- const firstRender = useRef15(true);
10150
+ const firstRender = useRef16(true);
9982
10151
  const {
9983
10152
  fieldProps
9984
10153
  } = usePresentationContext();
@@ -10036,10 +10205,10 @@ function ChipSelectField(props) {
10036
10205
  } = useFocus2({
10037
10206
  onFocusChange: setIsClearFocused
10038
10207
  });
10039
- const buttonRef = useRef15(null);
10040
- const popoverRef = useRef15(null);
10041
- const listBoxRef = useRef15(null);
10042
- const wrapperRef = useRef15(null);
10208
+ const buttonRef = useRef16(null);
10209
+ const popoverRef = useRef16(null);
10210
+ const listBoxRef = useRef16(null);
10211
+ const wrapperRef = useRef16(null);
10043
10212
  const listData = useListData({
10044
10213
  initialItems: !onCreateNew ? options : [{
10045
10214
  title: "Options",
@@ -10243,7 +10412,7 @@ function Option(props) {
10243
10412
  scrollToIndex,
10244
10413
  disabledReason
10245
10414
  } = props;
10246
- const ref = useRef16(null);
10415
+ const ref = useRef17(null);
10247
10416
  const {
10248
10417
  hoverProps,
10249
10418
  isHovered
@@ -10322,7 +10491,7 @@ function Option(props) {
10322
10491
 
10323
10492
  // src/inputs/internal/VirtualizedOptions.tsx
10324
10493
  import { getInteractionModality } from "@react-aria/interactions";
10325
- import { useEffect as useEffect11, useRef as useRef19 } from "react";
10494
+ import { useEffect as useEffect11, useRef as useRef20 } from "react";
10326
10495
  import { Virtuoso } from "react-virtuoso";
10327
10496
 
10328
10497
  // src/inputs/internal/LoadingDots.tsx
@@ -10370,11 +10539,11 @@ function LoadingDots({
10370
10539
  }
10371
10540
 
10372
10541
  // src/inputs/TreeSelectField/TreeOption.tsx
10373
- import { useRef as useRef18 } from "react";
10542
+ import { useRef as useRef19 } from "react";
10374
10543
  import { useHover as useHover10, useOption as useOption2 } from "react-aria";
10375
10544
 
10376
10545
  // src/inputs/CheckboxBase.tsx
10377
- import { useRef as useRef17 } from "react";
10546
+ import { useRef as useRef18 } from "react";
10378
10547
  import { mergeProps as mergeProps13, useFocusRing as useFocusRing5, useHover as useHover9, VisuallyHidden as VisuallyHidden3 } from "react-aria";
10379
10548
  import { trussProps as trussProps33 } from "@homebound/truss/runtime";
10380
10549
  import { jsx as jsx48, jsxs as jsxs32 } from "react/jsx-runtime";
@@ -10393,7 +10562,7 @@ function CheckboxBase(props) {
10393
10562
  tooltip,
10394
10563
  fullWidth = false
10395
10564
  } = props;
10396
- const ref = useRef17(null);
10565
+ const ref = useRef18(null);
10397
10566
  const {
10398
10567
  isFocusVisible,
10399
10568
  focusProps
@@ -10538,7 +10707,7 @@ function TreeOption(props) {
10538
10707
  const leveledOption = item.value;
10539
10708
  if (!leveledOption) return null;
10540
10709
  const [option, level] = leveledOption;
10541
- const ref = useRef18(null);
10710
+ const ref = useRef19(null);
10542
10711
  const {
10543
10712
  hoverProps,
10544
10713
  isHovered
@@ -10688,7 +10857,7 @@ function VirtualizedOptions(props) {
10688
10857
  isTree,
10689
10858
  allowCollapsing
10690
10859
  } = props;
10691
- const virtuosoRef = useRef19(null);
10860
+ const virtuosoRef = useRef20(null);
10692
10861
  const focusedKey = state.selectionManager.focusedKey;
10693
10862
  const focusedItem = focusedKey != null ? state.collection.getItem(focusedKey) : null;
10694
10863
  const selectedItem = state.selectionManager.selectedKeys.size > 0 ? state.collection.getItem([...state.selectionManager.selectedKeys.values()][0]) : void 0;
@@ -10846,9 +11015,9 @@ function ListBox(props) {
10846
11015
  const isMultiSelect = state.selectionManager.selectionMode === "multiple";
10847
11016
  const firstItem = state.collection.at(0);
10848
11017
  const hasSections = firstItem && firstItem.type === "section";
10849
- const selectedList = useRef20(null);
10850
- const firstRender = useRef20(true);
10851
- const virtuosoListHeight = useRef20(0);
11018
+ const selectedList = useRef21(null);
11019
+ const firstRender = useRef21(true);
11020
+ const virtuosoListHeight = useRef21(0);
10852
11021
  const onListHeightChange = (listHeight) => {
10853
11022
  virtuosoListHeight.current = listHeight;
10854
11023
  const height = (selectedList.current?.offsetHeight || 0) + listHeight;
@@ -11090,7 +11259,7 @@ function TreeSelectFieldBase(props) {
11090
11259
  }));
11091
11260
  }
11092
11261
  }, []);
11093
- const firstOpen = useRef21(true);
11262
+ const firstOpen = useRef22(true);
11094
11263
  function onOpenChange(isOpen) {
11095
11264
  if (firstOpen.current && isOpen) {
11096
11265
  maybeInitLoad(options, setFieldState);
@@ -11247,12 +11416,12 @@ function TreeSelectFieldBase(props) {
11247
11416
  }));
11248
11417
  }
11249
11418
  }
11250
- const comboBoxRef = useRef21(null);
11251
- const triggerRef = useRef21(null);
11252
- const inputRef = useRef21(null);
11253
- const inputWrapRef = useRef21(null);
11254
- const listBoxRef = useRef21(null);
11255
- const popoverRef = useRef21(null);
11419
+ const comboBoxRef = useRef22(null);
11420
+ const triggerRef = useRef22(null);
11421
+ const inputRef = useRef22(null);
11422
+ const inputWrapRef = useRef22(null);
11423
+ const listBoxRef = useRef22(null);
11424
+ const popoverRef = useRef22(null);
11256
11425
  const {
11257
11426
  buttonProps: triggerProps,
11258
11427
  inputProps,
@@ -11603,7 +11772,7 @@ function ComboBoxBase(props) {
11603
11772
  }));
11604
11773
  }
11605
11774
  }
11606
- const firstOpen = useRef22(true);
11775
+ const firstOpen = useRef23(true);
11607
11776
  function onOpenChange(isOpen) {
11608
11777
  if (firstOpen.current && isOpen) {
11609
11778
  maybeInitLoad();
@@ -11616,12 +11785,12 @@ function ComboBoxBase(props) {
11616
11785
  }));
11617
11786
  }
11618
11787
  }
11619
- const comboBoxRef = useRef22(null);
11620
- const triggerRef = useRef22(null);
11621
- const inputRef = useRef22(null);
11622
- const inputWrapRef = useRef22(null);
11623
- const listBoxRef = useRef22(null);
11624
- const popoverRef = useRef22(null);
11788
+ const comboBoxRef = useRef23(null);
11789
+ const triggerRef = useRef23(null);
11790
+ const inputRef = useRef23(null);
11791
+ const inputWrapRef = useRef23(null);
11792
+ const listBoxRef = useRef23(null);
11793
+ const popoverRef = useRef23(null);
11625
11794
  const disabledOptionsWithReasons = Object.fromEntries(disabledOptions?.map(disabledOptionToKeyedTuple) ?? []);
11626
11795
  const comboBoxChildren = useCallback9((item) => /* @__PURE__ */ jsx56(Item4, { textValue: getOptionLabel(item), children: getOptionMenuLabel(item) }, valueToKey(getOptionValue(item))), [getOptionValue, getOptionLabel, getOptionMenuLabel]);
11627
11796
  const selectedKeys = useMemo16(() => {
@@ -11855,10 +12024,10 @@ function Autocomplete(props) {
11855
12024
  ...others
11856
12025
  };
11857
12026
  const state = useComboBoxState3(comboBoxProps);
11858
- const inputWrapRef = useRef23(null);
11859
- const inputRef = useRef23(null);
11860
- const listBoxRef = useRef23(null);
11861
- const popoverRef = useRef23(null);
12027
+ const inputWrapRef = useRef24(null);
12028
+ const inputRef = useRef24(null);
12029
+ const listBoxRef = useRef24(null);
12030
+ const popoverRef = useRef24(null);
11862
12031
  const { inputProps, listBoxProps, labelProps } = useComboBox3(
11863
12032
  {
11864
12033
  ...comboBoxProps,
@@ -11925,7 +12094,7 @@ function Autocomplete(props) {
11925
12094
  }
11926
12095
 
11927
12096
  // src/inputs/Checkbox.tsx
11928
- import { useRef as useRef24 } from "react";
12097
+ import { useRef as useRef25 } from "react";
11929
12098
  import { useCheckbox } from "react-aria";
11930
12099
  import { useToggleState } from "react-stately";
11931
12100
  import { jsx as jsx58 } from "react/jsx-runtime";
@@ -11935,7 +12104,7 @@ function Checkbox(props) {
11935
12104
  const isIndeterminate = selected === "indeterminate";
11936
12105
  const ariaProps = { isSelected, isDisabled: !!disabled, isIndeterminate, ...otherProps };
11937
12106
  const checkboxProps = { ...ariaProps, "aria-label": label };
11938
- const ref = useRef24(null);
12107
+ const ref = useRef25(null);
11939
12108
  const toggleState = useToggleState(ariaProps);
11940
12109
  const { inputProps } = useCheckbox(checkboxProps, toggleState, ref);
11941
12110
  return /* @__PURE__ */ jsx58(
@@ -11954,7 +12123,7 @@ function Checkbox(props) {
11954
12123
  }
11955
12124
 
11956
12125
  // src/inputs/CheckboxGroup.tsx
11957
- import { useRef as useRef25 } from "react";
12126
+ import { useRef as useRef26 } from "react";
11958
12127
  import { useCheckboxGroup, useCheckboxGroupItem } from "react-aria";
11959
12128
  import { useCheckboxGroupState } from "react-stately";
11960
12129
  import { trussProps as trussProps40 } from "@homebound/truss/runtime";
@@ -12029,7 +12198,7 @@ function CheckboxGroupItem(props) {
12029
12198
  ...ariaProps,
12030
12199
  "aria-label": label
12031
12200
  };
12032
- const ref = useRef25(null);
12201
+ const ref = useRef26(null);
12033
12202
  const {
12034
12203
  inputProps
12035
12204
  } = useCheckboxGroupItem(checkboxProps, groupState, ref);
@@ -12037,69 +12206,37 @@ function CheckboxGroupItem(props) {
12037
12206
  }
12038
12207
 
12039
12208
  // src/inputs/DateFields/DateField.mock.tsx
12040
- import { format as format3, parse } from "date-fns";
12041
12209
  import { useState as useState20 } from "react";
12042
- import { jsx as jsx60 } from "react/jsx-runtime";
12043
- function DateFieldMock(props) {
12044
- const { onChange = () => {
12045
- }, errorMsg, onBlur, onFocus } = props;
12046
- const [value, setValue] = useState20(props.value ? format3(props.value, "MM/dd/yy") : "");
12047
- const tid = useTestIds(props, "date");
12048
- return /* @__PURE__ */ jsx60(
12049
- "input",
12050
- {
12051
- ...tid,
12052
- "data-error": !!errorMsg,
12053
- value,
12054
- onChange: (e) => {
12055
- const { value: value2 } = e.target;
12056
- setValue(value2);
12057
- onChange(parse(value2, "MM/dd/yy", /* @__PURE__ */ new Date()));
12058
- },
12059
- onBlur: () => maybeCall(onBlur),
12060
- onFocus: () => maybeCall(onFocus),
12061
- disabled: !!props.disabled,
12062
- readOnly: !!props.readOnly,
12063
- "data-disabled-days": JSON.stringify(props.disabledDays)
12064
- }
12065
- );
12066
- }
12067
-
12068
- // src/inputs/DateFields/DateFieldBase.tsx
12069
- import { useCallback as useCallback11, useEffect as useEffect15, useRef as useRef26, useState as useState21 } from "react";
12070
- import { FocusScope as FocusScope3, useButton as useButton8, useOverlayPosition as useOverlayPosition6, useOverlayTrigger, useTextField as useTextField2 } from "react-aria";
12071
- import { isDateRange } from "react-day-picker";
12072
- import { useOverlayTriggerState } from "react-stately";
12073
12210
 
12074
12211
  // src/inputs/DateFields/utils.ts
12075
- import { format as dateFnsFormat, parse as dateFnsParse, isDate } from "date-fns";
12212
+ import { Temporal as Temporal2 } from "temporal-polyfill";
12076
12213
  var dateFormats = {
12077
- short: "MM/dd/yy",
12078
- medium: "EEE, MMM d",
12079
- long: "EEEE LLLL d, uuuu"
12214
+ short: "shortDate",
12215
+ medium: "shortWeekdayMonthDay",
12216
+ long: "longWeekdayMonthDayYear"
12080
12217
  };
12081
- function getDateFormat(format4) {
12082
- return format4 ? dateFormats[format4] : dateFormats.short;
12218
+ function getDateFormat(format) {
12219
+ return format ? dateFormats[format] : dateFormats.short;
12083
12220
  }
12084
- function formatDate(date, format4) {
12221
+ function formatDate(date, format) {
12085
12222
  if (!date) return "";
12086
- return dateFnsFormat(date, format4);
12223
+ return formatPlainDate(date, format);
12087
12224
  }
12088
- function formatDateRange(date, format4) {
12225
+ function formatDateRange(date, format) {
12089
12226
  if (!date) return "";
12090
12227
  const { from, to } = date;
12091
- const fromFormatted = from ? dateFnsFormat(from, format4) : "";
12092
- const toFormatted = to ? dateFnsFormat(to, format4) : "";
12228
+ const fromFormatted = from ? formatPlainDate(from, format) : "";
12229
+ const toFormatted = to ? formatPlainDate(to, format) : "";
12093
12230
  return !fromFormatted && !toFormatted ? void 0 : `${fromFormatted} - ${toFormatted}`;
12094
12231
  }
12095
- function parseDate(str, format4) {
12096
- return parseDateString(str, format4);
12232
+ function parseDate(str, format) {
12233
+ return parseDateString(str, format);
12097
12234
  }
12098
- function parseDateRange(str, format4) {
12235
+ function parseDateRange(str, format) {
12099
12236
  const [from = "", to = ""] = str.split("-");
12100
- const fromDate = parseDateString(from.trim(), format4);
12101
- const toDate = parseDateString(to.trim(), format4);
12102
- if (toDate && fromDate && toDate < fromDate) {
12237
+ const fromDate = parseDateString(from.trim(), format);
12238
+ const toDate = parseDateString(to.trim(), format);
12239
+ if (toDate && fromDate && Temporal2.PlainDate.compare(toDate, fromDate) < 0) {
12103
12240
  return { from: toDate, to: fromDate };
12104
12241
  }
12105
12242
  if (toDate === void 0 && fromDate === void 0) {
@@ -12107,31 +12244,81 @@ function parseDateRange(str, format4) {
12107
12244
  }
12108
12245
  return { from: fromDate, to: toDate };
12109
12246
  }
12110
- function parseDateString(str, format4) {
12247
+ function parseDateString(str, format) {
12248
+ if (format !== dateFormats.short && format !== "date") {
12249
+ return void 0;
12250
+ }
12111
12251
  const split = str.split("/");
12112
12252
  if (split.length !== 3) {
12113
12253
  return void 0;
12114
12254
  }
12115
- if (split[2].length !== 2) {
12255
+ const yearLength = format === dateFormats.short ? 2 : 4;
12256
+ if (split[2].length !== yearLength) {
12116
12257
  return void 0;
12117
12258
  }
12118
- const month = parseInt(split[0], 10) - 1;
12259
+ const month = parseInt(split[0], 10);
12119
12260
  const day = parseInt(split[1], 10);
12120
12261
  const year = parseInt(split[2], 10);
12121
- if (isNaN(year) || String(year).length > 4 || isNaN(month) || isNaN(day) || day <= 0 || day > 31 || month < 0 || month >= 12) {
12262
+ if (Number.isNaN(year) || Number.isNaN(month) || Number.isNaN(day) || day <= 0 || day > 31 || month <= 0 || month > 12) {
12122
12263
  return void 0;
12123
12264
  }
12124
- const parsed = dateFnsParse(str, format4, /* @__PURE__ */ new Date());
12125
- if (!isValidDate(parsed)) {
12265
+ try {
12266
+ return Temporal2.PlainDate.from({
12267
+ year: yearLength === 2 ? normalizeTwoDigitYear(year, todayPlainDate().year) : year,
12268
+ month,
12269
+ day
12270
+ });
12271
+ } catch {
12126
12272
  return void 0;
12127
12273
  }
12128
- return parsed;
12129
12274
  }
12130
12275
  function isValidDate(d) {
12131
- return d !== void 0 && isDate(d) && d.toString() !== "Invalid Date";
12276
+ return d !== void 0 && isPlainDate(d);
12277
+ }
12278
+ function normalizeTwoDigitYear(twoDigitYear, currentYear) {
12279
+ const isCommonEra = currentYear > 0;
12280
+ const absCurrentYear = isCommonEra ? currentYear : 1 - currentYear;
12281
+ if (absCurrentYear <= 50) {
12282
+ return isCommonEra ? twoDigitYear || 100 : 1 - (twoDigitYear || 100);
12283
+ }
12284
+ const rangeEnd = absCurrentYear + 50;
12285
+ const rangeEndCentury = Math.floor(rangeEnd / 100) * 100;
12286
+ const isPreviousCentury = twoDigitYear >= rangeEnd % 100;
12287
+ const normalizedYear = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0);
12288
+ return isCommonEra ? normalizedYear : 1 - normalizedYear;
12289
+ }
12290
+
12291
+ // src/inputs/DateFields/DateField.mock.tsx
12292
+ import { jsx as jsx60 } from "react/jsx-runtime";
12293
+ function DateFieldMock(props) {
12294
+ const { onChange = () => {
12295
+ }, errorMsg, onBlur, onFocus } = props;
12296
+ const [value, setValue] = useState20(formatDate(props.value, dateFormats.short));
12297
+ const tid = useTestIds(props, "date");
12298
+ return /* @__PURE__ */ jsx60(
12299
+ "input",
12300
+ {
12301
+ ...tid,
12302
+ "data-error": !!errorMsg,
12303
+ value,
12304
+ onChange: (e) => {
12305
+ const { value: value2 } = e.target;
12306
+ setValue(value2);
12307
+ onChange(parseDate(value2, dateFormats.short));
12308
+ },
12309
+ onBlur: () => maybeCall(onBlur),
12310
+ onFocus: () => maybeCall(onFocus),
12311
+ disabled: !!props.disabled,
12312
+ readOnly: !!props.readOnly,
12313
+ "data-disabled-days": JSON.stringify(props.disabledDays)
12314
+ }
12315
+ );
12132
12316
  }
12133
12317
 
12134
12318
  // src/inputs/DateFields/DateFieldBase.tsx
12319
+ import { useCallback as useCallback11, useEffect as useEffect15, useRef as useRef27, useState as useState21 } from "react";
12320
+ import { FocusScope as FocusScope3, useButton as useButton8, useOverlayPosition as useOverlayPosition6, useOverlayTrigger, useTextField as useTextField2 } from "react-aria";
12321
+ import { useOverlayTriggerState } from "react-stately";
12135
12322
  import { trussProps as trussProps41 } from "@homebound/truss/runtime";
12136
12323
  import { Fragment as Fragment18, jsx as jsx61, jsxs as jsxs40 } from "react/jsx-runtime";
12137
12324
  function DateFieldBase(props) {
@@ -12147,7 +12334,7 @@ function DateFieldBase(props) {
12147
12334
  errorMsg,
12148
12335
  helperText,
12149
12336
  readOnly,
12150
- format: format4 = "short",
12337
+ format = "short",
12151
12338
  iconLeft = false,
12152
12339
  hideCalendarIcon = false,
12153
12340
  disabledDays,
@@ -12159,12 +12346,12 @@ function DateFieldBase(props) {
12159
12346
  ...others
12160
12347
  } = props;
12161
12348
  const isRangeMode = mode === "range";
12162
- const inputRef = useRef26(null);
12163
- const inputWrapRef = useRef26(null);
12164
- const buttonRef = useRef26(null);
12165
- const overlayRef = useRef26(null);
12166
- const isFocused = useRef26(false);
12167
- const dateFormat = getDateFormat(format4);
12349
+ const inputRef = useRef27(null);
12350
+ const inputWrapRef = useRef27(null);
12351
+ const buttonRef = useRef27(null);
12352
+ const overlayRef = useRef27(null);
12353
+ const isFocused = useRef27(false);
12354
+ const dateFormat = getDateFormat(format);
12168
12355
  const [wipValue, setWipValue] = useState21(value);
12169
12356
  const [inputValue, setInputValue] = useState21((isRangeMode ? formatDateRange(props.value, dateFormat) : formatDate(props.value, dateFormat)) ?? "");
12170
12357
  const tid = useTestIds(props, defaultTestId(label));
@@ -12253,16 +12440,20 @@ function DateFieldBase(props) {
12253
12440
  (d) => {
12254
12441
  setWipValue(d);
12255
12442
  if (d && isParsedDateValid(d)) {
12256
- if (isRangeMode && isDateRange(d)) {
12443
+ if (isRangeMode && isDateRangeValue(d)) {
12257
12444
  props.onChange(d);
12258
12445
  return;
12259
12446
  }
12260
- if (!isRangeMode && !isDateRange(d)) {
12447
+ if (!isRangeMode && !isDateRangeValue(d)) {
12261
12448
  props.onChange(d);
12262
12449
  return;
12263
12450
  }
12264
12451
  } else {
12265
- props.onChange(void 0);
12452
+ if (isRangeMode) {
12453
+ props.onChange(void 0);
12454
+ } else {
12455
+ props.onChange(void 0);
12456
+ }
12266
12457
  return;
12267
12458
  }
12268
12459
  },
@@ -12270,7 +12461,7 @@ function DateFieldBase(props) {
12270
12461
  // eslint-disable-next-line react-hooks/exhaustive-deps
12271
12462
  [isRangeMode, props.onChange]
12272
12463
  );
12273
- const inputSize = !isRangeMode ? format4 === "short" ? 8 : format4 === "medium" ? 10 : void 0 : void 0;
12464
+ const inputSize = !isRangeMode ? format === "short" ? 8 : format === "medium" ? 10 : void 0 : void 0;
12274
12465
  const clearButton = /* @__PURE__ */ jsx61(Fragment18, { children: inputValue !== "" && !state.isOpen && /* @__PURE__ */ jsx61(IconButton, { icon: "xCircle", color: "rgba(100, 100, 100, 1)" /* Gray700 */, onClick: () => {
12275
12466
  setInputValue("");
12276
12467
  onChange(void 0);
@@ -12332,7 +12523,10 @@ function DateFieldBase(props) {
12332
12523
  ] });
12333
12524
  }
12334
12525
  function isParsedDateValid(d) {
12335
- return d !== void 0 && (!isDateRange(d) || isDateRange(d) && isValidDate(d.from) && isValidDate(d.to));
12526
+ return d !== void 0 && (!isDateRangeValue(d) || isValidDate(d.from) && isValidDate(d.to));
12527
+ }
12528
+ function isDateRangeValue(value) {
12529
+ return typeof value === "object" && value !== null && ("from" in value || "to" in value);
12336
12530
  }
12337
12531
 
12338
12532
  // src/utils/withTestMock.tsx
@@ -12519,7 +12713,7 @@ function MultiSelectField(props) {
12519
12713
 
12520
12714
  // src/inputs/NumberField.tsx
12521
12715
  import { NumberParser } from "@internationalized/number";
12522
- import { useMemo as useMemo18, useRef as useRef27, useState as useState23 } from "react";
12716
+ import { useMemo as useMemo18, useRef as useRef28, useState as useState23 } from "react";
12523
12717
  import { mergeProps as mergeProps15, useLocale, useNumberField } from "react-aria";
12524
12718
  import { useNumberFieldState } from "react-stately";
12525
12719
  import { jsx as jsx68 } from "react/jsx-runtime";
@@ -12606,11 +12800,11 @@ function NumberField(props) {
12606
12800
  };
12607
12801
  }, [type, numberFormatOptions, defaultFormatOptions, numFractionDigits]);
12608
12802
  const numberParser = useMemo18(() => new NumberParser(locale, formatOptions), [locale, formatOptions]);
12609
- const valueRef = useRef27({
12803
+ const valueRef = useRef28({
12610
12804
  wip: false
12611
12805
  });
12612
- const lastSentRef = useRef27(void 0);
12613
- const focusValueRef = useRef27(void 0);
12806
+ const lastSentRef = useRef28(void 0);
12807
+ const focusValueRef = useRef28(void 0);
12614
12808
  const [, forceRender] = useState23(0);
12615
12809
  const propValue = value === void 0 ? Number.NaN : value / factor;
12616
12810
  if (valueRef.current.wip && !Object.is(valueRef.current.value, propValue)) {
@@ -12658,7 +12852,7 @@ function NumberField(props) {
12658
12852
  ...otherProps
12659
12853
  };
12660
12854
  const state = useNumberFieldState(useProps);
12661
- const inputRef = useRef27(null);
12855
+ const inputRef = useRef28(null);
12662
12856
  const {
12663
12857
  labelProps,
12664
12858
  inputProps,
@@ -12710,7 +12904,7 @@ function formatValue(value, factor, numFractionDigits, numIntegerDigits, positiv
12710
12904
  }
12711
12905
 
12712
12906
  // src/inputs/RadioGroupField.tsx
12713
- import { Fragment as Fragment19, useMemo as useMemo19, useRef as useRef28 } from "react";
12907
+ import { Fragment as Fragment19, useMemo as useMemo19, useRef as useRef29 } from "react";
12714
12908
  import { useFocusRing as useFocusRing6, useHover as useHover12, useRadio, useRadioGroup } from "react-aria";
12715
12909
  import { useRadioGroupState } from "react-stately";
12716
12910
  import { trussProps as trussProps44 } from "@homebound/truss/runtime";
@@ -12786,7 +12980,7 @@ function Radio(props) {
12786
12980
  } = props;
12787
12981
  const labelId = `${parentId}-${value}-label`;
12788
12982
  const descriptionId = `${parentId}-${value}-description`;
12789
- const ref = useRef28(null);
12983
+ const ref = useRef29(null);
12790
12984
  const {
12791
12985
  inputProps,
12792
12986
  isDisabled
@@ -12956,7 +13150,7 @@ var radioDisabled = {
12956
13150
 
12957
13151
  // src/inputs/RichTextField.tsx
12958
13152
  import DOMPurify from "dompurify";
12959
- import { createElement, useEffect as useEffect16, useMemo as useMemo20, useRef as useRef29, useState as useState25 } from "react";
13153
+ import { createElement, useEffect as useEffect16, useMemo as useMemo20, useRef as useRef30, useState as useState25 } from "react";
12960
13154
 
12961
13155
  // src/inputs/RichTextField.mock.tsx
12962
13156
  import { camelCase as camelCase3 } from "change-case";
@@ -13012,13 +13206,13 @@ function RichTextFieldImpl(props) {
13012
13206
  fullWidth = fieldProps?.fullWidth ?? false
13013
13207
  } = props;
13014
13208
  const [editor, setEditor] = useState25();
13015
- const editorElement = useRef29();
13016
- const currentHtml = useRef29(void 0);
13017
- const onChangeRef = useRef29(onChange);
13209
+ const editorElement = useRef30();
13210
+ const currentHtml = useRef30(void 0);
13211
+ const onChangeRef = useRef30(onChange);
13018
13212
  onChangeRef.current = onChange;
13019
- const onBlurRef = useRef29(onBlur);
13213
+ const onBlurRef = useRef30(onBlur);
13020
13214
  onBlurRef.current = onBlur;
13021
- const onFocusRef = useRef29(onFocus);
13215
+ const onFocusRef = useRef30(onFocus);
13022
13216
  onFocusRef.current = onFocus;
13023
13217
  const id = useMemo20(() => {
13024
13218
  if (readOnly) return;
@@ -13169,7 +13363,7 @@ function SelectField(props) {
13169
13363
  }
13170
13364
 
13171
13365
  // src/inputs/Switch.tsx
13172
- import { useRef as useRef30 } from "react";
13366
+ import { useRef as useRef31 } from "react";
13173
13367
  import { useFocusRing as useFocusRing7, useHover as useHover13, useSwitch, VisuallyHidden as VisuallyHidden5 } from "react-aria";
13174
13368
  import { trussProps as trussProps46 } from "@homebound/truss/runtime";
13175
13369
  import { jsx as jsx73, jsxs as jsxs45 } from "react/jsx-runtime";
@@ -13202,7 +13396,7 @@ function Switch(props) {
13202
13396
  ...otherProps
13203
13397
  };
13204
13398
  const state = toToggleState(isSelected, onChange);
13205
- const ref = useRef30(null);
13399
+ const ref = useRef31(null);
13206
13400
  const {
13207
13401
  inputProps
13208
13402
  } = useSwitch({
@@ -13354,7 +13548,7 @@ function switchCircleSelectedStyles(isCompact) {
13354
13548
  }
13355
13549
 
13356
13550
  // src/inputs/TextAreaField.tsx
13357
- import { useRef as useRef31 } from "react";
13551
+ import { useRef as useRef32 } from "react";
13358
13552
  import { mergeProps as mergeProps16, useTextField as useTextField3 } from "react-aria";
13359
13553
  import { jsx as jsx74 } from "react/jsx-runtime";
13360
13554
  function TextAreaField(props) {
@@ -13372,8 +13566,8 @@ function TextAreaField(props) {
13372
13566
  const isDisabled = !!disabled;
13373
13567
  const isReadOnly = !!readOnly;
13374
13568
  const textFieldProps = { ...otherProps, value, isDisabled, isReadOnly };
13375
- const inputRef = useRef31(null);
13376
- const inputWrapRef = useRef31(null);
13569
+ const inputRef = useRef32(null);
13570
+ const inputWrapRef = useRef32(null);
13377
13571
  useGrowingTextField({ inputRef, inputWrapRef, value, maxLines });
13378
13572
  const { labelProps, inputProps } = useTextField3(
13379
13573
  {
@@ -13411,7 +13605,7 @@ function TextAreaField(props) {
13411
13605
  }
13412
13606
 
13413
13607
  // src/inputs/TextField.tsx
13414
- import { useRef as useRef32 } from "react";
13608
+ import { useRef as useRef33 } from "react";
13415
13609
  import { mergeProps as mergeProps17, useTextField as useTextField4 } from "react-aria";
13416
13610
  import { jsx as jsx75 } from "react/jsx-runtime";
13417
13611
  function TextField(props) {
@@ -13439,7 +13633,7 @@ function TextField(props) {
13439
13633
  validationState: errorMsg ? "invalid" : "valid",
13440
13634
  value
13441
13635
  };
13442
- const inputRef = useRef32(null);
13636
+ const inputRef = useRef33(null);
13443
13637
  const { labelProps, inputProps } = useTextField4(
13444
13638
  {
13445
13639
  ...textFieldProps,
@@ -13475,7 +13669,7 @@ function TextField(props) {
13475
13669
  }
13476
13670
 
13477
13671
  // src/inputs/ToggleButton.tsx
13478
- import { useRef as useRef33, useState as useState26 } from "react";
13672
+ import { useRef as useRef34, useState as useState26 } from "react";
13479
13673
  import { useFocusRing as useFocusRing8, useHover as useHover14, usePress, useSwitch as useSwitch2, VisuallyHidden as VisuallyHidden6 } from "react-aria";
13480
13674
  import { useToggleState as useToggleState3 } from "react-stately";
13481
13675
  import { trussProps as trussProps47 } from "@homebound/truss/runtime";
@@ -13509,8 +13703,8 @@ function ToggleButton(props) {
13509
13703
  return result;
13510
13704
  }
13511
13705
  });
13512
- const labelRef = useRef33(null);
13513
- const ref = useRef33(null);
13706
+ const labelRef = useRef34(null);
13707
+ const ref = useRef34(null);
13514
13708
  const tid = useTestIds(otherProps, label);
13515
13709
  const {
13516
13710
  isPressed: isPressedFromEvents,
@@ -13596,7 +13790,7 @@ var togglePressStyles = {
13596
13790
  };
13597
13791
 
13598
13792
  // src/inputs/ToggleChipGroup.tsx
13599
- import { useRef as useRef34 } from "react";
13793
+ import { useRef as useRef35 } from "react";
13600
13794
  import { useCheckboxGroup as useCheckboxGroup2, useCheckboxGroupItem as useCheckboxGroupItem2, useFocusRing as useFocusRing9, VisuallyHidden as VisuallyHidden7 } from "react-aria";
13601
13795
  import { useCheckboxGroupState as useCheckboxGroupState2 } from "react-stately";
13602
13796
  import { trussProps as trussProps48 } from "@homebound/truss/runtime";
@@ -13669,7 +13863,7 @@ function ToggleChip2(props) {
13669
13863
  } = props;
13670
13864
  const isDisabled = !!disabled;
13671
13865
  const isReadOnly = !!readonly;
13672
- const ref = useRef34(null);
13866
+ const ref = useRef35(null);
13673
13867
  const {
13674
13868
  inputProps
13675
13869
  } = useCheckboxGroupItem2({
@@ -14719,9 +14913,9 @@ function maybeApply(maybeFn) {
14719
14913
  }
14720
14914
 
14721
14915
  // src/components/Table/hooks/useColumnResizeHandlers.ts
14722
- import { useCallback as useCallback12, useRef as useRef35 } from "react";
14916
+ import { useCallback as useCallback12, useRef as useRef36 } from "react";
14723
14917
  function useColumnResizeHandlers(columns, columnSizes, tableWidth, setResizedWidth, setResizedWidths) {
14724
- const hasLockedColumnsRef = useRef35(false);
14918
+ const hasLockedColumnsRef = useRef36(false);
14725
14919
  const distributeAdjustment = useCallback12(
14726
14920
  (rightColumns, totalRightWidth, adjustment) => {
14727
14921
  const updates = {};
@@ -14850,7 +15044,7 @@ function useScrollStorage(tableId, enabled = true) {
14850
15044
 
14851
15045
  // src/components/Table/hooks/useSetupColumnSizes.ts
14852
15046
  import { useResizeObserver } from "@react-aria/utils";
14853
- import { useCallback as useCallback14, useEffect as useEffect18, useRef as useRef36, useState as useState28 } from "react";
15047
+ import { useCallback as useCallback14, useEffect as useEffect18, useRef as useRef37, useState as useState28 } from "react";
14854
15048
 
14855
15049
  // src/components/Table/hooks/useColumnResizing.ts
14856
15050
  import { useCallback as useCallback13, useEffect as useEffect17, useState as useState27 } from "react";
@@ -14909,9 +15103,9 @@ function useSetupColumnSizes(style, columns, resizeRef, expandedColumnIds, visib
14909
15103
  const { resizedWidths, setResizedWidth, setResizedWidths, resetColumnWidths } = useColumnResizing(
14910
15104
  disableColumnResizing ? void 0 : visibleColumnsStorageKey
14911
15105
  );
14912
- const calculateImmediately = useRef36(true);
15106
+ const calculateImmediately = useRef37(true);
14913
15107
  const [tableWidth, setTableWidth] = useState28();
14914
- const prevTableWidthRef = useRef36(tableWidth);
15108
+ const prevTableWidthRef = useRef37(tableWidth);
14915
15109
  const [columnSizes, setColumnSizes] = useState28(
14916
15110
  calcColumnSizes(columns, tableWidth, style.minWidthPx, expandedColumnIds, resizedWidths)
14917
15111
  );
@@ -14978,9 +15172,9 @@ function useSetupColumnSizes(style, columns, resizeRef, expandedColumnIds, visib
14978
15172
  }
14979
15173
 
14980
15174
  // src/hooks/useRenderCount.ts
14981
- import { useCallback as useCallback15, useRef as useRef37 } from "react";
15175
+ import { useCallback as useCallback15, useRef as useRef38 } from "react";
14982
15176
  function useRenderCount() {
14983
- const ref = useRef37(/* @__PURE__ */ new Map());
15177
+ const ref = useRef38(/* @__PURE__ */ new Map());
14984
15178
  const getCount = useCallback15((id) => {
14985
15179
  const count = ref.current.get(id) || 1;
14986
15180
  ref.current.set(id, count + 1);
@@ -15037,10 +15231,10 @@ function GridTable(props) {
15037
15231
  disableColumnResizing = false
15038
15232
  } = props;
15039
15233
  const columnsWithIds = useMemo24(() => assignDefaultColumnIds(_columns), [_columns]);
15040
- const virtuosoRef = useRef38(null);
15041
- const virtuosoRangeRef = useRef38(null);
15042
- const resizeRef = useRef38(null);
15043
- const tableContainerRef = useRef38(null);
15234
+ const virtuosoRef = useRef39(null);
15235
+ const virtuosoRangeRef = useRef39(null);
15236
+ const resizeRef = useRef39(null);
15237
+ const tableContainerRef = useRef39(null);
15044
15238
  const api = useMemo24(
15045
15239
  () => {
15046
15240
  const api2 = props.api ?? new GridTableApiImpl();
@@ -15055,7 +15249,7 @@ function GridTable(props) {
15055
15249
  [props.api]
15056
15250
  );
15057
15251
  const [draggedRow, _setDraggedRow] = useState29(void 0);
15058
- const draggedRowRef = useRef38(draggedRow);
15252
+ const draggedRowRef = useRef39(draggedRow);
15059
15253
  const setDraggedRow = (row) => {
15060
15254
  draggedRowRef.current = row;
15061
15255
  _setDraggedRow(row);
@@ -15901,17 +16095,17 @@ var variantStyles2 = {
15901
16095
  };
15902
16096
 
15903
16097
  // src/components/BeamContext.tsx
15904
- import { createContext as createContext7, useContext as useContext17, useMemo as useMemo40, useReducer, useRef as useRef45 } from "react";
16098
+ import { createContext as createContext7, useContext as useContext17, useMemo as useMemo40, useReducer, useRef as useRef46 } from "react";
15905
16099
  import { OverlayProvider } from "react-aria";
15906
16100
 
15907
16101
  // src/components/Modal/Modal.tsx
15908
16102
  import { useResizeObserver as useResizeObserver3 } from "@react-aria/utils";
15909
- import { useCallback as useCallback17, useEffect as useEffect23, useRef as useRef40, useState as useState32 } from "react";
16103
+ import { useCallback as useCallback17, useEffect as useEffect23, useRef as useRef41, useState as useState32 } from "react";
15910
16104
  import { FocusScope as FocusScope4, OverlayContainer as OverlayContainer2, useDialog, useModal as useModal2, useOverlay as useOverlay2, usePreventScroll } from "react-aria";
15911
16105
  import { createPortal as createPortal3 } from "react-dom";
15912
16106
 
15913
16107
  // src/components/Modal/useModal.tsx
15914
- import { useEffect as useEffect22, useMemo as useMemo27, useRef as useRef39 } from "react";
16108
+ import { useEffect as useEffect22, useMemo as useMemo27, useRef as useRef40 } from "react";
15915
16109
 
15916
16110
  // src/components/Modal/ModalContext.tsx
15917
16111
  import { createContext as createContext4, useContext as useContext13, useMemo as useMemo26 } from "react";
@@ -15929,8 +16123,8 @@ function useModalContext() {
15929
16123
  function useModal() {
15930
16124
  const { modalState, modalCanCloseChecks } = useBeamContext();
15931
16125
  const { inModal } = useModalContext();
15932
- const lastCanClose = useRef39();
15933
- const api = useRef39();
16126
+ const lastCanClose = useRef40();
16127
+ const api = useRef40();
15934
16128
  useEffect22(() => {
15935
16129
  return () => {
15936
16130
  modalCanCloseChecks.current = modalCanCloseChecks.current.filter((c) => c !== lastCanClose.current);
@@ -15983,7 +16177,7 @@ function Modal(props) {
15983
16177
  allowClosing = true
15984
16178
  } = props;
15985
16179
  const isFixedHeight = typeof size !== "string";
15986
- const ref = useRef40(null);
16180
+ const ref = useRef41(null);
15987
16181
  const {
15988
16182
  modalBodyDiv,
15989
16183
  modalFooterDiv,
@@ -16014,9 +16208,9 @@ function Modal(props) {
16014
16208
  role: "dialog"
16015
16209
  }, ref);
16016
16210
  const [[width2, height], setSize] = useState32(getSize(size));
16017
- const modalBodyRef = useRef40(null);
16018
- const modalFooterRef = useRef40(null);
16019
- const modalHeaderRef = useRef40(null);
16211
+ const modalBodyRef = useRef41(null);
16212
+ const modalFooterRef = useRef41(null);
16213
+ const modalHeaderRef = useRef41(null);
16020
16214
  const testId = useTestIds({}, testIdPrefix);
16021
16215
  usePreventScroll();
16022
16216
  const {
@@ -16312,7 +16506,7 @@ function useSnackbarContext() {
16312
16506
 
16313
16507
  // src/components/SuperDrawer/SuperDrawer.tsx
16314
16508
  import { AnimatePresence, motion } from "framer-motion";
16315
- import { useEffect as useEffect24, useRef as useRef41 } from "react";
16509
+ import { useEffect as useEffect24, useRef as useRef42 } from "react";
16316
16510
  import { createPortal as createPortal4 } from "react-dom";
16317
16511
 
16318
16512
  // src/components/SuperDrawer/utils.ts
@@ -16334,7 +16528,7 @@ function SuperDrawer() {
16334
16528
  const {
16335
16529
  closeDrawer
16336
16530
  } = useSuperDrawer();
16337
- const headerRef = useRef41(null);
16531
+ const headerRef = useRef42(null);
16338
16532
  const testId = useTestIds({}, "superDrawer");
16339
16533
  const currentContent = contentStack.current[contentStack.current.length - 1]?.opts;
16340
16534
  const {
@@ -16429,7 +16623,7 @@ function SuperDrawer() {
16429
16623
  }
16430
16624
 
16431
16625
  // src/components/Layout/FormPageLayout.tsx
16432
- import React16, { createRef, useCallback as useCallback21, useEffect as useEffect25, useMemo as useMemo33, useRef as useRef42, useState as useState39 } from "react";
16626
+ import React16, { createRef, useCallback as useCallback21, useEffect as useEffect25, useMemo as useMemo33, useRef as useRef43, useState as useState39 } from "react";
16433
16627
  import { useButton as useButton9, useFocusRing as useFocusRing11 } from "react-aria";
16434
16628
 
16435
16629
  // src/forms/BoundCheckboxField.tsx
@@ -18097,7 +18291,7 @@ function SectionNavLink(props) {
18097
18291
  });
18098
18292
  }, [sectionRef]);
18099
18293
  const tids = useTestIds(props);
18100
- const buttonRef = useRef42(null);
18294
+ const buttonRef = useRef43(null);
18101
18295
  const {
18102
18296
  buttonProps,
18103
18297
  isPressed
@@ -18247,7 +18441,7 @@ function invertSpacing(value) {
18247
18441
  import React17, { useEffect as useEffect27, useMemo as useMemo38, useState as useState42 } from "react";
18248
18442
 
18249
18443
  // src/components/ButtonMenu.tsx
18250
- import { useRef as useRef43 } from "react";
18444
+ import { useRef as useRef44 } from "react";
18251
18445
  import { useMenuTrigger as useMenuTrigger2 } from "react-aria";
18252
18446
  import { useMenuTriggerState as useMenuTriggerState2 } from "react-stately";
18253
18447
  import { jsx as jsx125 } from "react/jsx-runtime";
@@ -18259,7 +18453,7 @@ function ButtonMenu(props) {
18259
18453
  onChange = props.onChange;
18260
18454
  }
18261
18455
  const state = useMenuTriggerState2({ isOpen: defaultOpen });
18262
- const buttonRef = useRef43(null);
18456
+ const buttonRef = useRef44(null);
18263
18457
  const { menuTriggerProps, menuProps } = useMenuTrigger2({ isDisabled: !!disabled }, state, buttonRef);
18264
18458
  const tid = useTestIds(
18265
18459
  props,
@@ -18366,8 +18560,16 @@ function dateFilter(props) {
18366
18560
  }
18367
18561
  var anyOption = {};
18368
18562
  var DateFilter = class extends BaseFilter {
18563
+ hydrate(value) {
18564
+ if (!isDateFilterValue(value)) return void 0;
18565
+ const hydratedValue = parsePersistedPlainDate(value.value);
18566
+ return hydratedValue ? { op: value.op, value: hydratedValue } : void 0;
18567
+ }
18568
+ dehydrate(value) {
18569
+ return value ? { op: value.op, value: dehydratePlainDate(value.value) } : void 0;
18570
+ }
18369
18571
  render(value, setValue, tid, inModal, vertical) {
18370
- const { label, operations, getOperationValue, getOperationLabel } = this.props;
18572
+ const { label, operations, getOperationValue, getOperationLabel, defaultValue } = this.props;
18371
18573
  return /* @__PURE__ */ jsxs65(Fragment28, { children: [
18372
18574
  vertical && /* @__PURE__ */ jsx127(Label, { label }),
18373
18575
  /* @__PURE__ */ jsxs65(CompoundField, { children: [
@@ -18384,8 +18586,8 @@ var DateFilter = class extends BaseFilter {
18384
18586
  getOptionLabel: (o) => o === anyOption ? "Any" : getOperationLabel(o),
18385
18587
  value: value?.op,
18386
18588
  onSelect: (op) => (
18387
- // default the selected date to today if it doesn't exist in the filter's value
18388
- setValue(op ? { op, value: value?.value ? new Date(value.value) : /* @__PURE__ */ new Date() } : void 0)
18589
+ // default the selected date to the filter's default date or today if it doesn't exist in the filter's value
18590
+ setValue(op ? { op, value: value?.value ?? defaultValue?.value ?? todayPlainDate() } : void 0)
18389
18591
  ),
18390
18592
  label: inModal ? `${label} date filter operation` : label,
18391
18593
  labelStyle: !inModal && !vertical ? "inline" : inModal || vertical ? "hidden" : "above",
@@ -18397,9 +18599,13 @@ var DateFilter = class extends BaseFilter {
18397
18599
  DateField,
18398
18600
  {
18399
18601
  labelStyle: "inline",
18400
- value: value?.value ? new Date(value.value) : /* @__PURE__ */ new Date(),
18602
+ value: value?.value ?? defaultValue?.value ?? todayPlainDate(),
18401
18603
  label: "Date",
18402
- onChange: (d) => setValue({ ...value, value: d }),
18604
+ onChange: (d) => {
18605
+ if (d && value) {
18606
+ setValue({ ...value, value: d });
18607
+ }
18608
+ },
18403
18609
  disabled: !value,
18404
18610
  ...tid[`${defaultTestId(this.label)}_dateField`]
18405
18611
  }
@@ -18408,6 +18614,9 @@ var DateFilter = class extends BaseFilter {
18408
18614
  ] });
18409
18615
  }
18410
18616
  };
18617
+ function isDateFilterValue(value) {
18618
+ return typeof value === "object" && value !== null && "op" in value && "value" in value;
18619
+ }
18411
18620
 
18412
18621
  // src/components/Filters/DateRangeFilter.tsx
18413
18622
  import { Fragment as Fragment29, jsx as jsx128, jsxs as jsxs66 } from "react/jsx-runtime";
@@ -18415,6 +18624,17 @@ function dateRangeFilter(props) {
18415
18624
  return (key) => new DateRangeFilter(key, props);
18416
18625
  }
18417
18626
  var DateRangeFilter = class extends BaseFilter {
18627
+ hydrate(value) {
18628
+ if (!isDateRangeFilterValue(value)) return void 0;
18629
+ const hydratedValue = hydrateDateRange(value.value);
18630
+ return hydratedValue ? { op: value.op, value: hydratedValue } : void 0;
18631
+ }
18632
+ dehydrate(value) {
18633
+ return value ? {
18634
+ op: value.op,
18635
+ value: value.value ? { from: dehydratePlainDate(value.value.from), to: dehydratePlainDate(value.value.to) } : void 0
18636
+ } : void 0;
18637
+ }
18418
18638
  render(value, setValue, tid, inModal, vertical) {
18419
18639
  const { label, placeholderText, disabledDays, testFieldLabel, defaultValue } = this.props;
18420
18640
  return /* @__PURE__ */ jsxs66(Fragment29, { children: [
@@ -18426,8 +18646,17 @@ var DateRangeFilter = class extends BaseFilter {
18426
18646
  isRangeFilterField: true,
18427
18647
  placeholder: placeholderText,
18428
18648
  label: testFieldLabel ?? "Date",
18429
- value: value?.value ? { from: new Date(value.value.from), to: new Date(value.value.to) } : void 0,
18430
- onChange: (d) => d ? setValue({ op: defaultValue?.op, value: d }) : setValue(void 0),
18649
+ value: value?.value,
18650
+ onChange: (d) => {
18651
+ if (!d) {
18652
+ setValue(void 0);
18653
+ return;
18654
+ }
18655
+ const op = value?.op ?? defaultValue?.op;
18656
+ if (op !== void 0) {
18657
+ setValue({ op, value: d });
18658
+ }
18659
+ },
18431
18660
  disabledDays,
18432
18661
  ...tid[`${defaultTestId(this.label)}_dateField`]
18433
18662
  }
@@ -18435,6 +18664,17 @@ var DateRangeFilter = class extends BaseFilter {
18435
18664
  ] });
18436
18665
  }
18437
18666
  };
18667
+ function isDateRangeFilterValue(value) {
18668
+ return typeof value === "object" && value !== null && "op" in value && "value" in value;
18669
+ }
18670
+ function hydrateDateRange(value) {
18671
+ if (typeof value !== "object" || value === null) return void 0;
18672
+ const { from, to } = value;
18673
+ const hydratedFrom = parsePersistedPlainDate(from);
18674
+ const hydratedTo = parsePersistedPlainDate(to);
18675
+ if (hydratedFrom === void 0 && hydratedTo === void 0) return void 0;
18676
+ return { from: hydratedFrom, to: hydratedTo };
18677
+ }
18438
18678
 
18439
18679
  // src/components/Filters/MultiFilter.tsx
18440
18680
  import { jsx as jsx129 } from "react/jsx-runtime";
@@ -18996,7 +19236,7 @@ function toPageNumberSize(page) {
18996
19236
  }
18997
19237
 
18998
19238
  // src/components/Table/components/EditColumnsButton.tsx
18999
- import { Fragment as Fragment33, useCallback as useCallback22, useMemo as useMemo36, useRef as useRef44 } from "react";
19239
+ import { Fragment as Fragment33, useCallback as useCallback22, useMemo as useMemo36, useRef as useRef45 } from "react";
19000
19240
  import { useMenuTrigger as useMenuTrigger3 } from "react-aria";
19001
19241
  import { useMenuTriggerState as useMenuTriggerState3 } from "react-stately";
19002
19242
  import { jsx as jsx141, jsxs as jsxs72 } from "react/jsx-runtime";
@@ -19011,7 +19251,7 @@ function EditColumnsButton(props) {
19011
19251
  const state = useMenuTriggerState3({
19012
19252
  isOpen: defaultOpen
19013
19253
  });
19014
- const buttonRef = useRef44(null);
19254
+ const buttonRef = useRef45(null);
19015
19255
  const {
19016
19256
  menuTriggerProps
19017
19257
  } = useMenuTrigger3({
@@ -19240,10 +19480,10 @@ function useGridTableLayoutState({
19240
19480
  });
19241
19481
  useEffect27(() => {
19242
19482
  if (page.limit !== persistedPageSize) setPersistedPageSize(page.limit);
19243
- setPage((prev) => ({
19483
+ setPage((prev) => prev.offset === 0 ? prev : {
19244
19484
  ...prev,
19245
19485
  offset: 0
19246
- }));
19486
+ });
19247
19487
  }, [page.limit, persistedPageSize, setPersistedPageSize, filter, searchString]);
19248
19488
  return {
19249
19489
  filter,
@@ -19504,18 +19744,18 @@ var BeamContext = createContext7({
19504
19744
  });
19505
19745
  function BeamProvider({ children, ...presentationProps }) {
19506
19746
  const [, tick] = useReducer((prev) => prev + 1, 0);
19507
- const modalRef = useRef45();
19747
+ const modalRef = useRef46();
19508
19748
  const modalHeaderDiv = useMemo40(() => document.createElement("div"), []);
19509
19749
  const modalBodyDiv = useMemo40(() => {
19510
19750
  const el = document.createElement("div");
19511
19751
  el.style.height = "100%";
19512
19752
  return el;
19513
19753
  }, []);
19514
- const modalCanCloseChecksRef = useRef45([]);
19754
+ const modalCanCloseChecksRef = useRef46([]);
19515
19755
  const modalFooterDiv = useMemo40(() => document.createElement("div"), []);
19516
- const drawerContentStackRef = useRef45([]);
19517
- const drawerCanCloseChecks = useRef45([]);
19518
- const drawerCanCloseDetailsChecks = useRef45([]);
19756
+ const drawerContentStackRef = useRef46([]);
19757
+ const drawerCanCloseChecks = useRef46([]);
19758
+ const drawerCanCloseDetailsChecks = useRef46([]);
19519
19759
  const sdHeaderDiv = useMemo40(() => document.createElement("div"), []);
19520
19760
  const context = useMemo40(() => {
19521
19761
  return {
@@ -19558,14 +19798,14 @@ function useBeamContext() {
19558
19798
  }
19559
19799
 
19560
19800
  // src/components/ButtonDatePicker.tsx
19561
- import { useRef as useRef46 } from "react";
19801
+ import { useRef as useRef47 } from "react";
19562
19802
  import { useMenuTrigger as useMenuTrigger4 } from "react-aria";
19563
19803
  import { useMenuTriggerState as useMenuTriggerState4 } from "react-stately";
19564
19804
  import { jsx as jsx150 } from "react/jsx-runtime";
19565
19805
  function ButtonDatePicker(props) {
19566
19806
  const { defaultOpen, disabled, trigger, onSelect, ...datePickerProps } = props;
19567
19807
  const state = useMenuTriggerState4({ isOpen: defaultOpen });
19568
- const buttonRef = useRef46(null);
19808
+ const buttonRef = useRef47(null);
19569
19809
  const {
19570
19810
  menuTriggerProps,
19571
19811
  menuProps: { autoFocus: _af, ...menuProps }
@@ -19588,7 +19828,7 @@ function ButtonDatePicker(props) {
19588
19828
  }
19589
19829
 
19590
19830
  // src/components/ButtonGroup.tsx
19591
- import { useRef as useRef47 } from "react";
19831
+ import { useRef as useRef48 } from "react";
19592
19832
  import { useButton as useButton10, useFocusRing as useFocusRing12, useHover as useHover15 } from "react-aria";
19593
19833
  import { trussProps as trussProps73 } from "@homebound/truss/runtime";
19594
19834
  import { jsx as jsx151, jsxs as jsxs78 } from "react/jsx-runtime";
@@ -19636,7 +19876,7 @@ function GroupButton(props) {
19636
19876
  isDisabled: !!disabled,
19637
19877
  ...otherProps
19638
19878
  };
19639
- const ref = useRef47(null);
19879
+ const ref = useRef48(null);
19640
19880
  const {
19641
19881
  buttonProps,
19642
19882
  isPressed
@@ -19759,7 +19999,7 @@ import { useHover as useHover16 } from "react-aria";
19759
19999
 
19760
20000
  // src/components/Tag.tsx
19761
20001
  import { useResizeObserver as useResizeObserver4 } from "@react-aria/utils";
19762
- import { useRef as useRef48, useState as useState44 } from "react";
20002
+ import { useRef as useRef49, useState as useState44 } from "react";
19763
20003
  import { trussProps as trussProps74 } from "@homebound/truss/runtime";
19764
20004
  import { jsx as jsx152, jsxs as jsxs79 } from "react/jsx-runtime";
19765
20005
  function Tag(props) {
@@ -19773,7 +20013,7 @@ function Tag(props) {
19773
20013
  const typeStyles2 = getStyles(type);
19774
20014
  const tid = useTestIds(otherProps);
19775
20015
  const [showTooltip, setShowTooltip] = useState44(false);
19776
- const ref = useRef48(null);
20016
+ const ref = useRef49(null);
19777
20017
  useResizeObserver4({
19778
20018
  ref,
19779
20019
  onResize: () => {
@@ -19982,7 +20222,7 @@ function Copy(props) {
19982
20222
 
19983
20223
  // src/components/DnDGrid/DnDGrid.tsx
19984
20224
  import equal2 from "fast-deep-equal";
19985
- import { useCallback as useCallback24, useRef as useRef49 } from "react";
20225
+ import { useCallback as useCallback24, useRef as useRef50 } from "react";
19986
20226
 
19987
20227
  // src/components/DnDGrid/DnDGridContext.tsx
19988
20228
  import { createContext as createContext8, useContext as useContext18 } from "react";
@@ -20005,12 +20245,12 @@ function DnDGrid(props) {
20005
20245
  onReorder,
20006
20246
  activeItemStyles
20007
20247
  } = props;
20008
- const gridEl = useRef49(null);
20009
- const dragEl = useRef49();
20010
- const cloneEl = useRef49();
20011
- const initialOrder = useRef49();
20012
- const reorderViaKeyboard = useRef49(false);
20013
- const transformFrom = useRef49({
20248
+ const gridEl = useRef50(null);
20249
+ const dragEl = useRef50();
20250
+ const cloneEl = useRef50();
20251
+ const initialOrder = useRef50();
20252
+ const reorderViaKeyboard = useRef50(false);
20253
+ const transformFrom = useRef50({
20014
20254
  x: 0,
20015
20255
  y: 0
20016
20256
  });
@@ -20472,14 +20712,14 @@ function HbSpinnerProvider({
20472
20712
 
20473
20713
  // src/components/MaxLines.tsx
20474
20714
  import { useLayoutEffect as useLayoutEffect2, useResizeObserver as useResizeObserver5 } from "@react-aria/utils";
20475
- import { useCallback as useCallback25, useEffect as useEffect30, useRef as useRef50, useState as useState45 } from "react";
20715
+ import { useCallback as useCallback25, useEffect as useEffect30, useRef as useRef51, useState as useState45 } from "react";
20476
20716
  import { trussProps as trussProps80 } from "@homebound/truss/runtime";
20477
20717
  import { jsx as jsx160, jsxs as jsxs82 } from "react/jsx-runtime";
20478
20718
  function MaxLines({
20479
20719
  maxLines,
20480
20720
  children
20481
20721
  }) {
20482
- const elRef = useRef50(null);
20722
+ const elRef = useRef51(null);
20483
20723
  const [hasMore, setHasMore] = useState45(false);
20484
20724
  const [expanded, setExpanded] = useState45(false);
20485
20725
  useLayoutEffect2(() => {
@@ -20515,7 +20755,7 @@ function MaxLines({
20515
20755
 
20516
20756
  // src/components/ScrollShadows.tsx
20517
20757
  import { useResizeObserver as useResizeObserver6 } from "@react-aria/utils";
20518
- import { useCallback as useCallback26, useMemo as useMemo47, useRef as useRef51, useState as useState46 } from "react";
20758
+ import { useCallback as useCallback26, useMemo as useMemo47, useRef as useRef52, useState as useState46 } from "react";
20519
20759
  import { trussProps as trussProps81 } from "@homebound/truss/runtime";
20520
20760
  import { jsx as jsx161, jsxs as jsxs83 } from "react/jsx-runtime";
20521
20761
  function ScrollShadows(props) {
@@ -20535,7 +20775,7 @@ function ScrollShadows(props) {
20535
20775
  }
20536
20776
  const [showStartShadow, setShowStartShadow] = useState46(false);
20537
20777
  const [showEndShadow, setShowEndShadow] = useState46(false);
20538
- const scrollRef = useRef51(null);
20778
+ const scrollRef = useRef52(null);
20539
20779
  const [startShadowStyles, endShadowStyles] = useMemo47(() => {
20540
20780
  const transparentBgColor = bgColor.replace(/,1\)$/, ",0)");
20541
20781
  const commonStyles = {
@@ -20708,7 +20948,7 @@ function useSnackbar() {
20708
20948
  var snackbarId = 1;
20709
20949
 
20710
20950
  // src/components/Stepper.tsx
20711
- import { useRef as useRef52 } from "react";
20951
+ import { useRef as useRef53 } from "react";
20712
20952
  import { useButton as useButton11, useFocusRing as useFocusRing14, useHover as useHover18 } from "react-aria";
20713
20953
  import { trussProps as trussProps82 } from "@homebound/truss/runtime";
20714
20954
  import { jsx as jsx162, jsxs as jsxs84 } from "react/jsx-runtime";
@@ -20786,7 +21026,7 @@ function StepButton(props) {
20786
21026
  onPress: onClick,
20787
21027
  isDisabled: disabled
20788
21028
  };
20789
- const ref = useRef52(null);
21029
+ const ref = useRef53(null);
20790
21030
  const {
20791
21031
  buttonProps,
20792
21032
  isPressed
@@ -21180,7 +21420,7 @@ function visit(rows, fn) {
21180
21420
 
21181
21421
  // src/components/Tabs.tsx
21182
21422
  import { camelCase as camelCase5 } from "change-case";
21183
- import { useEffect as useEffect32, useMemo as useMemo49, useRef as useRef53, useState as useState47 } from "react";
21423
+ import { useEffect as useEffect32, useMemo as useMemo49, useRef as useRef54, useState as useState47 } from "react";
21184
21424
  import { mergeProps as mergeProps26, useFocusRing as useFocusRing15, useHover as useHover19 } from "react-aria";
21185
21425
  import { matchPath, Route } from "react-router";
21186
21426
  import { Link as Link5, useLocation } from "react-router-dom";
@@ -21239,7 +21479,7 @@ function Tabs(props) {
21239
21479
  } = useFocusRing15();
21240
21480
  const tid = useTestIds(others, "tabs");
21241
21481
  const [active, setActive] = useState47(selected);
21242
- const ref = useRef53(null);
21482
+ const ref = useRef54(null);
21243
21483
  useEffect32(() => setActive(selected), [selected]);
21244
21484
  function onKeyUp(e) {
21245
21485
  if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
@@ -21637,6 +21877,7 @@ export {
21637
21877
  filterTestIdPrefix,
21638
21878
  formatDate,
21639
21879
  formatDateRange,
21880
+ formatPlainDate,
21640
21881
  formatValue,
21641
21882
  generateColumnId,
21642
21883
  getAlignment,