@homebound/beam 3.0.6 → 3.1.0-alpha.2

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,45 @@ 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
+ filter?.dehydrate ? filter.dehydrate(rawValue) : rawValue
5563
+ ];
5564
+ })
5565
+ );
5566
+ }
5567
+ function parseSerializedValue(value) {
5568
+ return value === void 0 ? void 0 : JSON.parse(value);
5569
+ }
5570
+ function useStableValue(value) {
5571
+ const stableValue = useRef6(value);
5572
+ const stableKey = useRef6(JSON.stringify(value));
5573
+ const nextKey = JSON.stringify(value);
5574
+ if (stableKey.current !== nextKey) {
5575
+ stableValue.current = value;
5576
+ stableKey.current = nextKey;
5577
+ }
5578
+ return stableValue.current;
5518
5579
  }
5519
5580
 
5520
5581
  // src/hooks/useSessionStorage.ts
@@ -5937,21 +5998,122 @@ function CollapseToggle(props) {
5937
5998
  import { useContext as useContext12 } from "react";
5938
5999
 
5939
6000
  // src/inputs/Autocomplete.tsx
5940
- import { useCallback as useCallback10, useRef as useRef23 } from "react";
6001
+ import { useCallback as useCallback10, useRef as useRef24 } from "react";
5941
6002
  import { useComboBox as useComboBox3, useOverlayPosition as useOverlayPosition5 } from "react-aria";
5942
6003
  import { Item as Item5, useComboBoxState as useComboBoxState3 } from "react-stately";
5943
6004
 
5944
6005
  // src/components/internal/DatePicker/DatePicker.tsx
5945
6006
  import { DayPicker } from "react-day-picker";
5946
6007
 
6008
+ // src/utils/plainDate.ts
6009
+ import { Temporal } from "temporal-polyfill";
6010
+ function jsDateToPlainDate(date) {
6011
+ return new Temporal.PlainDate(date.getFullYear(), date.getMonth() + 1, date.getDate());
6012
+ }
6013
+ function formatPlainDate(date, format) {
6014
+ switch (format) {
6015
+ case "shortDate":
6016
+ return date.toLocaleString("en-US", { month: "2-digit", day: "2-digit", year: "2-digit" });
6017
+ case "date":
6018
+ return date.toLocaleString("en-US", { month: "2-digit", day: "2-digit", year: "numeric" });
6019
+ case "shortWeekdayMonthDay":
6020
+ return date.toLocaleString("en-US", { weekday: "short", month: "short", day: "numeric" });
6021
+ case "longWeekdayMonthDayYear":
6022
+ return `${date.toLocaleString("en-US", { weekday: "long" })} ${date.toLocaleString("en-US", { month: "long" })} ${date.day}, ${formatYear(date.year)}`;
6023
+ case "monthYear":
6024
+ return date.toLocaleString("en-US", { month: "long", year: "numeric" });
6025
+ case "shortMonth":
6026
+ return date.toLocaleString("en-US", { month: "short" });
6027
+ case "year":
6028
+ return formatYear(date.year);
6029
+ case "weekdayInitial":
6030
+ return date.toLocaleString("en-US", { weekday: "narrow" });
6031
+ case "weekday":
6032
+ return date.toLocaleString("en-US", { weekday: "long" });
6033
+ default:
6034
+ throw new Error(`Unsupported date format: ${format}`);
6035
+ }
6036
+ }
6037
+ function todayPlainDate() {
6038
+ return Temporal.Now.plainDateISO();
6039
+ }
6040
+ function isPlainDate(value) {
6041
+ return value instanceof Temporal.PlainDate;
6042
+ }
6043
+ function parsePersistedPlainDate(value) {
6044
+ if (isPlainDate(value)) return value;
6045
+ if (value instanceof Date && !Number.isNaN(value.getTime())) {
6046
+ return jsDateToPlainDate(value);
6047
+ }
6048
+ if (typeof value !== "string") return void 0;
6049
+ try {
6050
+ if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
6051
+ return Temporal.PlainDate.from(value);
6052
+ }
6053
+ } catch {
6054
+ return void 0;
6055
+ }
6056
+ const date = new Date(value);
6057
+ return Number.isNaN(date.getTime()) ? void 0 : jsDateToPlainDate(date);
6058
+ }
6059
+ function dehydratePlainDate(value) {
6060
+ return value?.toString();
6061
+ }
6062
+ function padNumber(value, length) {
6063
+ return Math.abs(value).toString().padStart(length, "0");
6064
+ }
6065
+ function formatYear(year) {
6066
+ return `${year < 0 ? "-" : ""}${padNumber(year, 4)}`;
6067
+ }
6068
+
6069
+ // src/components/internal/DatePicker/dates.ts
6070
+ function plainDateToJsDate(date) {
6071
+ return new Date(date.year, date.month - 1, date.day, 12);
6072
+ }
6073
+ function dateRangeToJsDateRange(range) {
6074
+ if (!range) return void 0;
6075
+ return {
6076
+ from: range.from ? plainDateToJsDate(range.from) : void 0,
6077
+ to: range.to ? plainDateToJsDate(range.to) : void 0
6078
+ };
6079
+ }
6080
+ function jsDateRangeToDateRange(range) {
6081
+ if (!range) return void 0;
6082
+ return {
6083
+ from: range.from ? jsDateToPlainDate(range.from) : void 0,
6084
+ to: range.to ? jsDateToPlainDate(range.to) : void 0
6085
+ };
6086
+ }
6087
+ function dateMatcherToDayPickerMatcher(matcher) {
6088
+ if (typeof matcher === "function") {
6089
+ return function dayPickerMatcher(date) {
6090
+ return matcher(jsDateToPlainDate(date));
6091
+ };
6092
+ }
6093
+ if (Array.isArray(matcher)) {
6094
+ return matcher.map(plainDateToJsDate);
6095
+ }
6096
+ if (isPlainDate(matcher)) {
6097
+ return plainDateToJsDate(matcher);
6098
+ }
6099
+ return {
6100
+ from: matcher.from ? plainDateToJsDate(matcher.from) : void 0,
6101
+ to: matcher.to ? plainDateToJsDate(matcher.to) : void 0
6102
+ };
6103
+ }
6104
+ function dateMatchersToDayPickerMatchers(matchers) {
6105
+ if (matchers === void 0) return void 0;
6106
+ return Array.isArray(matchers) ? matchers.map(dateMatcherToDayPickerMatcher) : dateMatcherToDayPickerMatcher(matchers);
6107
+ }
6108
+
5947
6109
  // src/components/internal/DatePicker/Day.tsx
5948
- import { useRef as useRef6 } from "react";
6110
+ import { useRef as useRef7 } from "react";
5949
6111
  import { useDayRender } from "react-day-picker";
5950
6112
  import { trussProps as trussProps12, mergeProps as mergeProps3 } from "@homebound/truss/runtime";
5951
6113
  import { Fragment as Fragment5, jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
5952
6114
  function Day(props) {
5953
6115
  const tid = useTestIds(props, "datePickerDay");
5954
- const buttonRef = useRef6(null);
6116
+ const buttonRef = useRef7(null);
5955
6117
  const {
5956
6118
  isHidden,
5957
6119
  isButton,
@@ -6078,18 +6240,19 @@ var rangeBaseStyles = {
6078
6240
  };
6079
6241
 
6080
6242
  // src/components/internal/DatePicker/Header.tsx
6081
- import { addMonths, addYears, format } from "date-fns";
6243
+ import { addMonths, addYears } from "date-fns";
6082
6244
  import { useNavigation } from "react-day-picker";
6083
6245
  import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
6084
6246
  function Header(props) {
6085
6247
  const {
6086
6248
  displayMonth
6087
6249
  } = props;
6250
+ const displayMonthDate = jsDateToPlainDate(displayMonth);
6088
6251
  const {
6089
6252
  goToMonth
6090
6253
  } = useNavigation();
6091
6254
  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") }),
6255
+ /* @__PURE__ */ jsx17("h1", { className: "fw4 fz_16px lh_24px", children: formatPlainDate(displayMonthDate, "monthYear") }),
6093
6256
  /* @__PURE__ */ jsxs10("div", { children: [
6094
6257
  /* @__PURE__ */ jsx17(IconButton, { color: "rgba(100, 100, 100, 1)" /* Gray700 */, icon: "chevronLeft", onClick: () => goToMonth(addMonths(displayMonth, -1)) }),
6095
6258
  /* @__PURE__ */ jsx17(IconButton, { color: "rgba(100, 100, 100, 1)" /* Gray700 */, icon: "chevronRight", onClick: () => goToMonth(addMonths(displayMonth, 1)) })
@@ -6100,36 +6263,41 @@ function YearSkipHeader(props) {
6100
6263
  const {
6101
6264
  displayMonth
6102
6265
  } = props;
6266
+ const displayMonthDate = jsDateToPlainDate(displayMonth);
6103
6267
  const {
6104
6268
  goToMonth
6105
6269
  } = useNavigation();
6106
6270
  return /* @__PURE__ */ jsxs10("div", { className: "df jcsb aic ml_12px mr_12px h_32px", children: [
6107
6271
  /* @__PURE__ */ jsxs10("div", { className: "df fdr jcsb", children: [
6108
6272
  /* @__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") }),
6273
+ /* @__PURE__ */ jsx17("h1", { className: "fw4 fz_16px lh_24px", children: formatPlainDate(displayMonthDate, "shortMonth") }),
6110
6274
  /* @__PURE__ */ jsx17(IconButton, { color: "rgba(100, 100, 100, 1)" /* Gray700 */, icon: "chevronRight", onClick: () => goToMonth(addMonths(displayMonth, 1)) })
6111
6275
  ] }),
6112
6276
  /* @__PURE__ */ jsxs10("div", { className: "df fdr jcsb", children: [
6113
6277
  /* @__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") }),
6278
+ /* @__PURE__ */ jsx17("h1", { className: "fw4 fz_16px lh_24px", children: formatPlainDate(displayMonthDate, "year") }),
6115
6279
  /* @__PURE__ */ jsx17(IconButton, { color: "rgba(100, 100, 100, 1)" /* Gray700 */, icon: "chevronRight", onClick: () => goToMonth(addYears(displayMonth, 1)) })
6116
6280
  ] })
6117
6281
  ] });
6118
6282
  }
6119
6283
 
6120
6284
  // src/components/internal/DatePicker/WeekHeader.tsx
6121
- import { addDays, format as format2, startOfWeek } from "date-fns";
6122
6285
  import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
6123
6286
  function WeekHeader() {
6124
- const start = startOfWeek(/* @__PURE__ */ new Date());
6287
+ const today = todayPlainDate();
6288
+ const start = today.subtract({
6289
+ days: today.dayOfWeek % 7
6290
+ });
6125
6291
  const days = [];
6126
6292
  for (let i = 0; i < 7; i++) {
6127
- days.push(addDays(start, i));
6293
+ days.push(start.add({
6294
+ days: i
6295
+ }));
6128
6296
  }
6129
6297
  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"))) }) });
6298
+ /* @__PURE__ */ jsx18("span", { "aria-hidden": "true", children: formatPlainDate(day, "weekdayInitial") }),
6299
+ /* @__PURE__ */ jsx18("span", { className: "rdp-vhidden", children: formatPlainDate(day, "weekday") })
6300
+ ] }, formatPlainDate(day, "weekday"))) }) });
6133
6301
  }
6134
6302
 
6135
6303
  // src/components/internal/DatePicker/DatePicker.tsx
@@ -6151,15 +6319,15 @@ function DatePicker(props) {
6151
6319
  Head: WeekHeader,
6152
6320
  Day
6153
6321
  },
6154
- selected: value ? [value] : [],
6155
- defaultMonth: value ?? /* @__PURE__ */ new Date(),
6322
+ selected: value ? [plainDateToJsDate(value)] : [],
6323
+ defaultMonth: plainDateToJsDate(value ?? todayPlainDate()),
6156
6324
  onDayClick: (day, modifiers) => {
6157
6325
  if (modifiers.disabled) return;
6158
- onSelect(day);
6326
+ onSelect(jsDateToPlainDate(day));
6159
6327
  },
6160
- disabled: disabledDays,
6328
+ disabled: dateMatchersToDayPickerMatchers(disabledDays),
6161
6329
  modifiers: {
6162
- indicatorDot: dottedDays ?? []
6330
+ indicatorDot: dateMatchersToDayPickerMatchers(dottedDays) ?? []
6163
6331
  }
6164
6332
  }
6165
6333
  ) });
@@ -6186,21 +6354,21 @@ function DateRangePicker(props) {
6186
6354
  useYearPicker
6187
6355
  } = props;
6188
6356
  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: {
6357
+ return /* @__PURE__ */ jsx21("div", { className: "dib bgWhite fw4 fz_12px lh_16px", ...tid, children: /* @__PURE__ */ jsx21(DayPicker2, { mode: "range", selected: dateRangeToJsDateRange(range), components: {
6190
6358
  Caption: useYearPicker ? YearSkipHeader : Header,
6191
6359
  Head: WeekHeader,
6192
6360
  Day
6193
- }, defaultMonth: range?.to ?? /* @__PURE__ */ new Date(), onSelect: (selection, day, activeModifiers) => {
6361
+ }, defaultMonth: plainDateToJsDate(range?.to ?? range?.from ?? todayPlainDate()), onSelect: (selection, day, activeModifiers) => {
6194
6362
  if (activeModifiers.disabled) return;
6195
- onSelect(selection);
6196
- }, disabled: disabledDays, modifiers: {
6197
- indicatorDot: dottedDays ?? []
6363
+ onSelect(jsDateRangeToDateRange(selection));
6364
+ }, disabled: dateMatchersToDayPickerMatchers(disabledDays), modifiers: {
6365
+ indicatorDot: dateMatchersToDayPickerMatchers(dottedDays) ?? []
6198
6366
  } }) });
6199
6367
  }
6200
6368
 
6201
6369
  // src/components/internal/Menu.tsx
6202
6370
  import { camelCase } from "change-case";
6203
- import { useEffect as useEffect8, useMemo as useMemo9, useRef as useRef10, useState as useState11 } from "react";
6371
+ import { useEffect as useEffect8, useMemo as useMemo9, useRef as useRef11, useState as useState11 } from "react";
6204
6372
  import { FocusScope, useFilter as useFilter2, useMenu } from "react-aria";
6205
6373
  import { Item, Section, useTreeData, useTreeState } from "react-stately";
6206
6374
 
@@ -6245,7 +6413,7 @@ import { trussProps as trussProps21 } from "@homebound/truss/runtime";
6245
6413
 
6246
6414
  // src/inputs/internal/MenuSearchField.tsx
6247
6415
  import { useTextField } from "@react-aria/textfield";
6248
- import { useRef as useRef9 } from "react";
6416
+ import { useRef as useRef10 } from "react";
6249
6417
 
6250
6418
  // src/inputs/TextFieldBase.tsx
6251
6419
  import { useState as useState10 } from "react";
@@ -6344,7 +6512,7 @@ function InlineLabel({
6344
6512
 
6345
6513
  // src/components/Table/components/Row.tsx
6346
6514
  import { observer } from "mobx-react";
6347
- import React6, { useCallback as useCallback6, useContext as useContext10, useRef as useRef8 } from "react";
6515
+ import React6, { useCallback as useCallback6, useContext as useContext10, useRef as useRef9 } from "react";
6348
6516
  import { mergeProps as mergeProps5 } from "react-aria";
6349
6517
 
6350
6518
  // src/components/Table/components/cell.tsx
@@ -6410,7 +6578,7 @@ var rowClickRenderFn = (as, api, colSpan) => (key, css2, content, row, rowStyle,
6410
6578
  };
6411
6579
 
6412
6580
  // 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";
6581
+ import { useCallback as useCallback5, useContext as useContext8, useEffect as useEffect7, useRef as useRef8, useState as useState9 } from "react";
6414
6582
  import { trussProps as trussProps16 } from "@homebound/truss/runtime";
6415
6583
  import { Fragment as Fragment7, jsx as jsx26, jsxs as jsxs14 } from "react/jsx-runtime";
6416
6584
  function findScrollableParent(element) {
@@ -6448,13 +6616,13 @@ function ColumnResizeHandle({
6448
6616
  const [guideLineX, setGuideLineX] = useState9(null);
6449
6617
  const [guideLineTop, setGuideLineTop] = useState9(0);
6450
6618
  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);
6619
+ const startXRef = useRef8(0);
6620
+ const startWidthRef = useRef8(0);
6621
+ const startHandleRightRef = useRef8(0);
6622
+ const handleRef = useRef8(null);
6623
+ const rafRef = useRef8(null);
6624
+ const pendingMouseXRef = useRef8(null);
6625
+ const scrollableParentRef = useRef8(null);
6458
6626
  const tid = useTestIds({}, "columnResizeHandle");
6459
6627
  const handleMouseDown = useCallback5((e) => {
6460
6628
  e.preventDefault();
@@ -7596,7 +7764,7 @@ function RowImpl(props) {
7596
7764
  let foundFirstContentColumn = false;
7597
7765
  let minStickyLeftOffset = 0;
7598
7766
  let expandColumnHidden = false;
7599
- const ref = useRef8(null);
7767
+ const ref = useRef9(null);
7600
7768
  const dragOverCallback = useCallback6((row2, evt) => onDragOver?.(row2, evt), [onDragOver]);
7601
7769
  const onDragOverDebounced = useDebouncedCallback2(dragOverCallback, 100);
7602
7770
  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 +8530,7 @@ var textFieldBaseMultilineTopPadding = 11;
8362
8530
  import { jsx as jsx31 } from "react/jsx-runtime";
8363
8531
  function MenuSearchField(props) {
8364
8532
  const tid = useTestIds(props);
8365
- const inputRef = useRef9(null);
8533
+ const inputRef = useRef10(null);
8366
8534
  const { labelProps, inputProps } = useTextField({ ...props }, inputRef);
8367
8535
  return /* @__PURE__ */ jsx31(
8368
8536
  TextFieldBase,
@@ -8446,7 +8614,7 @@ function Menu(props) {
8446
8614
  keys !== "all" && onChange && onChange([...keys.values()].map((k) => k.toString())[0]);
8447
8615
  }
8448
8616
  });
8449
- const menuRef = useRef10(null);
8617
+ const menuRef = useRef11(null);
8450
8618
  const {
8451
8619
  menuProps
8452
8620
  } = useMenu({
@@ -8488,7 +8656,7 @@ function Menu(props) {
8488
8656
  }
8489
8657
 
8490
8658
  // src/components/internal/MenuItem.tsx
8491
- import { useRef as useRef13 } from "react";
8659
+ import { useRef as useRef14 } from "react";
8492
8660
  import { useHover as useHover7, useMenuItem } from "react-aria";
8493
8661
  import { useHistory } from "react-router";
8494
8662
  import { Link as Link3 } from "react-router-dom";
@@ -8743,12 +8911,12 @@ var pressedOverlayCss = {
8743
8911
  };
8744
8912
 
8745
8913
  // src/components/ButtonModal.tsx
8746
- import { useRef as useRef12 } from "react";
8914
+ import { useRef as useRef13 } from "react";
8747
8915
  import { useMenuTrigger } from "react-aria";
8748
8916
  import { useMenuTriggerState } from "react-stately";
8749
8917
 
8750
8918
  // src/components/internal/OverlayTrigger.tsx
8751
- import { useMemo as useMemo13, useRef as useRef11 } from "react";
8919
+ import { useMemo as useMemo13, useRef as useRef12 } from "react";
8752
8920
  import { useOverlayPosition } from "react-aria";
8753
8921
 
8754
8922
  // src/components/Button.tsx
@@ -9438,7 +9606,7 @@ function OverlayTrigger(props) {
9438
9606
  }
9439
9607
  }
9440
9608
  }), [menuTriggerProps, state]);
9441
- const popoverRef = useRef11(null);
9609
+ const popoverRef = useRef12(null);
9442
9610
  const {
9443
9611
  overlayProps: positionProps
9444
9612
  } = useOverlayPosition({
@@ -9500,7 +9668,7 @@ import { jsx as jsx39 } from "react/jsx-runtime";
9500
9668
  function ButtonModal(props) {
9501
9669
  const { storybookDefaultOpen, trigger, disabled, content, title } = props;
9502
9670
  const state = useMenuTriggerState({ isOpen: storybookDefaultOpen });
9503
- const buttonRef = useRef12(null);
9671
+ const buttonRef = useRef13(null);
9504
9672
  const { menuTriggerProps } = useMenuTrigger({ isDisabled: !!disabled }, state, buttonRef);
9505
9673
  const tid = useTestIds(
9506
9674
  props,
@@ -9584,7 +9752,7 @@ function MenuItemImpl(props) {
9584
9752
  const isDisabled = Boolean(disabled);
9585
9753
  const isSelected = state.selectionManager.selectedKeys.has(label);
9586
9754
  const isFocused = state.selectionManager.focusedKey === item.key;
9587
- const ref = useRef13(null);
9755
+ const ref = useRef14(null);
9588
9756
  const history = useHistory();
9589
9757
  const {
9590
9758
  hoverProps,
@@ -9731,7 +9899,7 @@ function Popover(props) {
9731
9899
  }
9732
9900
 
9733
9901
  // src/inputs/internal/ComboBoxBase.tsx
9734
- import { useCallback as useCallback9, useEffect as useEffect14, useMemo as useMemo16, useRef as useRef22, useState as useState19 } from "react";
9902
+ import { useCallback as useCallback9, useEffect as useEffect14, useMemo as useMemo16, useRef as useRef23, useState as useState19 } from "react";
9735
9903
  import { useButton as useButton7, useComboBox as useComboBox2, useFilter as useFilter4, useOverlayPosition as useOverlayPosition4 } from "react-aria";
9736
9904
  import { Item as Item4, useComboBoxState as useComboBoxState2 } from "react-stately";
9737
9905
  import { trussProps as trussProps39 } from "@homebound/truss/runtime";
@@ -9802,13 +9970,13 @@ function useGrowingTextField({ inputRef, inputWrapRef, value, disabled, maxLines
9802
9970
  }
9803
9971
 
9804
9972
  // 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";
9973
+ import React9, { useCallback as useCallback8, useContext as useContext11, useEffect as useEffect13, useMemo as useMemo15, useRef as useRef22, useState as useState17 } from "react";
9806
9974
  import { useButton as useButton6, useComboBox, useFilter as useFilter3, useOverlayPosition as useOverlayPosition3 } from "react-aria";
9807
9975
  import { Item as Item3, useComboBoxState } from "react-stately";
9808
9976
  import { trussProps as trussProps37 } from "@homebound/truss/runtime";
9809
9977
 
9810
9978
  // src/inputs/internal/ListBox.tsx
9811
- import { useEffect as useEffect12, useRef as useRef20, useState as useState16 } from "react";
9979
+ import { useEffect as useEffect12, useRef as useRef21, useState as useState16 } from "react";
9812
9980
  import { useListBox } from "react-aria";
9813
9981
  import { trussProps as trussProps36 } from "@homebound/truss/runtime";
9814
9982
 
@@ -9821,17 +9989,17 @@ import { useListBoxSection, useSeparator as useSeparator2 } from "react-aria";
9821
9989
  import { trussProps as trussProps35 } from "@homebound/truss/runtime";
9822
9990
 
9823
9991
  // src/inputs/internal/Option.tsx
9824
- import { useRef as useRef16 } from "react";
9992
+ import { useRef as useRef17 } from "react";
9825
9993
  import { mergeProps as mergeProps12, useHover as useHover8, useOption } from "react-aria";
9826
9994
 
9827
9995
  // src/inputs/ChipSelectField.tsx
9828
9996
  import { camelCase as camelCase2 } from "change-case";
9829
- import { useEffect as useEffect10, useMemo as useMemo14, useRef as useRef15, useState as useState15 } from "react";
9997
+ import { useEffect as useEffect10, useMemo as useMemo14, useRef as useRef16, useState as useState15 } from "react";
9830
9998
  import { mergeProps as mergeProps11, useButton as useButton5, useFocus as useFocus2, useOverlayPosition as useOverlayPosition2, useSelect } from "react-aria";
9831
9999
  import { Item as Item2, Section as Section2, useListData, useSelectState } from "react-stately";
9832
10000
 
9833
10001
  // src/inputs/ChipTextField.tsx
9834
- import { useEffect as useEffect9, useRef as useRef14, useState as useState14 } from "react";
10002
+ import { useEffect as useEffect9, useRef as useRef15, useState as useState14 } from "react";
9835
10003
  import { useFocus } from "react-aria";
9836
10004
  import { trussProps as trussProps28 } from "@homebound/truss/runtime";
9837
10005
  import { jsx as jsx43 } from "react/jsx-runtime";
@@ -9850,7 +10018,7 @@ function ChipTextField(props) {
9850
10018
  const {
9851
10019
  fieldProps
9852
10020
  } = usePresentationContext();
9853
- const valueRef = useRef14(value);
10021
+ const valueRef = useRef15(value);
9854
10022
  const tid = useTestIds(props, "chipField");
9855
10023
  const [isFocused, setIsFocused] = useState14(false);
9856
10024
  const {
@@ -9871,7 +10039,7 @@ function ChipTextField(props) {
9871
10039
  onBlur: () => maybeCall(onBlur),
9872
10040
  onFocusChange: setIsFocused
9873
10041
  });
9874
- const fieldRef = useRef14(null);
10042
+ const fieldRef = useRef15(null);
9875
10043
  useEffect9(
9876
10044
  () => {
9877
10045
  autoFocus && fieldRef.current?.focus();
@@ -9978,7 +10146,7 @@ function defaultOptionLabel(opt) {
9978
10146
  import { trussProps as trussProps30 } from "@homebound/truss/runtime";
9979
10147
  import { Fragment as Fragment15, jsx as jsx45, jsxs as jsxs29 } from "react/jsx-runtime";
9980
10148
  function ChipSelectField(props) {
9981
- const firstRender = useRef15(true);
10149
+ const firstRender = useRef16(true);
9982
10150
  const {
9983
10151
  fieldProps
9984
10152
  } = usePresentationContext();
@@ -10036,10 +10204,10 @@ function ChipSelectField(props) {
10036
10204
  } = useFocus2({
10037
10205
  onFocusChange: setIsClearFocused
10038
10206
  });
10039
- const buttonRef = useRef15(null);
10040
- const popoverRef = useRef15(null);
10041
- const listBoxRef = useRef15(null);
10042
- const wrapperRef = useRef15(null);
10207
+ const buttonRef = useRef16(null);
10208
+ const popoverRef = useRef16(null);
10209
+ const listBoxRef = useRef16(null);
10210
+ const wrapperRef = useRef16(null);
10043
10211
  const listData = useListData({
10044
10212
  initialItems: !onCreateNew ? options : [{
10045
10213
  title: "Options",
@@ -10243,7 +10411,7 @@ function Option(props) {
10243
10411
  scrollToIndex,
10244
10412
  disabledReason
10245
10413
  } = props;
10246
- const ref = useRef16(null);
10414
+ const ref = useRef17(null);
10247
10415
  const {
10248
10416
  hoverProps,
10249
10417
  isHovered
@@ -10322,7 +10490,7 @@ function Option(props) {
10322
10490
 
10323
10491
  // src/inputs/internal/VirtualizedOptions.tsx
10324
10492
  import { getInteractionModality } from "@react-aria/interactions";
10325
- import { useEffect as useEffect11, useRef as useRef19 } from "react";
10493
+ import { useEffect as useEffect11, useRef as useRef20 } from "react";
10326
10494
  import { Virtuoso } from "react-virtuoso";
10327
10495
 
10328
10496
  // src/inputs/internal/LoadingDots.tsx
@@ -10370,11 +10538,11 @@ function LoadingDots({
10370
10538
  }
10371
10539
 
10372
10540
  // src/inputs/TreeSelectField/TreeOption.tsx
10373
- import { useRef as useRef18 } from "react";
10541
+ import { useRef as useRef19 } from "react";
10374
10542
  import { useHover as useHover10, useOption as useOption2 } from "react-aria";
10375
10543
 
10376
10544
  // src/inputs/CheckboxBase.tsx
10377
- import { useRef as useRef17 } from "react";
10545
+ import { useRef as useRef18 } from "react";
10378
10546
  import { mergeProps as mergeProps13, useFocusRing as useFocusRing5, useHover as useHover9, VisuallyHidden as VisuallyHidden3 } from "react-aria";
10379
10547
  import { trussProps as trussProps33 } from "@homebound/truss/runtime";
10380
10548
  import { jsx as jsx48, jsxs as jsxs32 } from "react/jsx-runtime";
@@ -10393,7 +10561,7 @@ function CheckboxBase(props) {
10393
10561
  tooltip,
10394
10562
  fullWidth = false
10395
10563
  } = props;
10396
- const ref = useRef17(null);
10564
+ const ref = useRef18(null);
10397
10565
  const {
10398
10566
  isFocusVisible,
10399
10567
  focusProps
@@ -10538,7 +10706,7 @@ function TreeOption(props) {
10538
10706
  const leveledOption = item.value;
10539
10707
  if (!leveledOption) return null;
10540
10708
  const [option, level] = leveledOption;
10541
- const ref = useRef18(null);
10709
+ const ref = useRef19(null);
10542
10710
  const {
10543
10711
  hoverProps,
10544
10712
  isHovered
@@ -10676,7 +10844,7 @@ function VirtualizedOptions(props) {
10676
10844
  isTree,
10677
10845
  allowCollapsing
10678
10846
  } = props;
10679
- const virtuosoRef = useRef19(null);
10847
+ const virtuosoRef = useRef20(null);
10680
10848
  const focusedKey = state.selectionManager.focusedKey;
10681
10849
  const focusedItem = focusedKey != null ? state.collection.getItem(focusedKey) : null;
10682
10850
  const selectedItem = state.selectionManager.selectedKeys.size > 0 ? state.collection.getItem([...state.selectionManager.selectedKeys.values()][0]) : void 0;
@@ -10830,9 +10998,9 @@ function ListBox(props) {
10830
10998
  const isMultiSelect = state.selectionManager.selectionMode === "multiple";
10831
10999
  const firstItem = state.collection.at(0);
10832
11000
  const hasSections = firstItem && firstItem.type === "section";
10833
- const selectedList = useRef20(null);
10834
- const firstRender = useRef20(true);
10835
- const virtuosoListHeight = useRef20(0);
11001
+ const selectedList = useRef21(null);
11002
+ const firstRender = useRef21(true);
11003
+ const virtuosoListHeight = useRef21(0);
10836
11004
  const onListHeightChange = (listHeight) => {
10837
11005
  virtuosoListHeight.current = listHeight;
10838
11006
  const height = (selectedList.current?.offsetHeight || 0) + listHeight;
@@ -11040,7 +11208,7 @@ function TreeSelectFieldBase(props) {
11040
11208
  setFieldState(initTreeFieldState());
11041
11209
  }
11042
11210
  }, [getOptionValue, initTreeFieldState, values]);
11043
- const reactToCollapse = useRef21(false);
11211
+ const reactToCollapse = useRef22(false);
11044
11212
  useEffect13(
11045
11213
  () => {
11046
11214
  if (reactToCollapse.current) {
@@ -11087,7 +11255,7 @@ function TreeSelectFieldBase(props) {
11087
11255
  }));
11088
11256
  }
11089
11257
  }, [collapsedKeys, contains, getOptionLabel, getOptionValue]);
11090
- const firstOpen = useRef21(true);
11258
+ const firstOpen = useRef22(true);
11091
11259
  function onOpenChange(isOpen) {
11092
11260
  if (firstOpen.current && isOpen) {
11093
11261
  maybeInitLoad(options, fieldState, setFieldState);
@@ -11240,12 +11408,12 @@ function TreeSelectFieldBase(props) {
11240
11408
  }));
11241
11409
  }
11242
11410
  }
11243
- const comboBoxRef = useRef21(null);
11244
- const triggerRef = useRef21(null);
11245
- const inputRef = useRef21(null);
11246
- const inputWrapRef = useRef21(null);
11247
- const listBoxRef = useRef21(null);
11248
- const popoverRef = useRef21(null);
11411
+ const comboBoxRef = useRef22(null);
11412
+ const triggerRef = useRef22(null);
11413
+ const inputRef = useRef22(null);
11414
+ const inputWrapRef = useRef22(null);
11415
+ const listBoxRef = useRef22(null);
11416
+ const popoverRef = useRef22(null);
11249
11417
  const {
11250
11418
  buttonProps: triggerProps,
11251
11419
  inputProps,
@@ -11584,7 +11752,7 @@ function ComboBoxBase(props) {
11584
11752
  }));
11585
11753
  }
11586
11754
  }
11587
- const firstOpen = useRef22(true);
11755
+ const firstOpen = useRef23(true);
11588
11756
  function onOpenChange(isOpen) {
11589
11757
  if (firstOpen.current && isOpen) {
11590
11758
  maybeInitLoad();
@@ -11597,12 +11765,12 @@ function ComboBoxBase(props) {
11597
11765
  }));
11598
11766
  }
11599
11767
  }
11600
- const comboBoxRef = useRef22(null);
11601
- const triggerRef = useRef22(null);
11602
- const inputRef = useRef22(null);
11603
- const inputWrapRef = useRef22(null);
11604
- const listBoxRef = useRef22(null);
11605
- const popoverRef = useRef22(null);
11768
+ const comboBoxRef = useRef23(null);
11769
+ const triggerRef = useRef23(null);
11770
+ const inputRef = useRef23(null);
11771
+ const inputWrapRef = useRef23(null);
11772
+ const listBoxRef = useRef23(null);
11773
+ const popoverRef = useRef23(null);
11606
11774
  const disabledOptionsWithReasons = Object.fromEntries(disabledOptions?.map(disabledOptionToKeyedTuple) ?? []);
11607
11775
  const comboBoxChildren = useCallback9((item) => /* @__PURE__ */ jsx56(Item4, { textValue: getOptionLabel(item), children: getOptionMenuLabel(item) }, valueToKey(getOptionValue(item))), [getOptionValue, getOptionLabel, getOptionMenuLabel]);
11608
11776
  const selectedKeys = useMemo16(() => {
@@ -11836,10 +12004,10 @@ function Autocomplete(props) {
11836
12004
  ...others
11837
12005
  };
11838
12006
  const state = useComboBoxState3(comboBoxProps);
11839
- const inputWrapRef = useRef23(null);
11840
- const inputRef = useRef23(null);
11841
- const listBoxRef = useRef23(null);
11842
- const popoverRef = useRef23(null);
12007
+ const inputWrapRef = useRef24(null);
12008
+ const inputRef = useRef24(null);
12009
+ const listBoxRef = useRef24(null);
12010
+ const popoverRef = useRef24(null);
11843
12011
  const { inputProps, listBoxProps, labelProps } = useComboBox3(
11844
12012
  {
11845
12013
  ...comboBoxProps,
@@ -11906,7 +12074,7 @@ function Autocomplete(props) {
11906
12074
  }
11907
12075
 
11908
12076
  // src/inputs/Checkbox.tsx
11909
- import { useRef as useRef24 } from "react";
12077
+ import { useRef as useRef25 } from "react";
11910
12078
  import { useCheckbox } from "react-aria";
11911
12079
  import { useToggleState } from "react-stately";
11912
12080
  import { jsx as jsx58 } from "react/jsx-runtime";
@@ -11916,7 +12084,7 @@ function Checkbox(props) {
11916
12084
  const isIndeterminate = selected === "indeterminate";
11917
12085
  const ariaProps = { isSelected, isDisabled: !!disabled, isIndeterminate, ...otherProps };
11918
12086
  const checkboxProps = { ...ariaProps, "aria-label": label };
11919
- const ref = useRef24(null);
12087
+ const ref = useRef25(null);
11920
12088
  const toggleState = useToggleState(ariaProps);
11921
12089
  const { inputProps } = useCheckbox(checkboxProps, toggleState, ref);
11922
12090
  return /* @__PURE__ */ jsx58(
@@ -11935,7 +12103,7 @@ function Checkbox(props) {
11935
12103
  }
11936
12104
 
11937
12105
  // src/inputs/CheckboxGroup.tsx
11938
- import { useRef as useRef25 } from "react";
12106
+ import { useRef as useRef26 } from "react";
11939
12107
  import { useCheckboxGroup, useCheckboxGroupItem } from "react-aria";
11940
12108
  import { useCheckboxGroupState } from "react-stately";
11941
12109
  import { trussProps as trussProps40 } from "@homebound/truss/runtime";
@@ -12010,7 +12178,7 @@ function CheckboxGroupItem(props) {
12010
12178
  ...ariaProps,
12011
12179
  "aria-label": label
12012
12180
  };
12013
- const ref = useRef25(null);
12181
+ const ref = useRef26(null);
12014
12182
  const {
12015
12183
  inputProps
12016
12184
  } = useCheckboxGroupItem(checkboxProps, groupState, ref);
@@ -12018,69 +12186,37 @@ function CheckboxGroupItem(props) {
12018
12186
  }
12019
12187
 
12020
12188
  // src/inputs/DateFields/DateField.mock.tsx
12021
- import { format as format3, parse } from "date-fns";
12022
12189
  import { useState as useState20 } from "react";
12023
- import { jsx as jsx60 } from "react/jsx-runtime";
12024
- function DateFieldMock(props) {
12025
- const { onChange = () => {
12026
- }, errorMsg, onBlur, onFocus } = props;
12027
- const [value, setValue] = useState20(props.value ? format3(props.value, "MM/dd/yy") : "");
12028
- const tid = useTestIds(props, "date");
12029
- return /* @__PURE__ */ jsx60(
12030
- "input",
12031
- {
12032
- ...tid,
12033
- "data-error": !!errorMsg,
12034
- value,
12035
- onChange: (e) => {
12036
- const { value: value2 } = e.target;
12037
- setValue(value2);
12038
- onChange(parse(value2, "MM/dd/yy", /* @__PURE__ */ new Date()));
12039
- },
12040
- onBlur: () => maybeCall(onBlur),
12041
- onFocus: () => maybeCall(onFocus),
12042
- disabled: !!props.disabled,
12043
- readOnly: !!props.readOnly,
12044
- "data-disabled-days": JSON.stringify(props.disabledDays)
12045
- }
12046
- );
12047
- }
12048
-
12049
- // src/inputs/DateFields/DateFieldBase.tsx
12050
- import { useCallback as useCallback11, useEffect as useEffect15, useRef as useRef26, useState as useState21 } from "react";
12051
- import { FocusScope as FocusScope3, useButton as useButton8, useOverlayPosition as useOverlayPosition6, useOverlayTrigger, useTextField as useTextField2 } from "react-aria";
12052
- import { isDateRange } from "react-day-picker";
12053
- import { useOverlayTriggerState } from "react-stately";
12054
12190
 
12055
12191
  // src/inputs/DateFields/utils.ts
12056
- import { format as dateFnsFormat, parse as dateFnsParse, isDate } from "date-fns";
12192
+ import { Temporal as Temporal2 } from "temporal-polyfill";
12057
12193
  var dateFormats = {
12058
- short: "MM/dd/yy",
12059
- medium: "EEE, MMM d",
12060
- long: "EEEE LLLL d, uuuu"
12194
+ short: "shortDate",
12195
+ medium: "shortWeekdayMonthDay",
12196
+ long: "longWeekdayMonthDayYear"
12061
12197
  };
12062
- function getDateFormat(format4) {
12063
- return format4 ? dateFormats[format4] : dateFormats.short;
12198
+ function getDateFormat(format) {
12199
+ return format ? dateFormats[format] : dateFormats.short;
12064
12200
  }
12065
- function formatDate(date, format4) {
12201
+ function formatDate(date, format) {
12066
12202
  if (!date) return "";
12067
- return dateFnsFormat(date, format4);
12203
+ return formatPlainDate(date, format);
12068
12204
  }
12069
- function formatDateRange(date, format4) {
12205
+ function formatDateRange(date, format) {
12070
12206
  if (!date) return "";
12071
12207
  const { from, to } = date;
12072
- const fromFormatted = from ? dateFnsFormat(from, format4) : "";
12073
- const toFormatted = to ? dateFnsFormat(to, format4) : "";
12208
+ const fromFormatted = from ? formatPlainDate(from, format) : "";
12209
+ const toFormatted = to ? formatPlainDate(to, format) : "";
12074
12210
  return !fromFormatted && !toFormatted ? void 0 : `${fromFormatted} - ${toFormatted}`;
12075
12211
  }
12076
- function parseDate(str, format4) {
12077
- return parseDateString(str, format4);
12212
+ function parseDate(str, format) {
12213
+ return parseDateString(str, format);
12078
12214
  }
12079
- function parseDateRange(str, format4) {
12215
+ function parseDateRange(str, format) {
12080
12216
  const [from = "", to = ""] = str.split("-");
12081
- const fromDate = parseDateString(from.trim(), format4);
12082
- const toDate = parseDateString(to.trim(), format4);
12083
- if (toDate && fromDate && toDate < fromDate) {
12217
+ const fromDate = parseDateString(from.trim(), format);
12218
+ const toDate = parseDateString(to.trim(), format);
12219
+ if (toDate && fromDate && Temporal2.PlainDate.compare(toDate, fromDate) < 0) {
12084
12220
  return { from: toDate, to: fromDate };
12085
12221
  }
12086
12222
  if (toDate === void 0 && fromDate === void 0) {
@@ -12088,31 +12224,81 @@ function parseDateRange(str, format4) {
12088
12224
  }
12089
12225
  return { from: fromDate, to: toDate };
12090
12226
  }
12091
- function parseDateString(str, format4) {
12227
+ function parseDateString(str, format) {
12228
+ if (format !== dateFormats.short && format !== "date") {
12229
+ return void 0;
12230
+ }
12092
12231
  const split = str.split("/");
12093
12232
  if (split.length !== 3) {
12094
12233
  return void 0;
12095
12234
  }
12096
- if (split[2].length !== 2) {
12235
+ const yearLength = format === dateFormats.short ? 2 : 4;
12236
+ if (split[2].length !== yearLength) {
12097
12237
  return void 0;
12098
12238
  }
12099
- const month = parseInt(split[0], 10) - 1;
12239
+ const month = parseInt(split[0], 10);
12100
12240
  const day = parseInt(split[1], 10);
12101
12241
  const year = parseInt(split[2], 10);
12102
- if (isNaN(year) || String(year).length > 4 || isNaN(month) || isNaN(day) || day <= 0 || day > 31 || month < 0 || month >= 12) {
12242
+ if (Number.isNaN(year) || Number.isNaN(month) || Number.isNaN(day) || day <= 0 || day > 31 || month <= 0 || month > 12) {
12103
12243
  return void 0;
12104
12244
  }
12105
- const parsed = dateFnsParse(str, format4, /* @__PURE__ */ new Date());
12106
- if (!isValidDate(parsed)) {
12245
+ try {
12246
+ return Temporal2.PlainDate.from({
12247
+ year: yearLength === 2 ? normalizeTwoDigitYear(year, todayPlainDate().year) : year,
12248
+ month,
12249
+ day
12250
+ });
12251
+ } catch {
12107
12252
  return void 0;
12108
12253
  }
12109
- return parsed;
12110
12254
  }
12111
12255
  function isValidDate(d) {
12112
- return d !== void 0 && isDate(d) && d.toString() !== "Invalid Date";
12256
+ return d !== void 0 && isPlainDate(d);
12257
+ }
12258
+ function normalizeTwoDigitYear(twoDigitYear, currentYear) {
12259
+ const isCommonEra = currentYear > 0;
12260
+ const absCurrentYear = isCommonEra ? currentYear : 1 - currentYear;
12261
+ if (absCurrentYear <= 50) {
12262
+ return isCommonEra ? twoDigitYear || 100 : 1 - (twoDigitYear || 100);
12263
+ }
12264
+ const rangeEnd = absCurrentYear + 50;
12265
+ const rangeEndCentury = Math.floor(rangeEnd / 100) * 100;
12266
+ const isPreviousCentury = twoDigitYear >= rangeEnd % 100;
12267
+ const normalizedYear = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0);
12268
+ return isCommonEra ? normalizedYear : 1 - normalizedYear;
12269
+ }
12270
+
12271
+ // src/inputs/DateFields/DateField.mock.tsx
12272
+ import { jsx as jsx60 } from "react/jsx-runtime";
12273
+ function DateFieldMock(props) {
12274
+ const { onChange = () => {
12275
+ }, errorMsg, onBlur, onFocus } = props;
12276
+ const [value, setValue] = useState20(formatDate(props.value, dateFormats.short));
12277
+ const tid = useTestIds(props, "date");
12278
+ return /* @__PURE__ */ jsx60(
12279
+ "input",
12280
+ {
12281
+ ...tid,
12282
+ "data-error": !!errorMsg,
12283
+ value,
12284
+ onChange: (e) => {
12285
+ const { value: value2 } = e.target;
12286
+ setValue(value2);
12287
+ onChange(parseDate(value2, dateFormats.short));
12288
+ },
12289
+ onBlur: () => maybeCall(onBlur),
12290
+ onFocus: () => maybeCall(onFocus),
12291
+ disabled: !!props.disabled,
12292
+ readOnly: !!props.readOnly,
12293
+ "data-disabled-days": JSON.stringify(props.disabledDays)
12294
+ }
12295
+ );
12113
12296
  }
12114
12297
 
12115
12298
  // src/inputs/DateFields/DateFieldBase.tsx
12299
+ import { useCallback as useCallback11, useEffect as useEffect15, useRef as useRef27, useState as useState21 } from "react";
12300
+ import { FocusScope as FocusScope3, useButton as useButton8, useOverlayPosition as useOverlayPosition6, useOverlayTrigger, useTextField as useTextField2 } from "react-aria";
12301
+ import { useOverlayTriggerState } from "react-stately";
12116
12302
  import { trussProps as trussProps41 } from "@homebound/truss/runtime";
12117
12303
  import { Fragment as Fragment18, jsx as jsx61, jsxs as jsxs40 } from "react/jsx-runtime";
12118
12304
  function DateFieldBase(props) {
@@ -12128,7 +12314,7 @@ function DateFieldBase(props) {
12128
12314
  errorMsg,
12129
12315
  helperText,
12130
12316
  readOnly,
12131
- format: format4 = "short",
12317
+ format = "short",
12132
12318
  iconLeft = false,
12133
12319
  hideCalendarIcon = false,
12134
12320
  disabledDays,
@@ -12140,12 +12326,12 @@ function DateFieldBase(props) {
12140
12326
  ...others
12141
12327
  } = props;
12142
12328
  const isRangeMode = mode === "range";
12143
- const inputRef = useRef26(null);
12144
- const inputWrapRef = useRef26(null);
12145
- const buttonRef = useRef26(null);
12146
- const overlayRef = useRef26(null);
12147
- const isFocused = useRef26(false);
12148
- const dateFormat = getDateFormat(format4);
12329
+ const inputRef = useRef27(null);
12330
+ const inputWrapRef = useRef27(null);
12331
+ const buttonRef = useRef27(null);
12332
+ const overlayRef = useRef27(null);
12333
+ const isFocused = useRef27(false);
12334
+ const dateFormat = getDateFormat(format);
12149
12335
  const [wipValue, setWipValue] = useState21(value);
12150
12336
  const [inputValue, setInputValue] = useState21((isRangeMode ? formatDateRange(props.value, dateFormat) : formatDate(props.value, dateFormat)) ?? "");
12151
12337
  const tid = useTestIds(props, defaultTestId(label));
@@ -12234,16 +12420,20 @@ function DateFieldBase(props) {
12234
12420
  (d) => {
12235
12421
  setWipValue(d);
12236
12422
  if (d && isParsedDateValid(d)) {
12237
- if (isRangeMode && isDateRange(d)) {
12423
+ if (isRangeMode && isDateRangeValue(d)) {
12238
12424
  props.onChange(d);
12239
12425
  return;
12240
12426
  }
12241
- if (!isRangeMode && !isDateRange(d)) {
12427
+ if (!isRangeMode && !isDateRangeValue(d)) {
12242
12428
  props.onChange(d);
12243
12429
  return;
12244
12430
  }
12245
12431
  } else {
12246
- props.onChange(void 0);
12432
+ if (isRangeMode) {
12433
+ props.onChange(void 0);
12434
+ } else {
12435
+ props.onChange(void 0);
12436
+ }
12247
12437
  return;
12248
12438
  }
12249
12439
  },
@@ -12251,7 +12441,7 @@ function DateFieldBase(props) {
12251
12441
  // eslint-disable-next-line react-hooks/exhaustive-deps
12252
12442
  [isRangeMode, props.onChange]
12253
12443
  );
12254
- const inputSize = !isRangeMode ? format4 === "short" ? 8 : format4 === "medium" ? 10 : void 0 : void 0;
12444
+ const inputSize = !isRangeMode ? format === "short" ? 8 : format === "medium" ? 10 : void 0 : void 0;
12255
12445
  const clearButton = /* @__PURE__ */ jsx61(Fragment18, { children: inputValue !== "" && !state.isOpen && /* @__PURE__ */ jsx61(IconButton, { icon: "xCircle", color: "rgba(100, 100, 100, 1)" /* Gray700 */, onClick: () => {
12256
12446
  setInputValue("");
12257
12447
  onChange(void 0);
@@ -12313,7 +12503,10 @@ function DateFieldBase(props) {
12313
12503
  ] });
12314
12504
  }
12315
12505
  function isParsedDateValid(d) {
12316
- return d !== void 0 && (!isDateRange(d) || isDateRange(d) && isValidDate(d.from) && isValidDate(d.to));
12506
+ return d !== void 0 && (!isDateRangeValue(d) || isValidDate(d.from) && isValidDate(d.to));
12507
+ }
12508
+ function isDateRangeValue(value) {
12509
+ return typeof value === "object" && value !== null && ("from" in value || "to" in value);
12317
12510
  }
12318
12511
 
12319
12512
  // src/utils/withTestMock.tsx
@@ -12500,7 +12693,7 @@ function MultiSelectField(props) {
12500
12693
 
12501
12694
  // src/inputs/NumberField.tsx
12502
12695
  import { NumberParser } from "@internationalized/number";
12503
- import { useMemo as useMemo18, useRef as useRef27, useState as useState23 } from "react";
12696
+ import { useMemo as useMemo18, useRef as useRef28, useState as useState23 } from "react";
12504
12697
  import { mergeProps as mergeProps15, useLocale, useNumberField } from "react-aria";
12505
12698
  import { useNumberFieldState } from "react-stately";
12506
12699
  import { jsx as jsx68 } from "react/jsx-runtime";
@@ -12587,11 +12780,11 @@ function NumberField(props) {
12587
12780
  };
12588
12781
  }, [type, numberFormatOptions, defaultFormatOptions, numFractionDigits]);
12589
12782
  const numberParser = useMemo18(() => new NumberParser(locale, formatOptions), [locale, formatOptions]);
12590
- const valueRef = useRef27({
12783
+ const valueRef = useRef28({
12591
12784
  wip: false
12592
12785
  });
12593
- const lastSentRef = useRef27(void 0);
12594
- const focusValueRef = useRef27(void 0);
12786
+ const lastSentRef = useRef28(void 0);
12787
+ const focusValueRef = useRef28(void 0);
12595
12788
  const [, forceRender] = useState23(0);
12596
12789
  const propValue = value === void 0 ? Number.NaN : value / factor;
12597
12790
  if (valueRef.current.wip && !Object.is(valueRef.current.value, propValue)) {
@@ -12639,7 +12832,7 @@ function NumberField(props) {
12639
12832
  ...otherProps
12640
12833
  };
12641
12834
  const state = useNumberFieldState(useProps);
12642
- const inputRef = useRef27(null);
12835
+ const inputRef = useRef28(null);
12643
12836
  const {
12644
12837
  labelProps,
12645
12838
  inputProps,
@@ -12691,7 +12884,7 @@ function formatValue(value, factor, numFractionDigits, numIntegerDigits, positiv
12691
12884
  }
12692
12885
 
12693
12886
  // src/inputs/RadioGroupField.tsx
12694
- import { Fragment as Fragment19, useMemo as useMemo19, useRef as useRef28 } from "react";
12887
+ import { Fragment as Fragment19, useMemo as useMemo19, useRef as useRef29 } from "react";
12695
12888
  import { useFocusRing as useFocusRing6, useHover as useHover12, useRadio, useRadioGroup } from "react-aria";
12696
12889
  import { useRadioGroupState } from "react-stately";
12697
12890
  import { trussProps as trussProps44 } from "@homebound/truss/runtime";
@@ -12767,7 +12960,7 @@ function Radio(props) {
12767
12960
  } = props;
12768
12961
  const labelId = `${parentId}-${value}-label`;
12769
12962
  const descriptionId = `${parentId}-${value}-description`;
12770
- const ref = useRef28(null);
12963
+ const ref = useRef29(null);
12771
12964
  const {
12772
12965
  inputProps,
12773
12966
  isDisabled
@@ -12937,7 +13130,7 @@ var radioDisabled = {
12937
13130
 
12938
13131
  // src/inputs/RichTextField.tsx
12939
13132
  import DOMPurify from "dompurify";
12940
- import { createElement, useEffect as useEffect16, useMemo as useMemo20, useRef as useRef29, useState as useState25 } from "react";
13133
+ import { createElement, useEffect as useEffect16, useMemo as useMemo20, useRef as useRef30, useState as useState25 } from "react";
12941
13134
 
12942
13135
  // src/inputs/RichTextField.mock.tsx
12943
13136
  import { camelCase as camelCase3 } from "change-case";
@@ -12993,13 +13186,13 @@ function RichTextFieldImpl(props) {
12993
13186
  fullWidth = fieldProps?.fullWidth ?? false
12994
13187
  } = props;
12995
13188
  const [editor, setEditor] = useState25();
12996
- const editorElement = useRef29();
12997
- const currentHtml = useRef29(void 0);
12998
- const onChangeRef = useRef29(onChange);
13189
+ const editorElement = useRef30();
13190
+ const currentHtml = useRef30(void 0);
13191
+ const onChangeRef = useRef30(onChange);
12999
13192
  onChangeRef.current = onChange;
13000
- const onBlurRef = useRef29(onBlur);
13193
+ const onBlurRef = useRef30(onBlur);
13001
13194
  onBlurRef.current = onBlur;
13002
- const onFocusRef = useRef29(onFocus);
13195
+ const onFocusRef = useRef30(onFocus);
13003
13196
  onFocusRef.current = onFocus;
13004
13197
  const id = useMemo20(() => {
13005
13198
  if (readOnly) return;
@@ -13150,7 +13343,7 @@ function SelectField(props) {
13150
13343
  }
13151
13344
 
13152
13345
  // src/inputs/Switch.tsx
13153
- import { useRef as useRef30 } from "react";
13346
+ import { useRef as useRef31 } from "react";
13154
13347
  import { useFocusRing as useFocusRing7, useHover as useHover13, useSwitch, VisuallyHidden as VisuallyHidden5 } from "react-aria";
13155
13348
  import { trussProps as trussProps46 } from "@homebound/truss/runtime";
13156
13349
  import { jsx as jsx73, jsxs as jsxs45 } from "react/jsx-runtime";
@@ -13183,7 +13376,7 @@ function Switch(props) {
13183
13376
  ...otherProps
13184
13377
  };
13185
13378
  const state = toToggleState(isSelected, onChange);
13186
- const ref = useRef30(null);
13379
+ const ref = useRef31(null);
13187
13380
  const {
13188
13381
  inputProps
13189
13382
  } = useSwitch({
@@ -13335,7 +13528,7 @@ function switchCircleSelectedStyles(isCompact) {
13335
13528
  }
13336
13529
 
13337
13530
  // src/inputs/TextAreaField.tsx
13338
- import { useRef as useRef31 } from "react";
13531
+ import { useRef as useRef32 } from "react";
13339
13532
  import { mergeProps as mergeProps16, useTextField as useTextField3 } from "react-aria";
13340
13533
  import { jsx as jsx74 } from "react/jsx-runtime";
13341
13534
  function TextAreaField(props) {
@@ -13353,8 +13546,8 @@ function TextAreaField(props) {
13353
13546
  const isDisabled = !!disabled;
13354
13547
  const isReadOnly = !!readOnly;
13355
13548
  const textFieldProps = { ...otherProps, value, isDisabled, isReadOnly };
13356
- const inputRef = useRef31(null);
13357
- const inputWrapRef = useRef31(null);
13549
+ const inputRef = useRef32(null);
13550
+ const inputWrapRef = useRef32(null);
13358
13551
  useGrowingTextField({ inputRef, inputWrapRef, value, maxLines });
13359
13552
  const { labelProps, inputProps } = useTextField3(
13360
13553
  {
@@ -13392,7 +13585,7 @@ function TextAreaField(props) {
13392
13585
  }
13393
13586
 
13394
13587
  // src/inputs/TextField.tsx
13395
- import { useRef as useRef32 } from "react";
13588
+ import { useRef as useRef33 } from "react";
13396
13589
  import { mergeProps as mergeProps17, useTextField as useTextField4 } from "react-aria";
13397
13590
  import { jsx as jsx75 } from "react/jsx-runtime";
13398
13591
  function TextField(props) {
@@ -13420,7 +13613,7 @@ function TextField(props) {
13420
13613
  validationState: errorMsg ? "invalid" : "valid",
13421
13614
  value
13422
13615
  };
13423
- const inputRef = useRef32(null);
13616
+ const inputRef = useRef33(null);
13424
13617
  const { labelProps, inputProps } = useTextField4(
13425
13618
  {
13426
13619
  ...textFieldProps,
@@ -13456,7 +13649,7 @@ function TextField(props) {
13456
13649
  }
13457
13650
 
13458
13651
  // src/inputs/ToggleButton.tsx
13459
- import { useRef as useRef33, useState as useState26 } from "react";
13652
+ import { useRef as useRef34, useState as useState26 } from "react";
13460
13653
  import { useFocusRing as useFocusRing8, useHover as useHover14, usePress, useSwitch as useSwitch2, VisuallyHidden as VisuallyHidden6 } from "react-aria";
13461
13654
  import { useToggleState as useToggleState3 } from "react-stately";
13462
13655
  import { trussProps as trussProps47 } from "@homebound/truss/runtime";
@@ -13490,8 +13683,8 @@ function ToggleButton(props) {
13490
13683
  return result;
13491
13684
  }
13492
13685
  });
13493
- const labelRef = useRef33(null);
13494
- const ref = useRef33(null);
13686
+ const labelRef = useRef34(null);
13687
+ const ref = useRef34(null);
13495
13688
  const tid = useTestIds(otherProps, label);
13496
13689
  const {
13497
13690
  isPressed: isPressedFromEvents,
@@ -13577,7 +13770,7 @@ var togglePressStyles = {
13577
13770
  };
13578
13771
 
13579
13772
  // src/inputs/ToggleChipGroup.tsx
13580
- import { useRef as useRef34 } from "react";
13773
+ import { useRef as useRef35 } from "react";
13581
13774
  import { useCheckboxGroup as useCheckboxGroup2, useCheckboxGroupItem as useCheckboxGroupItem2, useFocusRing as useFocusRing9, VisuallyHidden as VisuallyHidden7 } from "react-aria";
13582
13775
  import { useCheckboxGroupState as useCheckboxGroupState2 } from "react-stately";
13583
13776
  import { trussProps as trussProps48 } from "@homebound/truss/runtime";
@@ -13650,7 +13843,7 @@ function ToggleChip2(props) {
13650
13843
  } = props;
13651
13844
  const isDisabled = !!disabled;
13652
13845
  const isReadOnly = !!readonly;
13653
- const ref = useRef34(null);
13846
+ const ref = useRef35(null);
13654
13847
  const {
13655
13848
  inputProps
13656
13849
  } = useCheckboxGroupItem2({
@@ -14700,9 +14893,9 @@ function maybeApply(maybeFn) {
14700
14893
  }
14701
14894
 
14702
14895
  // src/components/Table/hooks/useColumnResizeHandlers.ts
14703
- import { useCallback as useCallback12, useRef as useRef35 } from "react";
14896
+ import { useCallback as useCallback12, useRef as useRef36 } from "react";
14704
14897
  function useColumnResizeHandlers(columns, columnSizes, tableWidth, setResizedWidth, setResizedWidths) {
14705
- const hasLockedColumnsRef = useRef35(false);
14898
+ const hasLockedColumnsRef = useRef36(false);
14706
14899
  const distributeAdjustment = useCallback12(
14707
14900
  (rightColumns, totalRightWidth, adjustment) => {
14708
14901
  const updates = {};
@@ -14831,7 +15024,7 @@ function useScrollStorage(tableId, enabled = true) {
14831
15024
 
14832
15025
  // src/components/Table/hooks/useSetupColumnSizes.ts
14833
15026
  import { useResizeObserver } from "@react-aria/utils";
14834
- import { useCallback as useCallback14, useEffect as useEffect18, useRef as useRef36, useState as useState28 } from "react";
15027
+ import { useCallback as useCallback14, useEffect as useEffect18, useRef as useRef37, useState as useState28 } from "react";
14835
15028
 
14836
15029
  // src/components/Table/hooks/useColumnResizing.ts
14837
15030
  import { useCallback as useCallback13, useEffect as useEffect17, useState as useState27 } from "react";
@@ -14890,9 +15083,9 @@ function useSetupColumnSizes(style, columns, resizeRef, expandedColumnIds, visib
14890
15083
  const { resizedWidths, setResizedWidth, setResizedWidths, resetColumnWidths } = useColumnResizing(
14891
15084
  disableColumnResizing ? void 0 : visibleColumnsStorageKey
14892
15085
  );
14893
- const calculateImmediately = useRef36(true);
15086
+ const calculateImmediately = useRef37(true);
14894
15087
  const [tableWidth, setTableWidth] = useState28();
14895
- const prevTableWidthRef = useRef36(tableWidth);
15088
+ const prevTableWidthRef = useRef37(tableWidth);
14896
15089
  const [columnSizes, setColumnSizes] = useState28(
14897
15090
  calcColumnSizes(columns, tableWidth, style.minWidthPx, expandedColumnIds, resizedWidths)
14898
15091
  );
@@ -14959,9 +15152,9 @@ function useSetupColumnSizes(style, columns, resizeRef, expandedColumnIds, visib
14959
15152
  }
14960
15153
 
14961
15154
  // src/hooks/useRenderCount.ts
14962
- import { useCallback as useCallback15, useRef as useRef37 } from "react";
15155
+ import { useCallback as useCallback15, useRef as useRef38 } from "react";
14963
15156
  function useRenderCount() {
14964
- const ref = useRef37(/* @__PURE__ */ new Map());
15157
+ const ref = useRef38(/* @__PURE__ */ new Map());
14965
15158
  const getCount = useCallback15((id) => {
14966
15159
  const count = ref.current.get(id) || 1;
14967
15160
  ref.current.set(id, count + 1);
@@ -15018,10 +15211,10 @@ function GridTable(props) {
15018
15211
  disableColumnResizing = false
15019
15212
  } = props;
15020
15213
  const columnsWithIds = useMemo24(() => assignDefaultColumnIds(_columns), [_columns]);
15021
- const virtuosoRef = useRef38(null);
15022
- const virtuosoRangeRef = useRef38(null);
15023
- const resizeRef = useRef38(null);
15024
- const tableContainerRef = useRef38(null);
15214
+ const virtuosoRef = useRef39(null);
15215
+ const virtuosoRangeRef = useRef39(null);
15216
+ const resizeRef = useRef39(null);
15217
+ const tableContainerRef = useRef39(null);
15025
15218
  const api = useMemo24(
15026
15219
  () => {
15027
15220
  const api2 = props.api ?? new GridTableApiImpl();
@@ -15036,7 +15229,7 @@ function GridTable(props) {
15036
15229
  [props.api]
15037
15230
  );
15038
15231
  const [draggedRow, _setDraggedRow] = useState29(void 0);
15039
- const draggedRowRef = useRef38(draggedRow);
15232
+ const draggedRowRef = useRef39(draggedRow);
15040
15233
  const setDraggedRow = (row) => {
15041
15234
  draggedRowRef.current = row;
15042
15235
  _setDraggedRow(row);
@@ -15882,17 +16075,17 @@ var variantStyles2 = {
15882
16075
  };
15883
16076
 
15884
16077
  // src/components/BeamContext.tsx
15885
- import { createContext as createContext7, useContext as useContext17, useMemo as useMemo40, useReducer, useRef as useRef45 } from "react";
16078
+ import { createContext as createContext7, useContext as useContext17, useMemo as useMemo40, useReducer, useRef as useRef46 } from "react";
15886
16079
  import { OverlayProvider } from "react-aria";
15887
16080
 
15888
16081
  // src/components/Modal/Modal.tsx
15889
16082
  import { useResizeObserver as useResizeObserver3 } from "@react-aria/utils";
15890
- import { useCallback as useCallback17, useEffect as useEffect23, useRef as useRef40, useState as useState32 } from "react";
16083
+ import { useCallback as useCallback17, useEffect as useEffect23, useRef as useRef41, useState as useState32 } from "react";
15891
16084
  import { FocusScope as FocusScope4, OverlayContainer as OverlayContainer2, useDialog, useModal as useModal2, useOverlay as useOverlay2, usePreventScroll } from "react-aria";
15892
16085
  import { createPortal as createPortal3 } from "react-dom";
15893
16086
 
15894
16087
  // src/components/Modal/useModal.tsx
15895
- import { useEffect as useEffect22, useMemo as useMemo27, useRef as useRef39 } from "react";
16088
+ import { useEffect as useEffect22, useMemo as useMemo27, useRef as useRef40 } from "react";
15896
16089
 
15897
16090
  // src/components/Modal/ModalContext.tsx
15898
16091
  import { createContext as createContext4, useContext as useContext13, useMemo as useMemo26 } from "react";
@@ -15910,8 +16103,8 @@ function useModalContext() {
15910
16103
  function useModal() {
15911
16104
  const { modalState, modalCanCloseChecks } = useBeamContext();
15912
16105
  const { inModal } = useModalContext();
15913
- const lastCanClose = useRef39();
15914
- const api = useRef39();
16106
+ const lastCanClose = useRef40();
16107
+ const api = useRef40();
15915
16108
  useEffect22(() => {
15916
16109
  return () => {
15917
16110
  modalCanCloseChecks.current = modalCanCloseChecks.current.filter((c) => c !== lastCanClose.current);
@@ -15964,7 +16157,7 @@ function Modal(props) {
15964
16157
  allowClosing = true
15965
16158
  } = props;
15966
16159
  const isFixedHeight = typeof size !== "string";
15967
- const ref = useRef40(null);
16160
+ const ref = useRef41(null);
15968
16161
  const {
15969
16162
  modalBodyDiv,
15970
16163
  modalFooterDiv,
@@ -15995,9 +16188,9 @@ function Modal(props) {
15995
16188
  role: "dialog"
15996
16189
  }, ref);
15997
16190
  const [[width2, height], setSize] = useState32(getSize(size));
15998
- const modalBodyRef = useRef40(null);
15999
- const modalFooterRef = useRef40(null);
16000
- const modalHeaderRef = useRef40(null);
16191
+ const modalBodyRef = useRef41(null);
16192
+ const modalFooterRef = useRef41(null);
16193
+ const modalHeaderRef = useRef41(null);
16001
16194
  const testId = useTestIds({}, testIdPrefix);
16002
16195
  usePreventScroll();
16003
16196
  const {
@@ -16293,7 +16486,7 @@ function useSnackbarContext() {
16293
16486
 
16294
16487
  // src/components/SuperDrawer/SuperDrawer.tsx
16295
16488
  import { AnimatePresence, motion } from "framer-motion";
16296
- import { useEffect as useEffect24, useRef as useRef41 } from "react";
16489
+ import { useEffect as useEffect24, useRef as useRef42 } from "react";
16297
16490
  import { createPortal as createPortal4 } from "react-dom";
16298
16491
 
16299
16492
  // src/components/SuperDrawer/utils.ts
@@ -16315,7 +16508,7 @@ function SuperDrawer() {
16315
16508
  const {
16316
16509
  closeDrawer
16317
16510
  } = useSuperDrawer();
16318
- const headerRef = useRef41(null);
16511
+ const headerRef = useRef42(null);
16319
16512
  const testId = useTestIds({}, "superDrawer");
16320
16513
  const currentContent = contentStack.current[contentStack.current.length - 1]?.opts;
16321
16514
  const {
@@ -16410,7 +16603,7 @@ function SuperDrawer() {
16410
16603
  }
16411
16604
 
16412
16605
  // src/components/Layout/FormPageLayout.tsx
16413
- import React16, { createRef, useCallback as useCallback21, useEffect as useEffect25, useMemo as useMemo33, useRef as useRef42, useState as useState39 } from "react";
16606
+ import React16, { createRef, useCallback as useCallback21, useEffect as useEffect25, useMemo as useMemo33, useRef as useRef43, useState as useState39 } from "react";
16414
16607
  import { useButton as useButton9, useFocusRing as useFocusRing11 } from "react-aria";
16415
16608
 
16416
16609
  // src/forms/BoundCheckboxField.tsx
@@ -18078,7 +18271,7 @@ function SectionNavLink(props) {
18078
18271
  });
18079
18272
  }, [sectionRef]);
18080
18273
  const tids = useTestIds(props);
18081
- const buttonRef = useRef42(null);
18274
+ const buttonRef = useRef43(null);
18082
18275
  const {
18083
18276
  buttonProps,
18084
18277
  isPressed
@@ -18228,7 +18421,7 @@ function invertSpacing(value) {
18228
18421
  import React17, { useEffect as useEffect27, useMemo as useMemo38, useState as useState42 } from "react";
18229
18422
 
18230
18423
  // src/components/ButtonMenu.tsx
18231
- import { useRef as useRef43 } from "react";
18424
+ import { useRef as useRef44 } from "react";
18232
18425
  import { useMenuTrigger as useMenuTrigger2 } from "react-aria";
18233
18426
  import { useMenuTriggerState as useMenuTriggerState2 } from "react-stately";
18234
18427
  import { jsx as jsx125 } from "react/jsx-runtime";
@@ -18240,7 +18433,7 @@ function ButtonMenu(props) {
18240
18433
  onChange = props.onChange;
18241
18434
  }
18242
18435
  const state = useMenuTriggerState2({ isOpen: defaultOpen });
18243
- const buttonRef = useRef43(null);
18436
+ const buttonRef = useRef44(null);
18244
18437
  const { menuTriggerProps, menuProps } = useMenuTrigger2({ isDisabled: !!disabled }, state, buttonRef);
18245
18438
  const tid = useTestIds(
18246
18439
  props,
@@ -18347,8 +18540,16 @@ function dateFilter(props) {
18347
18540
  }
18348
18541
  var anyOption = {};
18349
18542
  var DateFilter = class extends BaseFilter {
18543
+ hydrate(value) {
18544
+ if (!isDateFilterValue(value)) return void 0;
18545
+ const hydratedValue = parsePersistedPlainDate(value.value);
18546
+ return hydratedValue ? { op: value.op, value: hydratedValue } : void 0;
18547
+ }
18548
+ dehydrate(value) {
18549
+ return value ? { op: value.op, value: dehydratePlainDate(value.value) } : void 0;
18550
+ }
18350
18551
  render(value, setValue, tid, inModal, vertical) {
18351
- const { label, operations, getOperationValue, getOperationLabel } = this.props;
18552
+ const { label, operations, getOperationValue, getOperationLabel, defaultValue } = this.props;
18352
18553
  return /* @__PURE__ */ jsxs65(Fragment28, { children: [
18353
18554
  vertical && /* @__PURE__ */ jsx127(Label, { label }),
18354
18555
  /* @__PURE__ */ jsxs65(CompoundField, { children: [
@@ -18365,8 +18566,8 @@ var DateFilter = class extends BaseFilter {
18365
18566
  getOptionLabel: (o) => o === anyOption ? "Any" : getOperationLabel(o),
18366
18567
  value: value?.op,
18367
18568
  onSelect: (op) => (
18368
- // default the selected date to today if it doesn't exist in the filter's value
18369
- setValue(op ? { op, value: value?.value ? new Date(value.value) : /* @__PURE__ */ new Date() } : void 0)
18569
+ // default the selected date to the filter's default date or today if it doesn't exist in the filter's value
18570
+ setValue(op ? { op, value: value?.value ?? defaultValue?.value ?? todayPlainDate() } : void 0)
18370
18571
  ),
18371
18572
  label: inModal ? `${label} date filter operation` : label,
18372
18573
  labelStyle: !inModal && !vertical ? "inline" : inModal || vertical ? "hidden" : "above",
@@ -18378,9 +18579,13 @@ var DateFilter = class extends BaseFilter {
18378
18579
  DateField,
18379
18580
  {
18380
18581
  labelStyle: "inline",
18381
- value: value?.value ? new Date(value.value) : /* @__PURE__ */ new Date(),
18582
+ value: value?.value ?? defaultValue?.value ?? todayPlainDate(),
18382
18583
  label: "Date",
18383
- onChange: (d) => setValue({ ...value, value: d }),
18584
+ onChange: (d) => {
18585
+ if (d && value) {
18586
+ setValue({ ...value, value: d });
18587
+ }
18588
+ },
18384
18589
  disabled: !value,
18385
18590
  ...tid[`${defaultTestId(this.label)}_dateField`]
18386
18591
  }
@@ -18389,6 +18594,9 @@ var DateFilter = class extends BaseFilter {
18389
18594
  ] });
18390
18595
  }
18391
18596
  };
18597
+ function isDateFilterValue(value) {
18598
+ return typeof value === "object" && value !== null && "op" in value && "value" in value;
18599
+ }
18392
18600
 
18393
18601
  // src/components/Filters/DateRangeFilter.tsx
18394
18602
  import { Fragment as Fragment29, jsx as jsx128, jsxs as jsxs66 } from "react/jsx-runtime";
@@ -18396,6 +18604,17 @@ function dateRangeFilter(props) {
18396
18604
  return (key) => new DateRangeFilter(key, props);
18397
18605
  }
18398
18606
  var DateRangeFilter = class extends BaseFilter {
18607
+ hydrate(value) {
18608
+ if (!isDateRangeFilterValue(value)) return void 0;
18609
+ const hydratedValue = hydrateDateRange(value.value);
18610
+ return hydratedValue ? { op: value.op, value: hydratedValue } : void 0;
18611
+ }
18612
+ dehydrate(value) {
18613
+ return value ? {
18614
+ op: value.op,
18615
+ value: value.value ? { from: dehydratePlainDate(value.value.from), to: dehydratePlainDate(value.value.to) } : void 0
18616
+ } : void 0;
18617
+ }
18399
18618
  render(value, setValue, tid, inModal, vertical) {
18400
18619
  const { label, placeholderText, disabledDays, testFieldLabel, defaultValue } = this.props;
18401
18620
  return /* @__PURE__ */ jsxs66(Fragment29, { children: [
@@ -18407,8 +18626,17 @@ var DateRangeFilter = class extends BaseFilter {
18407
18626
  isRangeFilterField: true,
18408
18627
  placeholder: placeholderText,
18409
18628
  label: testFieldLabel ?? "Date",
18410
- value: value?.value ? { from: new Date(value.value.from), to: new Date(value.value.to) } : void 0,
18411
- onChange: (d) => d ? setValue({ op: defaultValue?.op, value: d }) : setValue(void 0),
18629
+ value: value?.value,
18630
+ onChange: (d) => {
18631
+ if (!d) {
18632
+ setValue(void 0);
18633
+ return;
18634
+ }
18635
+ const op = value?.op ?? defaultValue?.op;
18636
+ if (op !== void 0) {
18637
+ setValue({ op, value: d });
18638
+ }
18639
+ },
18412
18640
  disabledDays,
18413
18641
  ...tid[`${defaultTestId(this.label)}_dateField`]
18414
18642
  }
@@ -18416,6 +18644,17 @@ var DateRangeFilter = class extends BaseFilter {
18416
18644
  ] });
18417
18645
  }
18418
18646
  };
18647
+ function isDateRangeFilterValue(value) {
18648
+ return typeof value === "object" && value !== null && "op" in value && "value" in value;
18649
+ }
18650
+ function hydrateDateRange(value) {
18651
+ if (typeof value !== "object" || value === null) return void 0;
18652
+ const { from, to } = value;
18653
+ const hydratedFrom = parsePersistedPlainDate(from);
18654
+ const hydratedTo = parsePersistedPlainDate(to);
18655
+ if (hydratedFrom === void 0 && hydratedTo === void 0) return void 0;
18656
+ return { from: hydratedFrom, to: hydratedTo };
18657
+ }
18419
18658
 
18420
18659
  // src/components/Filters/MultiFilter.tsx
18421
18660
  import { jsx as jsx129 } from "react/jsx-runtime";
@@ -18977,7 +19216,7 @@ function toPageNumberSize(page) {
18977
19216
  }
18978
19217
 
18979
19218
  // src/components/Table/components/EditColumnsButton.tsx
18980
- import { Fragment as Fragment33, useCallback as useCallback22, useMemo as useMemo36, useRef as useRef44 } from "react";
19219
+ import { Fragment as Fragment33, useCallback as useCallback22, useMemo as useMemo36, useRef as useRef45 } from "react";
18981
19220
  import { useMenuTrigger as useMenuTrigger3 } from "react-aria";
18982
19221
  import { useMenuTriggerState as useMenuTriggerState3 } from "react-stately";
18983
19222
  import { jsx as jsx141, jsxs as jsxs72 } from "react/jsx-runtime";
@@ -18992,7 +19231,7 @@ function EditColumnsButton(props) {
18992
19231
  const state = useMenuTriggerState3({
18993
19232
  isOpen: defaultOpen
18994
19233
  });
18995
- const buttonRef = useRef44(null);
19234
+ const buttonRef = useRef45(null);
18996
19235
  const {
18997
19236
  menuTriggerProps
18998
19237
  } = useMenuTrigger3({
@@ -19221,10 +19460,10 @@ function useGridTableLayoutState({
19221
19460
  });
19222
19461
  useEffect27(() => {
19223
19462
  if (page.limit !== persistedPageSize) setPersistedPageSize(page.limit);
19224
- setPage((prev) => ({
19463
+ setPage((prev) => prev.offset === 0 ? prev : {
19225
19464
  ...prev,
19226
19465
  offset: 0
19227
- }));
19466
+ });
19228
19467
  }, [page.limit, persistedPageSize, setPersistedPageSize, filter, searchString]);
19229
19468
  return {
19230
19469
  filter,
@@ -19485,18 +19724,18 @@ var BeamContext = createContext7({
19485
19724
  });
19486
19725
  function BeamProvider({ children, ...presentationProps }) {
19487
19726
  const [, tick] = useReducer((prev) => prev + 1, 0);
19488
- const modalRef = useRef45();
19727
+ const modalRef = useRef46();
19489
19728
  const modalHeaderDiv = useMemo40(() => document.createElement("div"), []);
19490
19729
  const modalBodyDiv = useMemo40(() => {
19491
19730
  const el = document.createElement("div");
19492
19731
  el.style.height = "100%";
19493
19732
  return el;
19494
19733
  }, []);
19495
- const modalCanCloseChecksRef = useRef45([]);
19734
+ const modalCanCloseChecksRef = useRef46([]);
19496
19735
  const modalFooterDiv = useMemo40(() => document.createElement("div"), []);
19497
- const drawerContentStackRef = useRef45([]);
19498
- const drawerCanCloseChecks = useRef45([]);
19499
- const drawerCanCloseDetailsChecks = useRef45([]);
19736
+ const drawerContentStackRef = useRef46([]);
19737
+ const drawerCanCloseChecks = useRef46([]);
19738
+ const drawerCanCloseDetailsChecks = useRef46([]);
19500
19739
  const sdHeaderDiv = useMemo40(() => document.createElement("div"), []);
19501
19740
  const context = useMemo40(() => {
19502
19741
  return {
@@ -19539,14 +19778,14 @@ function useBeamContext() {
19539
19778
  }
19540
19779
 
19541
19780
  // src/components/ButtonDatePicker.tsx
19542
- import { useRef as useRef46 } from "react";
19781
+ import { useRef as useRef47 } from "react";
19543
19782
  import { useMenuTrigger as useMenuTrigger4 } from "react-aria";
19544
19783
  import { useMenuTriggerState as useMenuTriggerState4 } from "react-stately";
19545
19784
  import { jsx as jsx150 } from "react/jsx-runtime";
19546
19785
  function ButtonDatePicker(props) {
19547
19786
  const { defaultOpen, disabled, trigger, onSelect, ...datePickerProps } = props;
19548
19787
  const state = useMenuTriggerState4({ isOpen: defaultOpen });
19549
- const buttonRef = useRef46(null);
19788
+ const buttonRef = useRef47(null);
19550
19789
  const {
19551
19790
  menuTriggerProps,
19552
19791
  menuProps: { autoFocus: _af, ...menuProps }
@@ -19569,7 +19808,7 @@ function ButtonDatePicker(props) {
19569
19808
  }
19570
19809
 
19571
19810
  // src/components/ButtonGroup.tsx
19572
- import { useRef as useRef47 } from "react";
19811
+ import { useRef as useRef48 } from "react";
19573
19812
  import { useButton as useButton10, useFocusRing as useFocusRing12, useHover as useHover15 } from "react-aria";
19574
19813
  import { trussProps as trussProps73 } from "@homebound/truss/runtime";
19575
19814
  import { jsx as jsx151, jsxs as jsxs78 } from "react/jsx-runtime";
@@ -19617,7 +19856,7 @@ function GroupButton(props) {
19617
19856
  isDisabled: !!disabled,
19618
19857
  ...otherProps
19619
19858
  };
19620
- const ref = useRef47(null);
19859
+ const ref = useRef48(null);
19621
19860
  const {
19622
19861
  buttonProps,
19623
19862
  isPressed
@@ -19740,7 +19979,7 @@ import { useHover as useHover16 } from "react-aria";
19740
19979
 
19741
19980
  // src/components/Tag.tsx
19742
19981
  import { useResizeObserver as useResizeObserver4 } from "@react-aria/utils";
19743
- import { useRef as useRef48, useState as useState44 } from "react";
19982
+ import { useRef as useRef49, useState as useState44 } from "react";
19744
19983
  import { trussProps as trussProps74 } from "@homebound/truss/runtime";
19745
19984
  import { jsx as jsx152, jsxs as jsxs79 } from "react/jsx-runtime";
19746
19985
  function Tag(props) {
@@ -19754,7 +19993,7 @@ function Tag(props) {
19754
19993
  const typeStyles2 = getStyles(type);
19755
19994
  const tid = useTestIds(otherProps);
19756
19995
  const [showTooltip, setShowTooltip] = useState44(false);
19757
- const ref = useRef48(null);
19996
+ const ref = useRef49(null);
19758
19997
  useResizeObserver4({
19759
19998
  ref,
19760
19999
  onResize: () => {
@@ -19963,7 +20202,7 @@ function Copy(props) {
19963
20202
 
19964
20203
  // src/components/DnDGrid/DnDGrid.tsx
19965
20204
  import equal2 from "fast-deep-equal";
19966
- import { useCallback as useCallback24, useRef as useRef49 } from "react";
20205
+ import { useCallback as useCallback24, useRef as useRef50 } from "react";
19967
20206
 
19968
20207
  // src/components/DnDGrid/DnDGridContext.tsx
19969
20208
  import { createContext as createContext8, useContext as useContext18 } from "react";
@@ -19986,12 +20225,12 @@ function DnDGrid(props) {
19986
20225
  onReorder,
19987
20226
  activeItemStyles
19988
20227
  } = props;
19989
- const gridEl = useRef49(null);
19990
- const dragEl = useRef49();
19991
- const cloneEl = useRef49();
19992
- const initialOrder = useRef49();
19993
- const reorderViaKeyboard = useRef49(false);
19994
- const transformFrom = useRef49({
20228
+ const gridEl = useRef50(null);
20229
+ const dragEl = useRef50();
20230
+ const cloneEl = useRef50();
20231
+ const initialOrder = useRef50();
20232
+ const reorderViaKeyboard = useRef50(false);
20233
+ const transformFrom = useRef50({
19995
20234
  x: 0,
19996
20235
  y: 0
19997
20236
  });
@@ -20453,14 +20692,14 @@ function HbSpinnerProvider({
20453
20692
 
20454
20693
  // src/components/MaxLines.tsx
20455
20694
  import { useLayoutEffect as useLayoutEffect2, useResizeObserver as useResizeObserver5 } from "@react-aria/utils";
20456
- import { useCallback as useCallback25, useEffect as useEffect30, useRef as useRef50, useState as useState45 } from "react";
20695
+ import { useCallback as useCallback25, useEffect as useEffect30, useRef as useRef51, useState as useState45 } from "react";
20457
20696
  import { trussProps as trussProps80 } from "@homebound/truss/runtime";
20458
20697
  import { jsx as jsx160, jsxs as jsxs82 } from "react/jsx-runtime";
20459
20698
  function MaxLines({
20460
20699
  maxLines,
20461
20700
  children
20462
20701
  }) {
20463
- const elRef = useRef50(null);
20702
+ const elRef = useRef51(null);
20464
20703
  const [hasMore, setHasMore] = useState45(false);
20465
20704
  const [expanded, setExpanded] = useState45(false);
20466
20705
  useLayoutEffect2(() => {
@@ -20496,7 +20735,7 @@ function MaxLines({
20496
20735
 
20497
20736
  // src/components/ScrollShadows.tsx
20498
20737
  import { useResizeObserver as useResizeObserver6 } from "@react-aria/utils";
20499
- import { useCallback as useCallback26, useMemo as useMemo47, useRef as useRef51, useState as useState46 } from "react";
20738
+ import { useCallback as useCallback26, useMemo as useMemo47, useRef as useRef52, useState as useState46 } from "react";
20500
20739
  import { trussProps as trussProps81 } from "@homebound/truss/runtime";
20501
20740
  import { jsx as jsx161, jsxs as jsxs83 } from "react/jsx-runtime";
20502
20741
  function ScrollShadows(props) {
@@ -20516,7 +20755,7 @@ function ScrollShadows(props) {
20516
20755
  }
20517
20756
  const [showStartShadow, setShowStartShadow] = useState46(false);
20518
20757
  const [showEndShadow, setShowEndShadow] = useState46(false);
20519
- const scrollRef = useRef51(null);
20758
+ const scrollRef = useRef52(null);
20520
20759
  const [startShadowStyles, endShadowStyles] = useMemo47(() => {
20521
20760
  const transparentBgColor = bgColor.replace(/,1\)$/, ",0)");
20522
20761
  const commonStyles = {
@@ -20689,7 +20928,7 @@ function useSnackbar() {
20689
20928
  var snackbarId = 1;
20690
20929
 
20691
20930
  // src/components/Stepper.tsx
20692
- import { useRef as useRef52 } from "react";
20931
+ import { useRef as useRef53 } from "react";
20693
20932
  import { useButton as useButton11, useFocusRing as useFocusRing14, useHover as useHover18 } from "react-aria";
20694
20933
  import { trussProps as trussProps82 } from "@homebound/truss/runtime";
20695
20934
  import { jsx as jsx162, jsxs as jsxs84 } from "react/jsx-runtime";
@@ -20767,7 +21006,7 @@ function StepButton(props) {
20767
21006
  onPress: onClick,
20768
21007
  isDisabled: disabled
20769
21008
  };
20770
- const ref = useRef52(null);
21009
+ const ref = useRef53(null);
20771
21010
  const {
20772
21011
  buttonProps,
20773
21012
  isPressed
@@ -21161,7 +21400,7 @@ function visit(rows, fn) {
21161
21400
 
21162
21401
  // src/components/Tabs.tsx
21163
21402
  import { camelCase as camelCase5 } from "change-case";
21164
- import { useEffect as useEffect32, useMemo as useMemo49, useRef as useRef53, useState as useState47 } from "react";
21403
+ import { useEffect as useEffect32, useMemo as useMemo49, useRef as useRef54, useState as useState47 } from "react";
21165
21404
  import { mergeProps as mergeProps26, useFocusRing as useFocusRing15, useHover as useHover19 } from "react-aria";
21166
21405
  import { matchPath, Route } from "react-router";
21167
21406
  import { Link as Link5, useLocation } from "react-router-dom";
@@ -21220,7 +21459,7 @@ function Tabs(props) {
21220
21459
  } = useFocusRing15();
21221
21460
  const tid = useTestIds(others, "tabs");
21222
21461
  const [active, setActive] = useState47(selected);
21223
- const ref = useRef53(null);
21462
+ const ref = useRef54(null);
21224
21463
  useEffect32(() => setActive(selected), [selected]);
21225
21464
  function onKeyUp(e) {
21226
21465
  if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
@@ -21618,6 +21857,7 @@ export {
21618
21857
  filterTestIdPrefix,
21619
21858
  formatDate,
21620
21859
  formatDateRange,
21860
+ formatPlainDate,
21621
21861
  formatValue,
21622
21862
  generateColumnId,
21623
21863
  getAlignment,