@homebound/beam 3.1.0-alpha.2 → 3.1.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 useRef39, useState as useState29 } from "react";
4905
+ import React13, { useEffect as useEffect19, useMemo as useMemo24, useRef as useRef38, useState as useState29 } from "react";
4906
4906
  import { Virtuoso as Virtuoso2 } from "react-virtuoso";
4907
4907
 
4908
4908
  // src/components/Layout/ScrollableContent.tsx
@@ -5482,50 +5482,27 @@ function useHover2(props) {
5482
5482
  }
5483
5483
 
5484
5484
  // src/hooks/usePersistedFilter.ts
5485
- import { useEffect as useEffect6, useMemo as useMemo8, useRef as useRef6 } from "react";
5485
+ import { useEffect as useEffect6, useMemo as useMemo8 } from "react";
5486
5486
  import { JsonParam, useQueryParams as useQueryParams2 } from "use-query-params";
5487
5487
  function usePersistedFilter({ storageKey, filterDefs }) {
5488
- const filterImpls = useMemo8(
5489
- () => Object.fromEntries(safeEntries(filterDefs).map(([key, def]) => [key, def(key)])),
5490
- [filterDefs]
5491
- );
5492
- const filterKeys = useMemo8(() => Object.keys(filterImpls), [filterImpls]);
5488
+ const filterKeys = Object.keys(filterDefs);
5493
5489
  const defaultFilter = useMemo8(
5494
5490
  () => Object.fromEntries(
5495
- safeEntries(filterImpls).filter(([, def]) => def.defaultValue !== void 0).map(([key, def]) => [key, def.defaultValue])
5491
+ safeEntries(filterDefs).filter(([key, def]) => def(key).defaultValue !== void 0).map(([key, def]) => [key, def(key).defaultValue])
5496
5492
  ),
5497
- [filterImpls]
5493
+ [filterDefs]
5498
5494
  );
5499
5495
  const [{ filter: queryParamsFilter }, setQueryParams] = useQueryParams2({ filter: JsonParam });
5500
- const [storedFilter, setStoredFilter] = useSessionStorage(
5501
- storageKey,
5502
- dehydrateFilter(filterImpls, defaultFilter) ?? defaultFilter
5503
- );
5496
+ const [storedFilter, setStoredFilter] = useSessionStorage(storageKey, queryParamsFilter ?? defaultFilter);
5504
5497
  const isQueryParamFilterValid = hasValidFilterKeys(queryParamsFilter, filterKeys);
5505
- const 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) });
5498
+ const filter = isQueryParamFilterValid ? queryParamsFilter : storedFilter ?? defaultFilter;
5499
+ const setFilter = (filter2) => setQueryParams({ filter: filter2 });
5523
5500
  useEffect6(
5524
5501
  () => {
5525
5502
  if (queryParamsFilter === void 0) {
5526
5503
  setQueryParams({ filter: storedFilter }, "replaceIn");
5527
5504
  } else if (!isQueryParamFilterValid) {
5528
- setQueryParams({ filter: dehydrateFilter(filterImpls, defaultFilter) }, "replaceIn");
5505
+ setQueryParams({ filter: defaultFilter }, "replaceIn");
5529
5506
  } else if (JSON.stringify(queryParamsFilter) !== JSON.stringify(storedFilter)) {
5530
5507
  setStoredFilter(queryParamsFilter);
5531
5508
  }
@@ -5537,45 +5514,7 @@ function usePersistedFilter({ storageKey, filterDefs }) {
5537
5514
  return { setFilter, filter };
5538
5515
  }
5539
5516
  function hasValidFilterKeys(queryParamsFilter, definedKeys) {
5540
- return !!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;
5517
+ return queryParamsFilter && safeKeys(queryParamsFilter).every((key) => definedKeys.includes(key));
5579
5518
  }
5580
5519
 
5581
5520
  // src/hooks/useSessionStorage.ts
@@ -5998,122 +5937,21 @@ function CollapseToggle(props) {
5998
5937
  import { useContext as useContext12 } from "react";
5999
5938
 
6000
5939
  // src/inputs/Autocomplete.tsx
6001
- import { useCallback as useCallback10, useRef as useRef24 } from "react";
5940
+ import { useCallback as useCallback10, useRef as useRef23 } from "react";
6002
5941
  import { useComboBox as useComboBox3, useOverlayPosition as useOverlayPosition5 } from "react-aria";
6003
5942
  import { Item as Item5, useComboBoxState as useComboBoxState3 } from "react-stately";
6004
5943
 
6005
5944
  // src/components/internal/DatePicker/DatePicker.tsx
6006
5945
  import { DayPicker } from "react-day-picker";
6007
5946
 
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
-
6109
5947
  // src/components/internal/DatePicker/Day.tsx
6110
- import { useRef as useRef7 } from "react";
5948
+ import { useRef as useRef6 } from "react";
6111
5949
  import { useDayRender } from "react-day-picker";
6112
5950
  import { trussProps as trussProps12, mergeProps as mergeProps3 } from "@homebound/truss/runtime";
6113
5951
  import { Fragment as Fragment5, jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
6114
5952
  function Day(props) {
6115
5953
  const tid = useTestIds(props, "datePickerDay");
6116
- const buttonRef = useRef7(null);
5954
+ const buttonRef = useRef6(null);
6117
5955
  const {
6118
5956
  isHidden,
6119
5957
  isButton,
@@ -6240,19 +6078,18 @@ var rangeBaseStyles = {
6240
6078
  };
6241
6079
 
6242
6080
  // src/components/internal/DatePicker/Header.tsx
6243
- import { addMonths, addYears } from "date-fns";
6081
+ import { addMonths, addYears, format } from "date-fns";
6244
6082
  import { useNavigation } from "react-day-picker";
6245
6083
  import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
6246
6084
  function Header(props) {
6247
6085
  const {
6248
6086
  displayMonth
6249
6087
  } = props;
6250
- const displayMonthDate = jsDateToPlainDate(displayMonth);
6251
6088
  const {
6252
6089
  goToMonth
6253
6090
  } = useNavigation();
6254
6091
  return /* @__PURE__ */ jsxs10("div", { className: "df jcsb aic ml_12px mr_2px h_32px", children: [
6255
- /* @__PURE__ */ jsx17("h1", { className: "fw4 fz_16px lh_24px", children: formatPlainDate(displayMonthDate, "monthYear") }),
6092
+ /* @__PURE__ */ jsx17("h1", { className: "fw4 fz_16px lh_24px", children: format(displayMonth, "MMMM yyyy") }),
6256
6093
  /* @__PURE__ */ jsxs10("div", { children: [
6257
6094
  /* @__PURE__ */ jsx17(IconButton, { color: "rgba(100, 100, 100, 1)" /* Gray700 */, icon: "chevronLeft", onClick: () => goToMonth(addMonths(displayMonth, -1)) }),
6258
6095
  /* @__PURE__ */ jsx17(IconButton, { color: "rgba(100, 100, 100, 1)" /* Gray700 */, icon: "chevronRight", onClick: () => goToMonth(addMonths(displayMonth, 1)) })
@@ -6263,41 +6100,36 @@ function YearSkipHeader(props) {
6263
6100
  const {
6264
6101
  displayMonth
6265
6102
  } = props;
6266
- const displayMonthDate = jsDateToPlainDate(displayMonth);
6267
6103
  const {
6268
6104
  goToMonth
6269
6105
  } = useNavigation();
6270
6106
  return /* @__PURE__ */ jsxs10("div", { className: "df jcsb aic ml_12px mr_12px h_32px", children: [
6271
6107
  /* @__PURE__ */ jsxs10("div", { className: "df fdr jcsb", children: [
6272
6108
  /* @__PURE__ */ jsx17(IconButton, { color: "rgba(100, 100, 100, 1)" /* Gray700 */, icon: "chevronLeft", onClick: () => goToMonth(addMonths(displayMonth, -1)) }),
6273
- /* @__PURE__ */ jsx17("h1", { className: "fw4 fz_16px lh_24px", children: formatPlainDate(displayMonthDate, "shortMonth") }),
6109
+ /* @__PURE__ */ jsx17("h1", { className: "fw4 fz_16px lh_24px", children: format(displayMonth, "MMM") }),
6274
6110
  /* @__PURE__ */ jsx17(IconButton, { color: "rgba(100, 100, 100, 1)" /* Gray700 */, icon: "chevronRight", onClick: () => goToMonth(addMonths(displayMonth, 1)) })
6275
6111
  ] }),
6276
6112
  /* @__PURE__ */ jsxs10("div", { className: "df fdr jcsb", children: [
6277
6113
  /* @__PURE__ */ jsx17(IconButton, { color: "rgba(100, 100, 100, 1)" /* Gray700 */, icon: "chevronLeft", onClick: () => goToMonth(addYears(displayMonth, -1)) }),
6278
- /* @__PURE__ */ jsx17("h1", { className: "fw4 fz_16px lh_24px", children: formatPlainDate(displayMonthDate, "year") }),
6114
+ /* @__PURE__ */ jsx17("h1", { className: "fw4 fz_16px lh_24px", children: format(displayMonth, "yyyy") }),
6279
6115
  /* @__PURE__ */ jsx17(IconButton, { color: "rgba(100, 100, 100, 1)" /* Gray700 */, icon: "chevronRight", onClick: () => goToMonth(addYears(displayMonth, 1)) })
6280
6116
  ] })
6281
6117
  ] });
6282
6118
  }
6283
6119
 
6284
6120
  // src/components/internal/DatePicker/WeekHeader.tsx
6121
+ import { addDays, format as format2, startOfWeek } from "date-fns";
6285
6122
  import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
6286
6123
  function WeekHeader() {
6287
- const today = todayPlainDate();
6288
- const start = today.subtract({
6289
- days: today.dayOfWeek % 7
6290
- });
6124
+ const start = startOfWeek(/* @__PURE__ */ new Date());
6291
6125
  const days = [];
6292
6126
  for (let i = 0; i < 7; i++) {
6293
- days.push(start.add({
6294
- days: i
6295
- }));
6127
+ days.push(addDays(start, i));
6296
6128
  }
6297
6129
  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: [
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"))) }) });
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"))) }) });
6301
6133
  }
6302
6134
 
6303
6135
  // src/components/internal/DatePicker/DatePicker.tsx
@@ -6319,15 +6151,15 @@ function DatePicker(props) {
6319
6151
  Head: WeekHeader,
6320
6152
  Day
6321
6153
  },
6322
- selected: value ? [plainDateToJsDate(value)] : [],
6323
- defaultMonth: plainDateToJsDate(value ?? todayPlainDate()),
6154
+ selected: value ? [value] : [],
6155
+ defaultMonth: value ?? /* @__PURE__ */ new Date(),
6324
6156
  onDayClick: (day, modifiers) => {
6325
6157
  if (modifiers.disabled) return;
6326
- onSelect(jsDateToPlainDate(day));
6158
+ onSelect(day);
6327
6159
  },
6328
- disabled: dateMatchersToDayPickerMatchers(disabledDays),
6160
+ disabled: disabledDays,
6329
6161
  modifiers: {
6330
- indicatorDot: dateMatchersToDayPickerMatchers(dottedDays) ?? []
6162
+ indicatorDot: dottedDays ?? []
6331
6163
  }
6332
6164
  }
6333
6165
  ) });
@@ -6354,21 +6186,21 @@ function DateRangePicker(props) {
6354
6186
  useYearPicker
6355
6187
  } = props;
6356
6188
  const tid = useTestIds(props, "datePicker");
6357
- return /* @__PURE__ */ jsx21("div", { className: "dib bgWhite fw4 fz_12px lh_16px", ...tid, children: /* @__PURE__ */ jsx21(DayPicker2, { mode: "range", selected: dateRangeToJsDateRange(range), components: {
6189
+ return /* @__PURE__ */ jsx21("div", { className: "dib bgWhite fw4 fz_12px lh_16px", ...tid, children: /* @__PURE__ */ jsx21(DayPicker2, { mode: "range", selected: range, components: {
6358
6190
  Caption: useYearPicker ? YearSkipHeader : Header,
6359
6191
  Head: WeekHeader,
6360
6192
  Day
6361
- }, defaultMonth: plainDateToJsDate(range?.to ?? range?.from ?? todayPlainDate()), onSelect: (selection, day, activeModifiers) => {
6193
+ }, defaultMonth: range?.to ?? /* @__PURE__ */ new Date(), onSelect: (selection, day, activeModifiers) => {
6362
6194
  if (activeModifiers.disabled) return;
6363
- onSelect(jsDateRangeToDateRange(selection));
6364
- }, disabled: dateMatchersToDayPickerMatchers(disabledDays), modifiers: {
6365
- indicatorDot: dateMatchersToDayPickerMatchers(dottedDays) ?? []
6195
+ onSelect(selection);
6196
+ }, disabled: disabledDays, modifiers: {
6197
+ indicatorDot: dottedDays ?? []
6366
6198
  } }) });
6367
6199
  }
6368
6200
 
6369
6201
  // src/components/internal/Menu.tsx
6370
6202
  import { camelCase } from "change-case";
6371
- import { useEffect as useEffect8, useMemo as useMemo9, useRef as useRef11, useState as useState11 } from "react";
6203
+ import { useEffect as useEffect8, useMemo as useMemo9, useRef as useRef10, useState as useState11 } from "react";
6372
6204
  import { FocusScope, useFilter as useFilter2, useMenu } from "react-aria";
6373
6205
  import { Item, Section, useTreeData, useTreeState } from "react-stately";
6374
6206
 
@@ -6413,7 +6245,7 @@ import { trussProps as trussProps21 } from "@homebound/truss/runtime";
6413
6245
 
6414
6246
  // src/inputs/internal/MenuSearchField.tsx
6415
6247
  import { useTextField } from "@react-aria/textfield";
6416
- import { useRef as useRef10 } from "react";
6248
+ import { useRef as useRef9 } from "react";
6417
6249
 
6418
6250
  // src/inputs/TextFieldBase.tsx
6419
6251
  import { useState as useState10 } from "react";
@@ -6512,7 +6344,7 @@ function InlineLabel({
6512
6344
 
6513
6345
  // src/components/Table/components/Row.tsx
6514
6346
  import { observer } from "mobx-react";
6515
- import React6, { useCallback as useCallback6, useContext as useContext10, useRef as useRef9 } from "react";
6347
+ import React6, { useCallback as useCallback6, useContext as useContext10, useRef as useRef8 } from "react";
6516
6348
  import { mergeProps as mergeProps5 } from "react-aria";
6517
6349
 
6518
6350
  // src/components/Table/components/cell.tsx
@@ -6578,7 +6410,7 @@ var rowClickRenderFn = (as, api, colSpan) => (key, css2, content, row, rowStyle,
6578
6410
  };
6579
6411
 
6580
6412
  // src/components/Table/components/ColumnResizeHandle.tsx
6581
- import { useCallback as useCallback5, useContext as useContext8, useEffect as useEffect7, useRef as useRef8, useState as useState9 } from "react";
6413
+ import { useCallback as useCallback5, useContext as useContext8, useEffect as useEffect7, useRef as useRef7, useState as useState9 } from "react";
6582
6414
  import { trussProps as trussProps16 } from "@homebound/truss/runtime";
6583
6415
  import { Fragment as Fragment7, jsx as jsx26, jsxs as jsxs14 } from "react/jsx-runtime";
6584
6416
  function findScrollableParent(element) {
@@ -6616,13 +6448,13 @@ function ColumnResizeHandle({
6616
6448
  const [guideLineX, setGuideLineX] = useState9(null);
6617
6449
  const [guideLineTop, setGuideLineTop] = useState9(0);
6618
6450
  const [guideLineHeight, setGuideLineHeight] = useState9(0);
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);
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);
6626
6458
  const tid = useTestIds({}, "columnResizeHandle");
6627
6459
  const handleMouseDown = useCallback5((e) => {
6628
6460
  e.preventDefault();
@@ -7764,7 +7596,7 @@ function RowImpl(props) {
7764
7596
  let foundFirstContentColumn = false;
7765
7597
  let minStickyLeftOffset = 0;
7766
7598
  let expandColumnHidden = false;
7767
- const ref = useRef9(null);
7599
+ const ref = useRef8(null);
7768
7600
  const dragOverCallback = useCallback6((row2, evt) => onDragOver?.(row2, evt), [onDragOver]);
7769
7601
  const onDragOverDebounced = useDebouncedCallback2(dragOverCallback, 100);
7770
7602
  const RowContent = () => /* @__PURE__ */ jsx28(RowTag, { ...mergeProps_12(BorderHoverParent, void 0, rowCss), ...others, "data-gridrow": true, ...getCount(row.id), ref, children: isKeptGroupRow ? /* @__PURE__ */ jsx28(KeptGroupRow, { as, style, columnSizes, row, colSpan: columns.length, isLastBodyRow }) : columns.map((column2, columnIndex) => {
@@ -8530,7 +8362,7 @@ var textFieldBaseMultilineTopPadding = 11;
8530
8362
  import { jsx as jsx31 } from "react/jsx-runtime";
8531
8363
  function MenuSearchField(props) {
8532
8364
  const tid = useTestIds(props);
8533
- const inputRef = useRef10(null);
8365
+ const inputRef = useRef9(null);
8534
8366
  const { labelProps, inputProps } = useTextField({ ...props }, inputRef);
8535
8367
  return /* @__PURE__ */ jsx31(
8536
8368
  TextFieldBase,
@@ -8614,7 +8446,7 @@ function Menu(props) {
8614
8446
  keys !== "all" && onChange && onChange([...keys.values()].map((k) => k.toString())[0]);
8615
8447
  }
8616
8448
  });
8617
- const menuRef = useRef11(null);
8449
+ const menuRef = useRef10(null);
8618
8450
  const {
8619
8451
  menuProps
8620
8452
  } = useMenu({
@@ -8656,7 +8488,7 @@ function Menu(props) {
8656
8488
  }
8657
8489
 
8658
8490
  // src/components/internal/MenuItem.tsx
8659
- import { useRef as useRef14 } from "react";
8491
+ import { useRef as useRef13 } from "react";
8660
8492
  import { useHover as useHover7, useMenuItem } from "react-aria";
8661
8493
  import { useHistory } from "react-router";
8662
8494
  import { Link as Link3 } from "react-router-dom";
@@ -8911,12 +8743,12 @@ var pressedOverlayCss = {
8911
8743
  };
8912
8744
 
8913
8745
  // src/components/ButtonModal.tsx
8914
- import { useRef as useRef13 } from "react";
8746
+ import { useRef as useRef12 } from "react";
8915
8747
  import { useMenuTrigger } from "react-aria";
8916
8748
  import { useMenuTriggerState } from "react-stately";
8917
8749
 
8918
8750
  // src/components/internal/OverlayTrigger.tsx
8919
- import { useMemo as useMemo13, useRef as useRef12 } from "react";
8751
+ import { useMemo as useMemo13, useRef as useRef11 } from "react";
8920
8752
  import { useOverlayPosition } from "react-aria";
8921
8753
 
8922
8754
  // src/components/Button.tsx
@@ -9606,7 +9438,7 @@ function OverlayTrigger(props) {
9606
9438
  }
9607
9439
  }
9608
9440
  }), [menuTriggerProps, state]);
9609
- const popoverRef = useRef12(null);
9441
+ const popoverRef = useRef11(null);
9610
9442
  const {
9611
9443
  overlayProps: positionProps
9612
9444
  } = useOverlayPosition({
@@ -9668,7 +9500,7 @@ import { jsx as jsx39 } from "react/jsx-runtime";
9668
9500
  function ButtonModal(props) {
9669
9501
  const { storybookDefaultOpen, trigger, disabled, content, title } = props;
9670
9502
  const state = useMenuTriggerState({ isOpen: storybookDefaultOpen });
9671
- const buttonRef = useRef13(null);
9503
+ const buttonRef = useRef12(null);
9672
9504
  const { menuTriggerProps } = useMenuTrigger({ isDisabled: !!disabled }, state, buttonRef);
9673
9505
  const tid = useTestIds(
9674
9506
  props,
@@ -9752,7 +9584,7 @@ function MenuItemImpl(props) {
9752
9584
  const isDisabled = Boolean(disabled);
9753
9585
  const isSelected = state.selectionManager.selectedKeys.has(label);
9754
9586
  const isFocused = state.selectionManager.focusedKey === item.key;
9755
- const ref = useRef14(null);
9587
+ const ref = useRef13(null);
9756
9588
  const history = useHistory();
9757
9589
  const {
9758
9590
  hoverProps,
@@ -9899,7 +9731,7 @@ function Popover(props) {
9899
9731
  }
9900
9732
 
9901
9733
  // src/inputs/internal/ComboBoxBase.tsx
9902
- import { useCallback as useCallback9, useEffect as useEffect14, useMemo as useMemo16, useRef as useRef23, useState as useState19 } from "react";
9734
+ import { useCallback as useCallback9, useEffect as useEffect14, useMemo as useMemo16, useRef as useRef22, useState as useState19 } from "react";
9903
9735
  import { useButton as useButton7, useComboBox as useComboBox2, useFilter as useFilter4, useOverlayPosition as useOverlayPosition4 } from "react-aria";
9904
9736
  import { Item as Item4, useComboBoxState as useComboBoxState2 } from "react-stately";
9905
9737
  import { trussProps as trussProps39 } from "@homebound/truss/runtime";
@@ -9970,13 +9802,13 @@ function useGrowingTextField({ inputRef, inputWrapRef, value, disabled, maxLines
9970
9802
  }
9971
9803
 
9972
9804
  // src/inputs/TreeSelectField/TreeSelectField.tsx
9973
- import React9, { useCallback as useCallback8, useContext as useContext11, useEffect as useEffect13, useMemo as useMemo15, useRef as useRef22, useState as useState17 } from "react";
9805
+ import React9, { useCallback as useCallback8, useContext as useContext11, useEffect as useEffect13, useMemo as useMemo15, useRef as useRef21, useState as useState17 } from "react";
9974
9806
  import { useButton as useButton6, useComboBox, useFilter as useFilter3, useOverlayPosition as useOverlayPosition3 } from "react-aria";
9975
9807
  import { Item as Item3, useComboBoxState } from "react-stately";
9976
9808
  import { trussProps as trussProps37 } from "@homebound/truss/runtime";
9977
9809
 
9978
9810
  // src/inputs/internal/ListBox.tsx
9979
- import { useEffect as useEffect12, useRef as useRef21, useState as useState16 } from "react";
9811
+ import { useEffect as useEffect12, useRef as useRef20, useState as useState16 } from "react";
9980
9812
  import { useListBox } from "react-aria";
9981
9813
  import { trussProps as trussProps36 } from "@homebound/truss/runtime";
9982
9814
 
@@ -9989,17 +9821,17 @@ import { useListBoxSection, useSeparator as useSeparator2 } from "react-aria";
9989
9821
  import { trussProps as trussProps35 } from "@homebound/truss/runtime";
9990
9822
 
9991
9823
  // src/inputs/internal/Option.tsx
9992
- import { useRef as useRef17 } from "react";
9824
+ import { useRef as useRef16 } from "react";
9993
9825
  import { mergeProps as mergeProps12, useHover as useHover8, useOption } from "react-aria";
9994
9826
 
9995
9827
  // src/inputs/ChipSelectField.tsx
9996
9828
  import { camelCase as camelCase2 } from "change-case";
9997
- import { useEffect as useEffect10, useMemo as useMemo14, useRef as useRef16, useState as useState15 } from "react";
9829
+ import { useEffect as useEffect10, useMemo as useMemo14, useRef as useRef15, useState as useState15 } from "react";
9998
9830
  import { mergeProps as mergeProps11, useButton as useButton5, useFocus as useFocus2, useOverlayPosition as useOverlayPosition2, useSelect } from "react-aria";
9999
9831
  import { Item as Item2, Section as Section2, useListData, useSelectState } from "react-stately";
10000
9832
 
10001
9833
  // src/inputs/ChipTextField.tsx
10002
- import { useEffect as useEffect9, useRef as useRef15, useState as useState14 } from "react";
9834
+ import { useEffect as useEffect9, useRef as useRef14, useState as useState14 } from "react";
10003
9835
  import { useFocus } from "react-aria";
10004
9836
  import { trussProps as trussProps28 } from "@homebound/truss/runtime";
10005
9837
  import { jsx as jsx43 } from "react/jsx-runtime";
@@ -10018,7 +9850,7 @@ function ChipTextField(props) {
10018
9850
  const {
10019
9851
  fieldProps
10020
9852
  } = usePresentationContext();
10021
- const valueRef = useRef15(value);
9853
+ const valueRef = useRef14(value);
10022
9854
  const tid = useTestIds(props, "chipField");
10023
9855
  const [isFocused, setIsFocused] = useState14(false);
10024
9856
  const {
@@ -10039,7 +9871,7 @@ function ChipTextField(props) {
10039
9871
  onBlur: () => maybeCall(onBlur),
10040
9872
  onFocusChange: setIsFocused
10041
9873
  });
10042
- const fieldRef = useRef15(null);
9874
+ const fieldRef = useRef14(null);
10043
9875
  useEffect9(
10044
9876
  () => {
10045
9877
  autoFocus && fieldRef.current?.focus();
@@ -10146,7 +9978,7 @@ function defaultOptionLabel(opt) {
10146
9978
  import { trussProps as trussProps30 } from "@homebound/truss/runtime";
10147
9979
  import { Fragment as Fragment15, jsx as jsx45, jsxs as jsxs29 } from "react/jsx-runtime";
10148
9980
  function ChipSelectField(props) {
10149
- const firstRender = useRef16(true);
9981
+ const firstRender = useRef15(true);
10150
9982
  const {
10151
9983
  fieldProps
10152
9984
  } = usePresentationContext();
@@ -10204,10 +10036,10 @@ function ChipSelectField(props) {
10204
10036
  } = useFocus2({
10205
10037
  onFocusChange: setIsClearFocused
10206
10038
  });
10207
- const buttonRef = useRef16(null);
10208
- const popoverRef = useRef16(null);
10209
- const listBoxRef = useRef16(null);
10210
- const wrapperRef = useRef16(null);
10039
+ const buttonRef = useRef15(null);
10040
+ const popoverRef = useRef15(null);
10041
+ const listBoxRef = useRef15(null);
10042
+ const wrapperRef = useRef15(null);
10211
10043
  const listData = useListData({
10212
10044
  initialItems: !onCreateNew ? options : [{
10213
10045
  title: "Options",
@@ -10411,7 +10243,7 @@ function Option(props) {
10411
10243
  scrollToIndex,
10412
10244
  disabledReason
10413
10245
  } = props;
10414
- const ref = useRef17(null);
10246
+ const ref = useRef16(null);
10415
10247
  const {
10416
10248
  hoverProps,
10417
10249
  isHovered
@@ -10490,7 +10322,7 @@ function Option(props) {
10490
10322
 
10491
10323
  // src/inputs/internal/VirtualizedOptions.tsx
10492
10324
  import { getInteractionModality } from "@react-aria/interactions";
10493
- import { useEffect as useEffect11, useRef as useRef20 } from "react";
10325
+ import { useEffect as useEffect11, useRef as useRef19 } from "react";
10494
10326
  import { Virtuoso } from "react-virtuoso";
10495
10327
 
10496
10328
  // src/inputs/internal/LoadingDots.tsx
@@ -10538,11 +10370,11 @@ function LoadingDots({
10538
10370
  }
10539
10371
 
10540
10372
  // src/inputs/TreeSelectField/TreeOption.tsx
10541
- import { useRef as useRef19 } from "react";
10373
+ import { useRef as useRef18 } from "react";
10542
10374
  import { useHover as useHover10, useOption as useOption2 } from "react-aria";
10543
10375
 
10544
10376
  // src/inputs/CheckboxBase.tsx
10545
- import { useRef as useRef18 } from "react";
10377
+ import { useRef as useRef17 } from "react";
10546
10378
  import { mergeProps as mergeProps13, useFocusRing as useFocusRing5, useHover as useHover9, VisuallyHidden as VisuallyHidden3 } from "react-aria";
10547
10379
  import { trussProps as trussProps33 } from "@homebound/truss/runtime";
10548
10380
  import { jsx as jsx48, jsxs as jsxs32 } from "react/jsx-runtime";
@@ -10561,7 +10393,7 @@ function CheckboxBase(props) {
10561
10393
  tooltip,
10562
10394
  fullWidth = false
10563
10395
  } = props;
10564
- const ref = useRef18(null);
10396
+ const ref = useRef17(null);
10565
10397
  const {
10566
10398
  isFocusVisible,
10567
10399
  focusProps
@@ -10706,7 +10538,7 @@ function TreeOption(props) {
10706
10538
  const leveledOption = item.value;
10707
10539
  if (!leveledOption) return null;
10708
10540
  const [option, level] = leveledOption;
10709
- const ref = useRef19(null);
10541
+ const ref = useRef18(null);
10710
10542
  const {
10711
10543
  hoverProps,
10712
10544
  isHovered
@@ -10715,7 +10547,8 @@ function TreeOption(props) {
10715
10547
  const {
10716
10548
  collapsedKeys,
10717
10549
  setCollapsedKeys,
10718
- getOptionValue
10550
+ getOptionValue,
10551
+ groupKeys
10719
10552
  } = useTreeSelectFieldProvider();
10720
10553
  const {
10721
10554
  optionProps,
@@ -10727,6 +10560,12 @@ function TreeOption(props) {
10727
10560
  shouldSelectOnPressUp: true,
10728
10561
  shouldFocusOnHover: false
10729
10562
  }, state, ref);
10563
+ const isGroup = groupKeys.includes(item.key);
10564
+ const canCollapse = allowCollapsing && !!option.children?.length;
10565
+ function toggleCollapsed() {
10566
+ if (!canCollapse) return;
10567
+ setCollapsedKeys((prevKeys) => collapsedKeys.includes(item.key) ? prevKeys.filter((k) => k !== item.key) : [...prevKeys, item.key]);
10568
+ }
10730
10569
  const isIndeterminate = !isSelected && option.children?.some((o) => hasSelectedChildren(o, state, getOptionValue));
10731
10570
  const listItemStyles = {
10732
10571
  item: {
@@ -10754,7 +10593,12 @@ function TreeOption(props) {
10754
10593
  }]
10755
10594
  }
10756
10595
  };
10757
- return /* @__PURE__ */ jsxs33("li", { ...hoverProps, ...trussProps34({
10596
+ return /* @__PURE__ */ jsxs33("li", { ...hoverProps, onClick: (e) => {
10597
+ if (!isGroup) return;
10598
+ e.preventDefault();
10599
+ e.stopPropagation();
10600
+ toggleCollapsed();
10601
+ }, ...trussProps34({
10758
10602
  ...{
10759
10603
  display: "df",
10760
10604
  alignItems: "aic",
@@ -10771,18 +10615,18 @@ function TreeOption(props) {
10771
10615
  lineHeight: "lh_20px"
10772
10616
  },
10773
10617
  ...listItemStyles.item,
10774
- ...isHovered && !isDisabled ? listItemStyles.hover : {},
10775
- ...isFocused ? listItemStyles.focus : {},
10776
- ...isDisabled ? listItemStyles.disabled : {}
10618
+ ...isHovered && (!isDisabled || isGroup) ? listItemStyles.hover : {},
10619
+ ...isFocused && !isGroup ? listItemStyles.focus : {},
10620
+ ...isDisabled && !isGroup ? listItemStyles.disabled : {}
10777
10621
  }), children: [
10778
- allowCollapsing && /* @__PURE__ */ jsx49("span", { className: "w_18px fs0 df aic", children: option.children && option.children?.length > 0 && /* @__PURE__ */ jsx49("button", { onClick: (e) => {
10622
+ allowCollapsing && /* @__PURE__ */ jsx49("span", { className: "w_18px fs0 df aic", children: canCollapse && /* @__PURE__ */ jsx49("button", { onClick: (e) => {
10779
10623
  e.preventDefault();
10780
10624
  e.stopPropagation();
10781
- setCollapsedKeys((prevKeys) => collapsedKeys.includes(item.key) ? prevKeys.filter((k) => k !== item.key) : [...prevKeys, item.key]);
10625
+ toggleCollapsed();
10782
10626
  return false;
10783
10627
  }, className: "br4 h_16px w_16px bgTransparent h_bgGray300", ...tid[`collapseToggle_${item.key}`], children: /* @__PURE__ */ jsx49(Icon, { icon: collapsedKeys.includes(item.key) ? "triangleRight" : "triangleDown", inc: 2 }) }) }),
10784
10628
  /* @__PURE__ */ jsxs33("span", { className: "df aic gap1 h100 fg1 pt1 pb1 pr2", ref, ...optionProps, "data-label": item.textValue, children: [
10785
- /* @__PURE__ */ jsx49(StyledCheckbox, { isDisabled, isSelected, isIndeterminate, ...tid[item.key.toString()] }),
10629
+ !isGroup && /* @__PURE__ */ jsx49(StyledCheckbox, { isDisabled, isSelected, isIndeterminate, ...tid[item.key.toString()] }),
10786
10630
  /* @__PURE__ */ jsx49("div", { className: "pl1", children: item.rendered })
10787
10631
  ] })
10788
10632
  ] });
@@ -10844,7 +10688,7 @@ function VirtualizedOptions(props) {
10844
10688
  isTree,
10845
10689
  allowCollapsing
10846
10690
  } = props;
10847
- const virtuosoRef = useRef20(null);
10691
+ const virtuosoRef = useRef19(null);
10848
10692
  const focusedKey = state.selectionManager.focusedKey;
10849
10693
  const focusedItem = focusedKey != null ? state.collection.getItem(focusedKey) : null;
10850
10694
  const selectedItem = state.selectionManager.selectedKeys.size > 0 ? state.collection.getItem([...state.selectionManager.selectedKeys.values()][0]) : void 0;
@@ -10858,6 +10702,7 @@ function VirtualizedOptions(props) {
10858
10702
  // eslint-disable-next-line react-hooks/exhaustive-deps
10859
10703
  [focusedItem]
10860
10704
  );
10705
+ const key = process.env.NODE_ENV === "test" ? items.length : "virtuoso";
10861
10706
  return /* @__PURE__ */ jsx50(
10862
10707
  Virtuoso,
10863
10708
  {
@@ -10865,9 +10710,9 @@ function VirtualizedOptions(props) {
10865
10710
  totalListHeightChanged: onListHeightChange,
10866
10711
  totalCount: items.length,
10867
10712
  ...process.env.NODE_ENV === "test" ? {
10868
- // We don't really need to set this, but it's handy for tests, which would
10869
- // otherwise render just 1 row. A better way to do this would be to jest.mock
10870
- // out Virtuoso with an impl that just rendered everything, but doing this for now.
10713
+ // We don't really need to set this, but it's handy for tests, which would otherwise render
10714
+ // just 1 row. A better way to do this would be to jest.mock out Virtuoso with an impl that
10715
+ // just rendered everything, but doing this for now.
10871
10716
  initialItemCount: items.length
10872
10717
  } : {
10873
10718
  // Ensure the selected item is visible when the list renders
@@ -10908,7 +10753,7 @@ function VirtualizedOptions(props) {
10908
10753
  Footer: typeof loading === "function" ? loading : () => /* @__PURE__ */ jsx50(LoadingDots, { contrast })
10909
10754
  }
10910
10755
  },
10911
- items.length
10756
+ key
10912
10757
  );
10913
10758
  }
10914
10759
 
@@ -10998,9 +10843,9 @@ function ListBox(props) {
10998
10843
  const isMultiSelect = state.selectionManager.selectionMode === "multiple";
10999
10844
  const firstItem = state.collection.at(0);
11000
10845
  const hasSections = firstItem && firstItem.type === "section";
11001
- const selectedList = useRef21(null);
11002
- const firstRender = useRef21(true);
11003
- const virtuosoListHeight = useRef21(0);
10846
+ const selectedList = useRef20(null);
10847
+ const firstRender = useRef20(true);
10848
+ const virtuosoListHeight = useRef20(0);
11004
10849
  const onListHeightChange = (listHeight) => {
11005
10850
  virtuosoListHeight.current = listHeight;
11006
10851
  const height = (selectedList.current?.offsetHeight || 0) + listHeight;
@@ -11081,6 +10926,7 @@ function TreeSelectField(props) {
11081
10926
  ...otherProps
11082
10927
  } = props;
11083
10928
  const [collapsedKeys, setCollapsedKeys] = useState17([]);
10929
+ const groupKeys = useMemo15(() => props.groupOptions?.map((option) => valueToKey(option)) ?? [], [props.groupOptions]);
11084
10930
  useEffect13(() => {
11085
10931
  setCollapsedKeys(!Array.isArray(options) ? [] : defaultCollapsed ? options.map((o) => getOptionValue(o)) : options.flatMap(flattenOptions).filter((o) => o.defaultCollapsed).map((o) => getOptionValue(o)));
11086
10932
  }, [options, defaultCollapsed]);
@@ -11088,11 +10934,12 @@ function TreeSelectField(props) {
11088
10934
  () => ({
11089
10935
  collapsedKeys,
11090
10936
  setCollapsedKeys,
11091
- getOptionValue
10937
+ getOptionValue,
10938
+ groupKeys
11092
10939
  }),
11093
10940
  // TODO: validate this eslint-disable. It was automatically ignored as part of https://app.shortcut.com/homebound-team/story/40033/enable-react-hooks-exhaustive-deps-for-react-projects
11094
10941
  // eslint-disable-next-line react-hooks/exhaustive-deps
11095
- [collapsedKeys, setCollapsedKeys]
10942
+ [collapsedKeys, setCollapsedKeys, groupKeys]
11096
10943
  );
11097
10944
  return /* @__PURE__ */ jsx54(CollapsedContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx54(TreeSelectFieldBase, { ...otherProps, options, getOptionLabel, getOptionValue, values, onSelect: ({
11098
10945
  all,
@@ -11113,7 +10960,8 @@ var CollapsedContext = React9.createContext({
11113
10960
  collapsedKeys: [],
11114
10961
  setCollapsedKeys: () => {
11115
10962
  },
11116
- getOptionValue: () => ({})
10963
+ getOptionValue: () => ({}),
10964
+ groupKeys: []
11117
10965
  });
11118
10966
  function TreeSelectFieldBase(props) {
11119
10967
  const {
@@ -11132,13 +10980,15 @@ function TreeSelectFieldBase(props) {
11132
10980
  contrast = false,
11133
10981
  nothingSelectedText = "",
11134
10982
  onSelect,
11135
- defaultCollapsed = false,
10983
+ defaultCollapsed: _defaultCollapsed = false,
11136
10984
  placeholder,
11137
10985
  fullWidth = fieldProps?.fullWidth ?? false,
11138
10986
  chipDisplay = "root",
11139
10987
  disabledOptions,
10988
+ groupOptions: _groupOptions,
11140
10989
  ...otherProps
11141
10990
  } = props;
10991
+ void _defaultCollapsed;
11142
10992
  const isDisabled = !!disabled;
11143
10993
  const isReadOnly = !!readOnly;
11144
10994
  const initialOptions = Array.isArray(options) ? options : options.current;
@@ -11150,7 +11000,10 @@ function TreeSelectFieldBase(props) {
11150
11000
  const {
11151
11001
  collapsedKeys
11152
11002
  } = useTreeSelectFieldProvider();
11003
+ const groupKeys = useMemo15(() => _groupOptions?.map((option) => valueToKey(option)) ?? [], [_groupOptions]);
11004
+ const groupKeySet = useMemo15(() => new Set(groupKeys), [groupKeys]);
11153
11005
  const disabledOptionsWithReasons = Object.fromEntries(disabledOptions?.map(disabledOptionToKeyedTuple) ?? []);
11006
+ const disabledKeys = [.../* @__PURE__ */ new Set([...Object.keys(disabledOptionsWithReasons), ...groupKeys])];
11154
11007
  const initTreeFieldState = useCallback8(() => {
11155
11008
  const selectedKeys = new Set(values?.flatMap((v) => {
11156
11009
  const foundOptions = findOptions(initialOptions, valueToKey(v), getOptionValue);
@@ -11159,14 +11012,16 @@ function TreeSelectFieldBase(props) {
11159
11012
  }) => selectOptionAndAllChildren(option));
11160
11013
  }));
11161
11014
  function selectOptionAndAllChildren(maybeParent) {
11162
- return [valueToKey(getOptionValue(maybeParent)), ...maybeParent.children?.flatMap(selectOptionAndAllChildren) ?? []];
11015
+ const key = valueToKey(getOptionValue(maybeParent));
11016
+ return [...groupKeySet.has(key) ? [] : [key], ...maybeParent.children?.flatMap(selectOptionAndAllChildren) ?? []];
11163
11017
  }
11164
11018
  function areAllChildrenSelected(maybeParent) {
11165
- const isSelected = selectedKeys.has(valueToKey(getOptionValue(maybeParent)));
11019
+ const key = valueToKey(getOptionValue(maybeParent));
11020
+ const isSelected = selectedKeys.has(key);
11166
11021
  if (isSelected || !maybeParent.children || maybeParent.children.length === 0) return isSelected;
11167
11022
  const areAllSelected = maybeParent.children.every(areAllChildrenSelected);
11168
- if (areAllSelected) {
11169
- selectedKeys.add(valueToKey(getOptionValue(maybeParent)));
11023
+ if (areAllSelected && !groupKeySet.has(key)) {
11024
+ selectedKeys.add(key);
11170
11025
  }
11171
11026
  return areAllSelected;
11172
11027
  }
@@ -11177,18 +11032,17 @@ function TreeSelectFieldBase(props) {
11177
11032
  return [maybeOption.option];
11178
11033
  });
11179
11034
  const selectedOptionsLabels = chipDisplay === "root" ? initialOptions.flatMap((o) => getTopLevelSelections(o, selectedKeys, getOptionValue)).map(getOptionLabel) : chipDisplay === "leaf" ? selectedOptions.filter((o) => !o.children || o.children.length === 0).map(getOptionLabel) : selectedOptions.map(getOptionLabel);
11180
- const filteredOptions = initialOptions.flatMap((o) => levelOptions(o, 0, false, collapsedKeys, getOptionValue));
11181
11035
  return {
11182
11036
  selectedKeys: [...selectedKeys],
11037
+ searchValue: void 0,
11183
11038
  inputValue: selectedOptions.length === 1 ? getOptionLabel([...selectedOptions][0]) : isReadOnly && selectedOptions.length > 0 ? selectedOptionsLabels.join(", ") : selectedOptions.length === 0 ? nothingSelectedText : "",
11184
- filteredOptions,
11185
11039
  selectedOptions,
11186
11040
  allOptions: initialOptions,
11187
11041
  selectedOptionsLabels,
11188
11042
  optionsLoading: false,
11189
11043
  allowCollapsing: true
11190
11044
  };
11191
- }, [initialOptions, values, chipDisplay, getOptionLabel, isReadOnly, nothingSelectedText, getOptionValue, collapsedKeys]);
11045
+ }, [initialOptions, values, chipDisplay, getOptionLabel, isReadOnly, nothingSelectedText, getOptionValue, groupKeySet]);
11192
11046
  const [fieldState, setFieldState] = useState17(() => initTreeFieldState());
11193
11047
  useEffect13(() => {
11194
11048
  if (Array.isArray(options)) {
@@ -11208,75 +11062,54 @@ function TreeSelectFieldBase(props) {
11208
11062
  setFieldState(initTreeFieldState());
11209
11063
  }
11210
11064
  }, [getOptionValue, initTreeFieldState, values]);
11211
- const reactToCollapse = useRef22(false);
11212
- useEffect13(
11213
- () => {
11214
- if (reactToCollapse.current) {
11215
- setFieldState(({
11216
- allOptions,
11217
- inputValue,
11218
- ...others
11219
- }) => ({
11220
- allOptions,
11221
- inputValue,
11222
- ...others,
11223
- filteredOptions: allOptions.flatMap((o) => levelOptions(o, 0, inputValue.length > 0, collapsedKeys, getOptionValue).filter(([option]) => contains(getOptionLabel(option), inputValue)))
11224
- }));
11225
- }
11226
- reactToCollapse.current = true;
11227
- },
11228
- // Only react to collapseKey changes. Other deps should be stable (`contains`, `getOptionLabel`, `getOptionValue`).
11229
- // eslint-disable-next-line react-hooks/exhaustive-deps
11230
- [collapsedKeys]
11231
- );
11065
+ const filteredOptions = useMemo15(() => getFilteredOptions(fieldState.allOptions, fieldState.searchValue, collapsedKeys, contains, getOptionLabel, getOptionValue), [fieldState.allOptions, fieldState.searchValue, collapsedKeys, contains, getOptionLabel, getOptionValue]);
11232
11066
  const onInputChange = useCallback8((inputValue) => {
11233
11067
  setFieldState((prevState) => {
11234
11068
  return {
11235
11069
  ...prevState,
11236
11070
  inputValue,
11237
- allowCollapsing: inputValue.length === 0,
11238
- filteredOptions: prevState.allOptions.flatMap((o) => levelOptions(o, 0, inputValue.length > 0, collapsedKeys, getOptionValue).filter(([option]) => contains(getOptionLabel(option), inputValue)))
11071
+ searchValue: inputValue.length === 0 ? void 0 : inputValue,
11072
+ allowCollapsing: inputValue.length === 0
11239
11073
  };
11240
11074
  });
11241
- }, [collapsedKeys, contains, getOptionLabel, getOptionValue]);
11242
- const maybeInitLoad = useCallback8(async (options2, fieldState2, setFieldState2) => {
11075
+ }, []);
11076
+ const maybeInitLoad = useCallback8(async (options2, setFieldState2) => {
11243
11077
  if (!Array.isArray(options2)) {
11244
11078
  setFieldState2((prevState) => ({
11245
11079
  ...prevState,
11246
11080
  optionsLoading: true
11247
11081
  }));
11248
11082
  const loadedOptions = (await options2.load()).options;
11249
- const filteredOptions = loadedOptions.flatMap((o) => levelOptions(o, 0, fieldState2.inputValue.length > 0, collapsedKeys, getOptionValue).filter(([option]) => contains(getOptionLabel(option), fieldState2.inputValue)));
11250
11083
  setFieldState2((prevState) => ({
11251
11084
  ...prevState,
11252
- filteredOptions,
11253
11085
  allOptions: loadedOptions,
11254
11086
  optionsLoading: false
11255
11087
  }));
11256
11088
  }
11257
- }, [collapsedKeys, contains, getOptionLabel, getOptionValue]);
11258
- const firstOpen = useRef22(true);
11089
+ }, []);
11090
+ const firstOpen = useRef21(true);
11259
11091
  function onOpenChange(isOpen) {
11260
11092
  if (firstOpen.current && isOpen) {
11261
- maybeInitLoad(options, fieldState, setFieldState);
11093
+ maybeInitLoad(options, setFieldState);
11262
11094
  firstOpen.current = false;
11263
11095
  }
11264
11096
  if (isOpen) {
11265
11097
  setFieldState((prevState) => ({
11266
11098
  ...prevState,
11267
11099
  inputValue: "",
11268
- filteredOptions: prevState.allOptions.flatMap((o) => levelOptions(o, 0, false, collapsedKeys, getOptionValue))
11100
+ searchValue: void 0,
11101
+ allowCollapsing: true
11269
11102
  }));
11270
11103
  }
11271
11104
  }
11272
11105
  const comboBoxChildren = useCallback8(([item]) => /* @__PURE__ */ jsx54(Item3, { textValue: getOptionLabel(item), children: getOptionMenuLabel(item) }, valueToKey(getOptionValue(item))), [getOptionValue, getOptionLabel, getOptionMenuLabel]);
11273
11106
  const comboBoxProps = {
11274
11107
  ...otherProps,
11275
- disabledKeys: Object.keys(disabledOptionsWithReasons),
11108
+ disabledKeys,
11276
11109
  placeholder: !values || values.length === 0 ? placeholder : "",
11277
11110
  label: props.label,
11278
11111
  inputValue: fieldState.inputValue,
11279
- items: fieldState.filteredOptions,
11112
+ items: filteredOptions,
11280
11113
  isDisabled,
11281
11114
  isReadOnly,
11282
11115
  onInputChange,
@@ -11301,6 +11134,8 @@ function TreeSelectFieldBase(props) {
11301
11134
  setFieldState((prevState) => ({
11302
11135
  ...prevState,
11303
11136
  inputValue: nothingSelectedText,
11137
+ searchValue: void 0,
11138
+ allowCollapsing: true,
11304
11139
  selectedKeys: [],
11305
11140
  selectedOptions: []
11306
11141
  }));
@@ -11331,15 +11166,16 @@ function TreeSelectFieldBase(props) {
11331
11166
  const childrenKeys = option.children.flatMap(flattenOptions).map((o) => valueToKey(getOptionValue(o))).filter((childKey) => {
11332
11167
  return !state.disabledKeys.has(childKey);
11333
11168
  });
11334
- [key, ...childrenKeys].forEach(addedKeys.add, addedKeys);
11169
+ [...groupKeySet.has(key) ? [] : [key], ...childrenKeys].forEach(addedKeys.add, addedKeys);
11335
11170
  }
11336
- for (const parent of parents.reverse()) {
11337
- const allChecked = parent.children?.every((child) => {
11338
- const childKey = valueToKey(getOptionValue(child));
11339
- return addedKeys.has(childKey) || existingKeys.has(childKey) || state.disabledKeys.has(childKey);
11340
- });
11341
- if (allChecked) {
11342
- addedKeys.add(valueToKey(getOptionValue(parent)));
11171
+ const selectionKeys = /* @__PURE__ */ new Set([...existingKeys, ...addedKeys]);
11172
+ for (const parent of [...parents].reverse()) {
11173
+ const parentKey = valueToKey(getOptionValue(parent));
11174
+ if (isOptionFullySelected(parent, selectionKeys, state.disabledKeys, groupKeySet, getOptionValue)) {
11175
+ if (!groupKeySet.has(parentKey)) {
11176
+ addedKeys.add(parentKey);
11177
+ selectionKeys.add(parentKey);
11178
+ }
11343
11179
  }
11344
11180
  }
11345
11181
  }
@@ -11372,7 +11208,7 @@ function TreeSelectFieldBase(props) {
11372
11208
  ...prevState,
11373
11209
  // Since we reset the list of options upon selection changes, then set the `inputValue` to empty string to reflect that.
11374
11210
  inputValue: "",
11375
- filteredOptions: initialOptions.flatMap((o) => levelOptions(o, 0, false, collapsedKeys, getOptionValue)),
11211
+ searchValue: void 0,
11376
11212
  selectedKeys: [...selectedKeys],
11377
11213
  selectedOptions,
11378
11214
  selectedOptionsLabels: chipDisplay === "root" ? rootOptions.map(getOptionLabel) : chipDisplay === "leaf" ? leafOptions.map(getOptionLabel) : selectedOptions.map(getOptionLabel)
@@ -11403,17 +11239,17 @@ function TreeSelectFieldBase(props) {
11403
11239
  setFieldState((prevState) => ({
11404
11240
  ...prevState,
11405
11241
  inputValue: selectedOptions.length === 1 ? getOptionLabel(selectedOptions[0]) : selectedOptions.length === 0 ? nothingSelectedText : "",
11406
- filteredOptions: initialOptions.flatMap((o) => levelOptions(o, 0, false, collapsedKeys, getOptionValue)),
11242
+ searchValue: void 0,
11407
11243
  allowCollapsing: true
11408
11244
  }));
11409
11245
  }
11410
11246
  }
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);
11247
+ const comboBoxRef = useRef21(null);
11248
+ const triggerRef = useRef21(null);
11249
+ const inputRef = useRef21(null);
11250
+ const inputWrapRef = useRef21(null);
11251
+ const listBoxRef = useRef21(null);
11252
+ const popoverRef = useRef21(null);
11417
11253
  const {
11418
11254
  buttonProps: triggerProps,
11419
11255
  inputProps,
@@ -11492,6 +11328,18 @@ function getTopLevelSelections(o, selectedKeys, getOptionValue) {
11492
11328
  if (o.children) return [...o.children.flatMap((c) => getTopLevelSelections(c, selectedKeys, getOptionValue))];
11493
11329
  return [];
11494
11330
  }
11331
+ function getFilteredOptions(allOptions, searchValue, collapsedKeys, contains, getOptionLabel, getOptionValue) {
11332
+ return allOptions.flatMap((option) => levelOptions(option, 0, !!searchValue, collapsedKeys, getOptionValue).filter(([nestedOption]) => searchValue ? contains(getOptionLabel(nestedOption), searchValue) : true));
11333
+ }
11334
+ function isOptionFullySelected(option, selectedKeys, disabledKeys, groupKeys, getOptionValue) {
11335
+ const key = valueToKey(getOptionValue(option));
11336
+ if (groupKeys.has(key)) {
11337
+ return option.children?.length ? option.children.every((child) => isOptionFullySelected(child, selectedKeys, disabledKeys, groupKeys, getOptionValue)) : false;
11338
+ }
11339
+ if (selectedKeys.has(key) || disabledKeys.has(key)) return true;
11340
+ if (!option.children || option.children.length === 0) return false;
11341
+ return option.children.every((child) => isOptionFullySelected(child, selectedKeys, disabledKeys, groupKeys, getOptionValue));
11342
+ }
11495
11343
 
11496
11344
  // src/inputs/internal/ComboBoxInput.tsx
11497
11345
  import { jsx as jsx55 } from "react/jsx-runtime";
@@ -11752,7 +11600,7 @@ function ComboBoxBase(props) {
11752
11600
  }));
11753
11601
  }
11754
11602
  }
11755
- const firstOpen = useRef23(true);
11603
+ const firstOpen = useRef22(true);
11756
11604
  function onOpenChange(isOpen) {
11757
11605
  if (firstOpen.current && isOpen) {
11758
11606
  maybeInitLoad();
@@ -11765,12 +11613,12 @@ function ComboBoxBase(props) {
11765
11613
  }));
11766
11614
  }
11767
11615
  }
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);
11616
+ const comboBoxRef = useRef22(null);
11617
+ const triggerRef = useRef22(null);
11618
+ const inputRef = useRef22(null);
11619
+ const inputWrapRef = useRef22(null);
11620
+ const listBoxRef = useRef22(null);
11621
+ const popoverRef = useRef22(null);
11774
11622
  const disabledOptionsWithReasons = Object.fromEntries(disabledOptions?.map(disabledOptionToKeyedTuple) ?? []);
11775
11623
  const comboBoxChildren = useCallback9((item) => /* @__PURE__ */ jsx56(Item4, { textValue: getOptionLabel(item), children: getOptionMenuLabel(item) }, valueToKey(getOptionValue(item))), [getOptionValue, getOptionLabel, getOptionMenuLabel]);
11776
11624
  const selectedKeys = useMemo16(() => {
@@ -12004,10 +11852,10 @@ function Autocomplete(props) {
12004
11852
  ...others
12005
11853
  };
12006
11854
  const state = useComboBoxState3(comboBoxProps);
12007
- const inputWrapRef = useRef24(null);
12008
- const inputRef = useRef24(null);
12009
- const listBoxRef = useRef24(null);
12010
- const popoverRef = useRef24(null);
11855
+ const inputWrapRef = useRef23(null);
11856
+ const inputRef = useRef23(null);
11857
+ const listBoxRef = useRef23(null);
11858
+ const popoverRef = useRef23(null);
12011
11859
  const { inputProps, listBoxProps, labelProps } = useComboBox3(
12012
11860
  {
12013
11861
  ...comboBoxProps,
@@ -12074,7 +11922,7 @@ function Autocomplete(props) {
12074
11922
  }
12075
11923
 
12076
11924
  // src/inputs/Checkbox.tsx
12077
- import { useRef as useRef25 } from "react";
11925
+ import { useRef as useRef24 } from "react";
12078
11926
  import { useCheckbox } from "react-aria";
12079
11927
  import { useToggleState } from "react-stately";
12080
11928
  import { jsx as jsx58 } from "react/jsx-runtime";
@@ -12084,7 +11932,7 @@ function Checkbox(props) {
12084
11932
  const isIndeterminate = selected === "indeterminate";
12085
11933
  const ariaProps = { isSelected, isDisabled: !!disabled, isIndeterminate, ...otherProps };
12086
11934
  const checkboxProps = { ...ariaProps, "aria-label": label };
12087
- const ref = useRef25(null);
11935
+ const ref = useRef24(null);
12088
11936
  const toggleState = useToggleState(ariaProps);
12089
11937
  const { inputProps } = useCheckbox(checkboxProps, toggleState, ref);
12090
11938
  return /* @__PURE__ */ jsx58(
@@ -12103,7 +11951,7 @@ function Checkbox(props) {
12103
11951
  }
12104
11952
 
12105
11953
  // src/inputs/CheckboxGroup.tsx
12106
- import { useRef as useRef26 } from "react";
11954
+ import { useRef as useRef25 } from "react";
12107
11955
  import { useCheckboxGroup, useCheckboxGroupItem } from "react-aria";
12108
11956
  import { useCheckboxGroupState } from "react-stately";
12109
11957
  import { trussProps as trussProps40 } from "@homebound/truss/runtime";
@@ -12178,7 +12026,7 @@ function CheckboxGroupItem(props) {
12178
12026
  ...ariaProps,
12179
12027
  "aria-label": label
12180
12028
  };
12181
- const ref = useRef26(null);
12029
+ const ref = useRef25(null);
12182
12030
  const {
12183
12031
  inputProps
12184
12032
  } = useCheckboxGroupItem(checkboxProps, groupState, ref);
@@ -12186,37 +12034,69 @@ function CheckboxGroupItem(props) {
12186
12034
  }
12187
12035
 
12188
12036
  // src/inputs/DateFields/DateField.mock.tsx
12037
+ import { format as format3, parse } from "date-fns";
12189
12038
  import { useState as useState20 } from "react";
12039
+ import { jsx as jsx60 } from "react/jsx-runtime";
12040
+ function DateFieldMock(props) {
12041
+ const { onChange = () => {
12042
+ }, errorMsg, onBlur, onFocus } = props;
12043
+ const [value, setValue] = useState20(props.value ? format3(props.value, "MM/dd/yy") : "");
12044
+ const tid = useTestIds(props, "date");
12045
+ return /* @__PURE__ */ jsx60(
12046
+ "input",
12047
+ {
12048
+ ...tid,
12049
+ "data-error": !!errorMsg,
12050
+ value,
12051
+ onChange: (e) => {
12052
+ const { value: value2 } = e.target;
12053
+ setValue(value2);
12054
+ onChange(parse(value2, "MM/dd/yy", /* @__PURE__ */ new Date()));
12055
+ },
12056
+ onBlur: () => maybeCall(onBlur),
12057
+ onFocus: () => maybeCall(onFocus),
12058
+ disabled: !!props.disabled,
12059
+ readOnly: !!props.readOnly,
12060
+ "data-disabled-days": JSON.stringify(props.disabledDays)
12061
+ }
12062
+ );
12063
+ }
12064
+
12065
+ // src/inputs/DateFields/DateFieldBase.tsx
12066
+ import { useCallback as useCallback11, useEffect as useEffect15, useRef as useRef26, useState as useState21 } from "react";
12067
+ import { FocusScope as FocusScope3, useButton as useButton8, useOverlayPosition as useOverlayPosition6, useOverlayTrigger, useTextField as useTextField2 } from "react-aria";
12068
+ import { isDateRange } from "react-day-picker";
12069
+ import { useOverlayTriggerState } from "react-stately";
12190
12070
 
12191
12071
  // src/inputs/DateFields/utils.ts
12192
- import { Temporal as Temporal2 } from "temporal-polyfill";
12072
+ import { format as dateFnsFormat, parse as dateFnsParse, isDate } from "date-fns";
12193
12073
  var dateFormats = {
12194
- short: "shortDate",
12195
- medium: "shortWeekdayMonthDay",
12196
- long: "longWeekdayMonthDayYear"
12074
+ short: "MM/dd/yy",
12075
+ medium: "EEE, MMM d",
12076
+ long: "EEEE LLLL d, uuuu"
12197
12077
  };
12198
- function getDateFormat(format) {
12199
- return format ? dateFormats[format] : dateFormats.short;
12078
+ function getDateFormat(format4) {
12079
+ return format4 ? dateFormats[format4] : dateFormats.short;
12200
12080
  }
12201
- function formatDate(date, format) {
12081
+ function formatDate(date, format4) {
12202
12082
  if (!date) return "";
12203
- return formatPlainDate(date, format);
12083
+ return dateFnsFormat(date, format4);
12204
12084
  }
12205
- function formatDateRange(date, format) {
12085
+ function formatDateRange(date, format4) {
12206
12086
  if (!date) return "";
12207
12087
  const { from, to } = date;
12208
- const fromFormatted = from ? formatPlainDate(from, format) : "";
12209
- const toFormatted = to ? formatPlainDate(to, format) : "";
12088
+ const fromFormatted = from ? dateFnsFormat(from, format4) : "";
12089
+ const toFormatted = to ? dateFnsFormat(to, format4) : "";
12210
12090
  return !fromFormatted && !toFormatted ? void 0 : `${fromFormatted} - ${toFormatted}`;
12211
12091
  }
12212
- function parseDate(str, format) {
12213
- return parseDateString(str, format);
12092
+ function parseDate(str, format4) {
12093
+ return parseDateString(str, format4);
12214
12094
  }
12215
- function parseDateRange(str, format) {
12095
+ function parseDateRange(str, format4) {
12216
12096
  const [from = "", to = ""] = str.split("-");
12217
- const fromDate = parseDateString(from.trim(), format);
12218
- const toDate = parseDateString(to.trim(), format);
12219
- if (toDate && fromDate && Temporal2.PlainDate.compare(toDate, fromDate) < 0) {
12097
+ const fromDate = parseDateString(from.trim(), format4);
12098
+ const toDate = parseDateString(to.trim(), format4);
12099
+ if (toDate && fromDate && toDate < fromDate) {
12220
12100
  return { from: toDate, to: fromDate };
12221
12101
  }
12222
12102
  if (toDate === void 0 && fromDate === void 0) {
@@ -12224,81 +12104,31 @@ function parseDateRange(str, format) {
12224
12104
  }
12225
12105
  return { from: fromDate, to: toDate };
12226
12106
  }
12227
- function parseDateString(str, format) {
12228
- if (format !== dateFormats.short && format !== "date") {
12229
- return void 0;
12230
- }
12107
+ function parseDateString(str, format4) {
12231
12108
  const split = str.split("/");
12232
12109
  if (split.length !== 3) {
12233
12110
  return void 0;
12234
12111
  }
12235
- const yearLength = format === dateFormats.short ? 2 : 4;
12236
- if (split[2].length !== yearLength) {
12112
+ if (split[2].length !== 2) {
12237
12113
  return void 0;
12238
12114
  }
12239
- const month = parseInt(split[0], 10);
12115
+ const month = parseInt(split[0], 10) - 1;
12240
12116
  const day = parseInt(split[1], 10);
12241
12117
  const year = parseInt(split[2], 10);
12242
- if (Number.isNaN(year) || Number.isNaN(month) || Number.isNaN(day) || day <= 0 || day > 31 || month <= 0 || month > 12) {
12118
+ if (isNaN(year) || String(year).length > 4 || isNaN(month) || isNaN(day) || day <= 0 || day > 31 || month < 0 || month >= 12) {
12243
12119
  return void 0;
12244
12120
  }
12245
- try {
12246
- return Temporal2.PlainDate.from({
12247
- year: yearLength === 2 ? normalizeTwoDigitYear(year, todayPlainDate().year) : year,
12248
- month,
12249
- day
12250
- });
12251
- } catch {
12121
+ const parsed = dateFnsParse(str, format4, /* @__PURE__ */ new Date());
12122
+ if (!isValidDate(parsed)) {
12252
12123
  return void 0;
12253
12124
  }
12125
+ return parsed;
12254
12126
  }
12255
12127
  function isValidDate(d) {
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
- );
12128
+ return d !== void 0 && isDate(d) && d.toString() !== "Invalid Date";
12296
12129
  }
12297
12130
 
12298
12131
  // 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";
12302
12132
  import { trussProps as trussProps41 } from "@homebound/truss/runtime";
12303
12133
  import { Fragment as Fragment18, jsx as jsx61, jsxs as jsxs40 } from "react/jsx-runtime";
12304
12134
  function DateFieldBase(props) {
@@ -12314,7 +12144,7 @@ function DateFieldBase(props) {
12314
12144
  errorMsg,
12315
12145
  helperText,
12316
12146
  readOnly,
12317
- format = "short",
12147
+ format: format4 = "short",
12318
12148
  iconLeft = false,
12319
12149
  hideCalendarIcon = false,
12320
12150
  disabledDays,
@@ -12326,12 +12156,12 @@ function DateFieldBase(props) {
12326
12156
  ...others
12327
12157
  } = props;
12328
12158
  const isRangeMode = mode === "range";
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);
12159
+ const inputRef = useRef26(null);
12160
+ const inputWrapRef = useRef26(null);
12161
+ const buttonRef = useRef26(null);
12162
+ const overlayRef = useRef26(null);
12163
+ const isFocused = useRef26(false);
12164
+ const dateFormat = getDateFormat(format4);
12335
12165
  const [wipValue, setWipValue] = useState21(value);
12336
12166
  const [inputValue, setInputValue] = useState21((isRangeMode ? formatDateRange(props.value, dateFormat) : formatDate(props.value, dateFormat)) ?? "");
12337
12167
  const tid = useTestIds(props, defaultTestId(label));
@@ -12420,20 +12250,16 @@ function DateFieldBase(props) {
12420
12250
  (d) => {
12421
12251
  setWipValue(d);
12422
12252
  if (d && isParsedDateValid(d)) {
12423
- if (isRangeMode && isDateRangeValue(d)) {
12253
+ if (isRangeMode && isDateRange(d)) {
12424
12254
  props.onChange(d);
12425
12255
  return;
12426
12256
  }
12427
- if (!isRangeMode && !isDateRangeValue(d)) {
12257
+ if (!isRangeMode && !isDateRange(d)) {
12428
12258
  props.onChange(d);
12429
12259
  return;
12430
12260
  }
12431
12261
  } else {
12432
- if (isRangeMode) {
12433
- props.onChange(void 0);
12434
- } else {
12435
- props.onChange(void 0);
12436
- }
12262
+ props.onChange(void 0);
12437
12263
  return;
12438
12264
  }
12439
12265
  },
@@ -12441,7 +12267,7 @@ function DateFieldBase(props) {
12441
12267
  // eslint-disable-next-line react-hooks/exhaustive-deps
12442
12268
  [isRangeMode, props.onChange]
12443
12269
  );
12444
- const inputSize = !isRangeMode ? format === "short" ? 8 : format === "medium" ? 10 : void 0 : void 0;
12270
+ const inputSize = !isRangeMode ? format4 === "short" ? 8 : format4 === "medium" ? 10 : void 0 : void 0;
12445
12271
  const clearButton = /* @__PURE__ */ jsx61(Fragment18, { children: inputValue !== "" && !state.isOpen && /* @__PURE__ */ jsx61(IconButton, { icon: "xCircle", color: "rgba(100, 100, 100, 1)" /* Gray700 */, onClick: () => {
12446
12272
  setInputValue("");
12447
12273
  onChange(void 0);
@@ -12503,10 +12329,7 @@ function DateFieldBase(props) {
12503
12329
  ] });
12504
12330
  }
12505
12331
  function isParsedDateValid(d) {
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);
12332
+ return d !== void 0 && (!isDateRange(d) || isDateRange(d) && isValidDate(d.from) && isValidDate(d.to));
12510
12333
  }
12511
12334
 
12512
12335
  // src/utils/withTestMock.tsx
@@ -12693,7 +12516,7 @@ function MultiSelectField(props) {
12693
12516
 
12694
12517
  // src/inputs/NumberField.tsx
12695
12518
  import { NumberParser } from "@internationalized/number";
12696
- import { useMemo as useMemo18, useRef as useRef28, useState as useState23 } from "react";
12519
+ import { useMemo as useMemo18, useRef as useRef27, useState as useState23 } from "react";
12697
12520
  import { mergeProps as mergeProps15, useLocale, useNumberField } from "react-aria";
12698
12521
  import { useNumberFieldState } from "react-stately";
12699
12522
  import { jsx as jsx68 } from "react/jsx-runtime";
@@ -12780,11 +12603,11 @@ function NumberField(props) {
12780
12603
  };
12781
12604
  }, [type, numberFormatOptions, defaultFormatOptions, numFractionDigits]);
12782
12605
  const numberParser = useMemo18(() => new NumberParser(locale, formatOptions), [locale, formatOptions]);
12783
- const valueRef = useRef28({
12606
+ const valueRef = useRef27({
12784
12607
  wip: false
12785
12608
  });
12786
- const lastSentRef = useRef28(void 0);
12787
- const focusValueRef = useRef28(void 0);
12609
+ const lastSentRef = useRef27(void 0);
12610
+ const focusValueRef = useRef27(void 0);
12788
12611
  const [, forceRender] = useState23(0);
12789
12612
  const propValue = value === void 0 ? Number.NaN : value / factor;
12790
12613
  if (valueRef.current.wip && !Object.is(valueRef.current.value, propValue)) {
@@ -12832,7 +12655,7 @@ function NumberField(props) {
12832
12655
  ...otherProps
12833
12656
  };
12834
12657
  const state = useNumberFieldState(useProps);
12835
- const inputRef = useRef28(null);
12658
+ const inputRef = useRef27(null);
12836
12659
  const {
12837
12660
  labelProps,
12838
12661
  inputProps,
@@ -12884,7 +12707,7 @@ function formatValue(value, factor, numFractionDigits, numIntegerDigits, positiv
12884
12707
  }
12885
12708
 
12886
12709
  // src/inputs/RadioGroupField.tsx
12887
- import { Fragment as Fragment19, useMemo as useMemo19, useRef as useRef29 } from "react";
12710
+ import { Fragment as Fragment19, useMemo as useMemo19, useRef as useRef28 } from "react";
12888
12711
  import { useFocusRing as useFocusRing6, useHover as useHover12, useRadio, useRadioGroup } from "react-aria";
12889
12712
  import { useRadioGroupState } from "react-stately";
12890
12713
  import { trussProps as trussProps44 } from "@homebound/truss/runtime";
@@ -12960,7 +12783,7 @@ function Radio(props) {
12960
12783
  } = props;
12961
12784
  const labelId = `${parentId}-${value}-label`;
12962
12785
  const descriptionId = `${parentId}-${value}-description`;
12963
- const ref = useRef29(null);
12786
+ const ref = useRef28(null);
12964
12787
  const {
12965
12788
  inputProps,
12966
12789
  isDisabled
@@ -13130,7 +12953,7 @@ var radioDisabled = {
13130
12953
 
13131
12954
  // src/inputs/RichTextField.tsx
13132
12955
  import DOMPurify from "dompurify";
13133
- import { createElement, useEffect as useEffect16, useMemo as useMemo20, useRef as useRef30, useState as useState25 } from "react";
12956
+ import { createElement, useEffect as useEffect16, useMemo as useMemo20, useRef as useRef29, useState as useState25 } from "react";
13134
12957
 
13135
12958
  // src/inputs/RichTextField.mock.tsx
13136
12959
  import { camelCase as camelCase3 } from "change-case";
@@ -13186,13 +13009,13 @@ function RichTextFieldImpl(props) {
13186
13009
  fullWidth = fieldProps?.fullWidth ?? false
13187
13010
  } = props;
13188
13011
  const [editor, setEditor] = useState25();
13189
- const editorElement = useRef30();
13190
- const currentHtml = useRef30(void 0);
13191
- const onChangeRef = useRef30(onChange);
13012
+ const editorElement = useRef29();
13013
+ const currentHtml = useRef29(void 0);
13014
+ const onChangeRef = useRef29(onChange);
13192
13015
  onChangeRef.current = onChange;
13193
- const onBlurRef = useRef30(onBlur);
13016
+ const onBlurRef = useRef29(onBlur);
13194
13017
  onBlurRef.current = onBlur;
13195
- const onFocusRef = useRef30(onFocus);
13018
+ const onFocusRef = useRef29(onFocus);
13196
13019
  onFocusRef.current = onFocus;
13197
13020
  const id = useMemo20(() => {
13198
13021
  if (readOnly) return;
@@ -13343,7 +13166,7 @@ function SelectField(props) {
13343
13166
  }
13344
13167
 
13345
13168
  // src/inputs/Switch.tsx
13346
- import { useRef as useRef31 } from "react";
13169
+ import { useRef as useRef30 } from "react";
13347
13170
  import { useFocusRing as useFocusRing7, useHover as useHover13, useSwitch, VisuallyHidden as VisuallyHidden5 } from "react-aria";
13348
13171
  import { trussProps as trussProps46 } from "@homebound/truss/runtime";
13349
13172
  import { jsx as jsx73, jsxs as jsxs45 } from "react/jsx-runtime";
@@ -13376,7 +13199,7 @@ function Switch(props) {
13376
13199
  ...otherProps
13377
13200
  };
13378
13201
  const state = toToggleState(isSelected, onChange);
13379
- const ref = useRef31(null);
13202
+ const ref = useRef30(null);
13380
13203
  const {
13381
13204
  inputProps
13382
13205
  } = useSwitch({
@@ -13528,7 +13351,7 @@ function switchCircleSelectedStyles(isCompact) {
13528
13351
  }
13529
13352
 
13530
13353
  // src/inputs/TextAreaField.tsx
13531
- import { useRef as useRef32 } from "react";
13354
+ import { useRef as useRef31 } from "react";
13532
13355
  import { mergeProps as mergeProps16, useTextField as useTextField3 } from "react-aria";
13533
13356
  import { jsx as jsx74 } from "react/jsx-runtime";
13534
13357
  function TextAreaField(props) {
@@ -13546,8 +13369,8 @@ function TextAreaField(props) {
13546
13369
  const isDisabled = !!disabled;
13547
13370
  const isReadOnly = !!readOnly;
13548
13371
  const textFieldProps = { ...otherProps, value, isDisabled, isReadOnly };
13549
- const inputRef = useRef32(null);
13550
- const inputWrapRef = useRef32(null);
13372
+ const inputRef = useRef31(null);
13373
+ const inputWrapRef = useRef31(null);
13551
13374
  useGrowingTextField({ inputRef, inputWrapRef, value, maxLines });
13552
13375
  const { labelProps, inputProps } = useTextField3(
13553
13376
  {
@@ -13585,7 +13408,7 @@ function TextAreaField(props) {
13585
13408
  }
13586
13409
 
13587
13410
  // src/inputs/TextField.tsx
13588
- import { useRef as useRef33 } from "react";
13411
+ import { useRef as useRef32 } from "react";
13589
13412
  import { mergeProps as mergeProps17, useTextField as useTextField4 } from "react-aria";
13590
13413
  import { jsx as jsx75 } from "react/jsx-runtime";
13591
13414
  function TextField(props) {
@@ -13613,7 +13436,7 @@ function TextField(props) {
13613
13436
  validationState: errorMsg ? "invalid" : "valid",
13614
13437
  value
13615
13438
  };
13616
- const inputRef = useRef33(null);
13439
+ const inputRef = useRef32(null);
13617
13440
  const { labelProps, inputProps } = useTextField4(
13618
13441
  {
13619
13442
  ...textFieldProps,
@@ -13649,7 +13472,7 @@ function TextField(props) {
13649
13472
  }
13650
13473
 
13651
13474
  // src/inputs/ToggleButton.tsx
13652
- import { useRef as useRef34, useState as useState26 } from "react";
13475
+ import { useRef as useRef33, useState as useState26 } from "react";
13653
13476
  import { useFocusRing as useFocusRing8, useHover as useHover14, usePress, useSwitch as useSwitch2, VisuallyHidden as VisuallyHidden6 } from "react-aria";
13654
13477
  import { useToggleState as useToggleState3 } from "react-stately";
13655
13478
  import { trussProps as trussProps47 } from "@homebound/truss/runtime";
@@ -13683,8 +13506,8 @@ function ToggleButton(props) {
13683
13506
  return result;
13684
13507
  }
13685
13508
  });
13686
- const labelRef = useRef34(null);
13687
- const ref = useRef34(null);
13509
+ const labelRef = useRef33(null);
13510
+ const ref = useRef33(null);
13688
13511
  const tid = useTestIds(otherProps, label);
13689
13512
  const {
13690
13513
  isPressed: isPressedFromEvents,
@@ -13770,7 +13593,7 @@ var togglePressStyles = {
13770
13593
  };
13771
13594
 
13772
13595
  // src/inputs/ToggleChipGroup.tsx
13773
- import { useRef as useRef35 } from "react";
13596
+ import { useRef as useRef34 } from "react";
13774
13597
  import { useCheckboxGroup as useCheckboxGroup2, useCheckboxGroupItem as useCheckboxGroupItem2, useFocusRing as useFocusRing9, VisuallyHidden as VisuallyHidden7 } from "react-aria";
13775
13598
  import { useCheckboxGroupState as useCheckboxGroupState2 } from "react-stately";
13776
13599
  import { trussProps as trussProps48 } from "@homebound/truss/runtime";
@@ -13843,7 +13666,7 @@ function ToggleChip2(props) {
13843
13666
  } = props;
13844
13667
  const isDisabled = !!disabled;
13845
13668
  const isReadOnly = !!readonly;
13846
- const ref = useRef35(null);
13669
+ const ref = useRef34(null);
13847
13670
  const {
13848
13671
  inputProps
13849
13672
  } = useCheckboxGroupItem2({
@@ -14893,9 +14716,9 @@ function maybeApply(maybeFn) {
14893
14716
  }
14894
14717
 
14895
14718
  // src/components/Table/hooks/useColumnResizeHandlers.ts
14896
- import { useCallback as useCallback12, useRef as useRef36 } from "react";
14719
+ import { useCallback as useCallback12, useRef as useRef35 } from "react";
14897
14720
  function useColumnResizeHandlers(columns, columnSizes, tableWidth, setResizedWidth, setResizedWidths) {
14898
- const hasLockedColumnsRef = useRef36(false);
14721
+ const hasLockedColumnsRef = useRef35(false);
14899
14722
  const distributeAdjustment = useCallback12(
14900
14723
  (rightColumns, totalRightWidth, adjustment) => {
14901
14724
  const updates = {};
@@ -15024,7 +14847,7 @@ function useScrollStorage(tableId, enabled = true) {
15024
14847
 
15025
14848
  // src/components/Table/hooks/useSetupColumnSizes.ts
15026
14849
  import { useResizeObserver } from "@react-aria/utils";
15027
- import { useCallback as useCallback14, useEffect as useEffect18, useRef as useRef37, useState as useState28 } from "react";
14850
+ import { useCallback as useCallback14, useEffect as useEffect18, useRef as useRef36, useState as useState28 } from "react";
15028
14851
 
15029
14852
  // src/components/Table/hooks/useColumnResizing.ts
15030
14853
  import { useCallback as useCallback13, useEffect as useEffect17, useState as useState27 } from "react";
@@ -15083,9 +14906,9 @@ function useSetupColumnSizes(style, columns, resizeRef, expandedColumnIds, visib
15083
14906
  const { resizedWidths, setResizedWidth, setResizedWidths, resetColumnWidths } = useColumnResizing(
15084
14907
  disableColumnResizing ? void 0 : visibleColumnsStorageKey
15085
14908
  );
15086
- const calculateImmediately = useRef37(true);
14909
+ const calculateImmediately = useRef36(true);
15087
14910
  const [tableWidth, setTableWidth] = useState28();
15088
- const prevTableWidthRef = useRef37(tableWidth);
14911
+ const prevTableWidthRef = useRef36(tableWidth);
15089
14912
  const [columnSizes, setColumnSizes] = useState28(
15090
14913
  calcColumnSizes(columns, tableWidth, style.minWidthPx, expandedColumnIds, resizedWidths)
15091
14914
  );
@@ -15152,9 +14975,9 @@ function useSetupColumnSizes(style, columns, resizeRef, expandedColumnIds, visib
15152
14975
  }
15153
14976
 
15154
14977
  // src/hooks/useRenderCount.ts
15155
- import { useCallback as useCallback15, useRef as useRef38 } from "react";
14978
+ import { useCallback as useCallback15, useRef as useRef37 } from "react";
15156
14979
  function useRenderCount() {
15157
- const ref = useRef38(/* @__PURE__ */ new Map());
14980
+ const ref = useRef37(/* @__PURE__ */ new Map());
15158
14981
  const getCount = useCallback15((id) => {
15159
14982
  const count = ref.current.get(id) || 1;
15160
14983
  ref.current.set(id, count + 1);
@@ -15211,10 +15034,10 @@ function GridTable(props) {
15211
15034
  disableColumnResizing = false
15212
15035
  } = props;
15213
15036
  const columnsWithIds = useMemo24(() => assignDefaultColumnIds(_columns), [_columns]);
15214
- const virtuosoRef = useRef39(null);
15215
- const virtuosoRangeRef = useRef39(null);
15216
- const resizeRef = useRef39(null);
15217
- const tableContainerRef = useRef39(null);
15037
+ const virtuosoRef = useRef38(null);
15038
+ const virtuosoRangeRef = useRef38(null);
15039
+ const resizeRef = useRef38(null);
15040
+ const tableContainerRef = useRef38(null);
15218
15041
  const api = useMemo24(
15219
15042
  () => {
15220
15043
  const api2 = props.api ?? new GridTableApiImpl();
@@ -15229,7 +15052,7 @@ function GridTable(props) {
15229
15052
  [props.api]
15230
15053
  );
15231
15054
  const [draggedRow, _setDraggedRow] = useState29(void 0);
15232
- const draggedRowRef = useRef39(draggedRow);
15055
+ const draggedRowRef = useRef38(draggedRow);
15233
15056
  const setDraggedRow = (row) => {
15234
15057
  draggedRowRef.current = row;
15235
15058
  _setDraggedRow(row);
@@ -16075,17 +15898,17 @@ var variantStyles2 = {
16075
15898
  };
16076
15899
 
16077
15900
  // src/components/BeamContext.tsx
16078
- import { createContext as createContext7, useContext as useContext17, useMemo as useMemo40, useReducer, useRef as useRef46 } from "react";
15901
+ import { createContext as createContext7, useContext as useContext17, useMemo as useMemo40, useReducer, useRef as useRef45 } from "react";
16079
15902
  import { OverlayProvider } from "react-aria";
16080
15903
 
16081
15904
  // src/components/Modal/Modal.tsx
16082
15905
  import { useResizeObserver as useResizeObserver3 } from "@react-aria/utils";
16083
- import { useCallback as useCallback17, useEffect as useEffect23, useRef as useRef41, useState as useState32 } from "react";
15906
+ import { useCallback as useCallback17, useEffect as useEffect23, useRef as useRef40, useState as useState32 } from "react";
16084
15907
  import { FocusScope as FocusScope4, OverlayContainer as OverlayContainer2, useDialog, useModal as useModal2, useOverlay as useOverlay2, usePreventScroll } from "react-aria";
16085
15908
  import { createPortal as createPortal3 } from "react-dom";
16086
15909
 
16087
15910
  // src/components/Modal/useModal.tsx
16088
- import { useEffect as useEffect22, useMemo as useMemo27, useRef as useRef40 } from "react";
15911
+ import { useEffect as useEffect22, useMemo as useMemo27, useRef as useRef39 } from "react";
16089
15912
 
16090
15913
  // src/components/Modal/ModalContext.tsx
16091
15914
  import { createContext as createContext4, useContext as useContext13, useMemo as useMemo26 } from "react";
@@ -16103,8 +15926,8 @@ function useModalContext() {
16103
15926
  function useModal() {
16104
15927
  const { modalState, modalCanCloseChecks } = useBeamContext();
16105
15928
  const { inModal } = useModalContext();
16106
- const lastCanClose = useRef40();
16107
- const api = useRef40();
15929
+ const lastCanClose = useRef39();
15930
+ const api = useRef39();
16108
15931
  useEffect22(() => {
16109
15932
  return () => {
16110
15933
  modalCanCloseChecks.current = modalCanCloseChecks.current.filter((c) => c !== lastCanClose.current);
@@ -16157,7 +15980,7 @@ function Modal(props) {
16157
15980
  allowClosing = true
16158
15981
  } = props;
16159
15982
  const isFixedHeight = typeof size !== "string";
16160
- const ref = useRef41(null);
15983
+ const ref = useRef40(null);
16161
15984
  const {
16162
15985
  modalBodyDiv,
16163
15986
  modalFooterDiv,
@@ -16188,9 +16011,9 @@ function Modal(props) {
16188
16011
  role: "dialog"
16189
16012
  }, ref);
16190
16013
  const [[width2, height], setSize] = useState32(getSize(size));
16191
- const modalBodyRef = useRef41(null);
16192
- const modalFooterRef = useRef41(null);
16193
- const modalHeaderRef = useRef41(null);
16014
+ const modalBodyRef = useRef40(null);
16015
+ const modalFooterRef = useRef40(null);
16016
+ const modalHeaderRef = useRef40(null);
16194
16017
  const testId = useTestIds({}, testIdPrefix);
16195
16018
  usePreventScroll();
16196
16019
  const {
@@ -16486,7 +16309,7 @@ function useSnackbarContext() {
16486
16309
 
16487
16310
  // src/components/SuperDrawer/SuperDrawer.tsx
16488
16311
  import { AnimatePresence, motion } from "framer-motion";
16489
- import { useEffect as useEffect24, useRef as useRef42 } from "react";
16312
+ import { useEffect as useEffect24, useRef as useRef41 } from "react";
16490
16313
  import { createPortal as createPortal4 } from "react-dom";
16491
16314
 
16492
16315
  // src/components/SuperDrawer/utils.ts
@@ -16508,7 +16331,7 @@ function SuperDrawer() {
16508
16331
  const {
16509
16332
  closeDrawer
16510
16333
  } = useSuperDrawer();
16511
- const headerRef = useRef42(null);
16334
+ const headerRef = useRef41(null);
16512
16335
  const testId = useTestIds({}, "superDrawer");
16513
16336
  const currentContent = contentStack.current[contentStack.current.length - 1]?.opts;
16514
16337
  const {
@@ -16603,7 +16426,7 @@ function SuperDrawer() {
16603
16426
  }
16604
16427
 
16605
16428
  // src/components/Layout/FormPageLayout.tsx
16606
- import React16, { createRef, useCallback as useCallback21, useEffect as useEffect25, useMemo as useMemo33, useRef as useRef43, useState as useState39 } from "react";
16429
+ import React16, { createRef, useCallback as useCallback21, useEffect as useEffect25, useMemo as useMemo33, useRef as useRef42, useState as useState39 } from "react";
16607
16430
  import { useButton as useButton9, useFocusRing as useFocusRing11 } from "react-aria";
16608
16431
 
16609
16432
  // src/forms/BoundCheckboxField.tsx
@@ -18271,7 +18094,7 @@ function SectionNavLink(props) {
18271
18094
  });
18272
18095
  }, [sectionRef]);
18273
18096
  const tids = useTestIds(props);
18274
- const buttonRef = useRef43(null);
18097
+ const buttonRef = useRef42(null);
18275
18098
  const {
18276
18099
  buttonProps,
18277
18100
  isPressed
@@ -18421,7 +18244,7 @@ function invertSpacing(value) {
18421
18244
  import React17, { useEffect as useEffect27, useMemo as useMemo38, useState as useState42 } from "react";
18422
18245
 
18423
18246
  // src/components/ButtonMenu.tsx
18424
- import { useRef as useRef44 } from "react";
18247
+ import { useRef as useRef43 } from "react";
18425
18248
  import { useMenuTrigger as useMenuTrigger2 } from "react-aria";
18426
18249
  import { useMenuTriggerState as useMenuTriggerState2 } from "react-stately";
18427
18250
  import { jsx as jsx125 } from "react/jsx-runtime";
@@ -18433,7 +18256,7 @@ function ButtonMenu(props) {
18433
18256
  onChange = props.onChange;
18434
18257
  }
18435
18258
  const state = useMenuTriggerState2({ isOpen: defaultOpen });
18436
- const buttonRef = useRef44(null);
18259
+ const buttonRef = useRef43(null);
18437
18260
  const { menuTriggerProps, menuProps } = useMenuTrigger2({ isDisabled: !!disabled }, state, buttonRef);
18438
18261
  const tid = useTestIds(
18439
18262
  props,
@@ -18540,16 +18363,8 @@ function dateFilter(props) {
18540
18363
  }
18541
18364
  var anyOption = {};
18542
18365
  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
- }
18551
18366
  render(value, setValue, tid, inModal, vertical) {
18552
- const { label, operations, getOperationValue, getOperationLabel, defaultValue } = this.props;
18367
+ const { label, operations, getOperationValue, getOperationLabel } = this.props;
18553
18368
  return /* @__PURE__ */ jsxs65(Fragment28, { children: [
18554
18369
  vertical && /* @__PURE__ */ jsx127(Label, { label }),
18555
18370
  /* @__PURE__ */ jsxs65(CompoundField, { children: [
@@ -18566,8 +18381,8 @@ var DateFilter = class extends BaseFilter {
18566
18381
  getOptionLabel: (o) => o === anyOption ? "Any" : getOperationLabel(o),
18567
18382
  value: value?.op,
18568
18383
  onSelect: (op) => (
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)
18384
+ // default the selected date to today if it doesn't exist in the filter's value
18385
+ setValue(op ? { op, value: value?.value ? new Date(value.value) : /* @__PURE__ */ new Date() } : void 0)
18571
18386
  ),
18572
18387
  label: inModal ? `${label} date filter operation` : label,
18573
18388
  labelStyle: !inModal && !vertical ? "inline" : inModal || vertical ? "hidden" : "above",
@@ -18579,13 +18394,9 @@ var DateFilter = class extends BaseFilter {
18579
18394
  DateField,
18580
18395
  {
18581
18396
  labelStyle: "inline",
18582
- value: value?.value ?? defaultValue?.value ?? todayPlainDate(),
18397
+ value: value?.value ? new Date(value.value) : /* @__PURE__ */ new Date(),
18583
18398
  label: "Date",
18584
- onChange: (d) => {
18585
- if (d && value) {
18586
- setValue({ ...value, value: d });
18587
- }
18588
- },
18399
+ onChange: (d) => setValue({ ...value, value: d }),
18589
18400
  disabled: !value,
18590
18401
  ...tid[`${defaultTestId(this.label)}_dateField`]
18591
18402
  }
@@ -18594,9 +18405,6 @@ var DateFilter = class extends BaseFilter {
18594
18405
  ] });
18595
18406
  }
18596
18407
  };
18597
- function isDateFilterValue(value) {
18598
- return typeof value === "object" && value !== null && "op" in value && "value" in value;
18599
- }
18600
18408
 
18601
18409
  // src/components/Filters/DateRangeFilter.tsx
18602
18410
  import { Fragment as Fragment29, jsx as jsx128, jsxs as jsxs66 } from "react/jsx-runtime";
@@ -18604,17 +18412,6 @@ function dateRangeFilter(props) {
18604
18412
  return (key) => new DateRangeFilter(key, props);
18605
18413
  }
18606
18414
  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
- }
18618
18415
  render(value, setValue, tid, inModal, vertical) {
18619
18416
  const { label, placeholderText, disabledDays, testFieldLabel, defaultValue } = this.props;
18620
18417
  return /* @__PURE__ */ jsxs66(Fragment29, { children: [
@@ -18626,17 +18423,8 @@ var DateRangeFilter = class extends BaseFilter {
18626
18423
  isRangeFilterField: true,
18627
18424
  placeholder: placeholderText,
18628
18425
  label: testFieldLabel ?? "Date",
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
- },
18426
+ value: value?.value ? { from: new Date(value.value.from), to: new Date(value.value.to) } : void 0,
18427
+ onChange: (d) => d ? setValue({ op: defaultValue?.op, value: d }) : setValue(void 0),
18640
18428
  disabledDays,
18641
18429
  ...tid[`${defaultTestId(this.label)}_dateField`]
18642
18430
  }
@@ -18644,17 +18432,6 @@ var DateRangeFilter = class extends BaseFilter {
18644
18432
  ] });
18645
18433
  }
18646
18434
  };
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
- }
18658
18435
 
18659
18436
  // src/components/Filters/MultiFilter.tsx
18660
18437
  import { jsx as jsx129 } from "react/jsx-runtime";
@@ -19216,7 +18993,7 @@ function toPageNumberSize(page) {
19216
18993
  }
19217
18994
 
19218
18995
  // src/components/Table/components/EditColumnsButton.tsx
19219
- import { Fragment as Fragment33, useCallback as useCallback22, useMemo as useMemo36, useRef as useRef45 } from "react";
18996
+ import { Fragment as Fragment33, useCallback as useCallback22, useMemo as useMemo36, useRef as useRef44 } from "react";
19220
18997
  import { useMenuTrigger as useMenuTrigger3 } from "react-aria";
19221
18998
  import { useMenuTriggerState as useMenuTriggerState3 } from "react-stately";
19222
18999
  import { jsx as jsx141, jsxs as jsxs72 } from "react/jsx-runtime";
@@ -19231,7 +19008,7 @@ function EditColumnsButton(props) {
19231
19008
  const state = useMenuTriggerState3({
19232
19009
  isOpen: defaultOpen
19233
19010
  });
19234
- const buttonRef = useRef45(null);
19011
+ const buttonRef = useRef44(null);
19235
19012
  const {
19236
19013
  menuTriggerProps
19237
19014
  } = useMenuTrigger3({
@@ -19460,10 +19237,10 @@ function useGridTableLayoutState({
19460
19237
  });
19461
19238
  useEffect27(() => {
19462
19239
  if (page.limit !== persistedPageSize) setPersistedPageSize(page.limit);
19463
- setPage((prev) => prev.offset === 0 ? prev : {
19240
+ setPage((prev) => ({
19464
19241
  ...prev,
19465
19242
  offset: 0
19466
- });
19243
+ }));
19467
19244
  }, [page.limit, persistedPageSize, setPersistedPageSize, filter, searchString]);
19468
19245
  return {
19469
19246
  filter,
@@ -19724,18 +19501,18 @@ var BeamContext = createContext7({
19724
19501
  });
19725
19502
  function BeamProvider({ children, ...presentationProps }) {
19726
19503
  const [, tick] = useReducer((prev) => prev + 1, 0);
19727
- const modalRef = useRef46();
19504
+ const modalRef = useRef45();
19728
19505
  const modalHeaderDiv = useMemo40(() => document.createElement("div"), []);
19729
19506
  const modalBodyDiv = useMemo40(() => {
19730
19507
  const el = document.createElement("div");
19731
19508
  el.style.height = "100%";
19732
19509
  return el;
19733
19510
  }, []);
19734
- const modalCanCloseChecksRef = useRef46([]);
19511
+ const modalCanCloseChecksRef = useRef45([]);
19735
19512
  const modalFooterDiv = useMemo40(() => document.createElement("div"), []);
19736
- const drawerContentStackRef = useRef46([]);
19737
- const drawerCanCloseChecks = useRef46([]);
19738
- const drawerCanCloseDetailsChecks = useRef46([]);
19513
+ const drawerContentStackRef = useRef45([]);
19514
+ const drawerCanCloseChecks = useRef45([]);
19515
+ const drawerCanCloseDetailsChecks = useRef45([]);
19739
19516
  const sdHeaderDiv = useMemo40(() => document.createElement("div"), []);
19740
19517
  const context = useMemo40(() => {
19741
19518
  return {
@@ -19778,14 +19555,14 @@ function useBeamContext() {
19778
19555
  }
19779
19556
 
19780
19557
  // src/components/ButtonDatePicker.tsx
19781
- import { useRef as useRef47 } from "react";
19558
+ import { useRef as useRef46 } from "react";
19782
19559
  import { useMenuTrigger as useMenuTrigger4 } from "react-aria";
19783
19560
  import { useMenuTriggerState as useMenuTriggerState4 } from "react-stately";
19784
19561
  import { jsx as jsx150 } from "react/jsx-runtime";
19785
19562
  function ButtonDatePicker(props) {
19786
19563
  const { defaultOpen, disabled, trigger, onSelect, ...datePickerProps } = props;
19787
19564
  const state = useMenuTriggerState4({ isOpen: defaultOpen });
19788
- const buttonRef = useRef47(null);
19565
+ const buttonRef = useRef46(null);
19789
19566
  const {
19790
19567
  menuTriggerProps,
19791
19568
  menuProps: { autoFocus: _af, ...menuProps }
@@ -19808,7 +19585,7 @@ function ButtonDatePicker(props) {
19808
19585
  }
19809
19586
 
19810
19587
  // src/components/ButtonGroup.tsx
19811
- import { useRef as useRef48 } from "react";
19588
+ import { useRef as useRef47 } from "react";
19812
19589
  import { useButton as useButton10, useFocusRing as useFocusRing12, useHover as useHover15 } from "react-aria";
19813
19590
  import { trussProps as trussProps73 } from "@homebound/truss/runtime";
19814
19591
  import { jsx as jsx151, jsxs as jsxs78 } from "react/jsx-runtime";
@@ -19856,7 +19633,7 @@ function GroupButton(props) {
19856
19633
  isDisabled: !!disabled,
19857
19634
  ...otherProps
19858
19635
  };
19859
- const ref = useRef48(null);
19636
+ const ref = useRef47(null);
19860
19637
  const {
19861
19638
  buttonProps,
19862
19639
  isPressed
@@ -19979,7 +19756,7 @@ import { useHover as useHover16 } from "react-aria";
19979
19756
 
19980
19757
  // src/components/Tag.tsx
19981
19758
  import { useResizeObserver as useResizeObserver4 } from "@react-aria/utils";
19982
- import { useRef as useRef49, useState as useState44 } from "react";
19759
+ import { useRef as useRef48, useState as useState44 } from "react";
19983
19760
  import { trussProps as trussProps74 } from "@homebound/truss/runtime";
19984
19761
  import { jsx as jsx152, jsxs as jsxs79 } from "react/jsx-runtime";
19985
19762
  function Tag(props) {
@@ -19993,7 +19770,7 @@ function Tag(props) {
19993
19770
  const typeStyles2 = getStyles(type);
19994
19771
  const tid = useTestIds(otherProps);
19995
19772
  const [showTooltip, setShowTooltip] = useState44(false);
19996
- const ref = useRef49(null);
19773
+ const ref = useRef48(null);
19997
19774
  useResizeObserver4({
19998
19775
  ref,
19999
19776
  onResize: () => {
@@ -20202,7 +19979,7 @@ function Copy(props) {
20202
19979
 
20203
19980
  // src/components/DnDGrid/DnDGrid.tsx
20204
19981
  import equal2 from "fast-deep-equal";
20205
- import { useCallback as useCallback24, useRef as useRef50 } from "react";
19982
+ import { useCallback as useCallback24, useRef as useRef49 } from "react";
20206
19983
 
20207
19984
  // src/components/DnDGrid/DnDGridContext.tsx
20208
19985
  import { createContext as createContext8, useContext as useContext18 } from "react";
@@ -20225,12 +20002,12 @@ function DnDGrid(props) {
20225
20002
  onReorder,
20226
20003
  activeItemStyles
20227
20004
  } = props;
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({
20005
+ const gridEl = useRef49(null);
20006
+ const dragEl = useRef49();
20007
+ const cloneEl = useRef49();
20008
+ const initialOrder = useRef49();
20009
+ const reorderViaKeyboard = useRef49(false);
20010
+ const transformFrom = useRef49({
20234
20011
  x: 0,
20235
20012
  y: 0
20236
20013
  });
@@ -20692,14 +20469,14 @@ function HbSpinnerProvider({
20692
20469
 
20693
20470
  // src/components/MaxLines.tsx
20694
20471
  import { useLayoutEffect as useLayoutEffect2, useResizeObserver as useResizeObserver5 } from "@react-aria/utils";
20695
- import { useCallback as useCallback25, useEffect as useEffect30, useRef as useRef51, useState as useState45 } from "react";
20472
+ import { useCallback as useCallback25, useEffect as useEffect30, useRef as useRef50, useState as useState45 } from "react";
20696
20473
  import { trussProps as trussProps80 } from "@homebound/truss/runtime";
20697
20474
  import { jsx as jsx160, jsxs as jsxs82 } from "react/jsx-runtime";
20698
20475
  function MaxLines({
20699
20476
  maxLines,
20700
20477
  children
20701
20478
  }) {
20702
- const elRef = useRef51(null);
20479
+ const elRef = useRef50(null);
20703
20480
  const [hasMore, setHasMore] = useState45(false);
20704
20481
  const [expanded, setExpanded] = useState45(false);
20705
20482
  useLayoutEffect2(() => {
@@ -20735,7 +20512,7 @@ function MaxLines({
20735
20512
 
20736
20513
  // src/components/ScrollShadows.tsx
20737
20514
  import { useResizeObserver as useResizeObserver6 } from "@react-aria/utils";
20738
- import { useCallback as useCallback26, useMemo as useMemo47, useRef as useRef52, useState as useState46 } from "react";
20515
+ import { useCallback as useCallback26, useMemo as useMemo47, useRef as useRef51, useState as useState46 } from "react";
20739
20516
  import { trussProps as trussProps81 } from "@homebound/truss/runtime";
20740
20517
  import { jsx as jsx161, jsxs as jsxs83 } from "react/jsx-runtime";
20741
20518
  function ScrollShadows(props) {
@@ -20755,7 +20532,7 @@ function ScrollShadows(props) {
20755
20532
  }
20756
20533
  const [showStartShadow, setShowStartShadow] = useState46(false);
20757
20534
  const [showEndShadow, setShowEndShadow] = useState46(false);
20758
- const scrollRef = useRef52(null);
20535
+ const scrollRef = useRef51(null);
20759
20536
  const [startShadowStyles, endShadowStyles] = useMemo47(() => {
20760
20537
  const transparentBgColor = bgColor.replace(/,1\)$/, ",0)");
20761
20538
  const commonStyles = {
@@ -20928,7 +20705,7 @@ function useSnackbar() {
20928
20705
  var snackbarId = 1;
20929
20706
 
20930
20707
  // src/components/Stepper.tsx
20931
- import { useRef as useRef53 } from "react";
20708
+ import { useRef as useRef52 } from "react";
20932
20709
  import { useButton as useButton11, useFocusRing as useFocusRing14, useHover as useHover18 } from "react-aria";
20933
20710
  import { trussProps as trussProps82 } from "@homebound/truss/runtime";
20934
20711
  import { jsx as jsx162, jsxs as jsxs84 } from "react/jsx-runtime";
@@ -21006,7 +20783,7 @@ function StepButton(props) {
21006
20783
  onPress: onClick,
21007
20784
  isDisabled: disabled
21008
20785
  };
21009
- const ref = useRef53(null);
20786
+ const ref = useRef52(null);
21010
20787
  const {
21011
20788
  buttonProps,
21012
20789
  isPressed
@@ -21400,7 +21177,7 @@ function visit(rows, fn) {
21400
21177
 
21401
21178
  // src/components/Tabs.tsx
21402
21179
  import { camelCase as camelCase5 } from "change-case";
21403
- import { useEffect as useEffect32, useMemo as useMemo49, useRef as useRef54, useState as useState47 } from "react";
21180
+ import { useEffect as useEffect32, useMemo as useMemo49, useRef as useRef53, useState as useState47 } from "react";
21404
21181
  import { mergeProps as mergeProps26, useFocusRing as useFocusRing15, useHover as useHover19 } from "react-aria";
21405
21182
  import { matchPath, Route } from "react-router";
21406
21183
  import { Link as Link5, useLocation } from "react-router-dom";
@@ -21459,7 +21236,7 @@ function Tabs(props) {
21459
21236
  } = useFocusRing15();
21460
21237
  const tid = useTestIds(others, "tabs");
21461
21238
  const [active, setActive] = useState47(selected);
21462
- const ref = useRef54(null);
21239
+ const ref = useRef53(null);
21463
21240
  useEffect32(() => setActive(selected), [selected]);
21464
21241
  function onKeyUp(e) {
21465
21242
  if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
@@ -21857,7 +21634,6 @@ export {
21857
21634
  filterTestIdPrefix,
21858
21635
  formatDate,
21859
21636
  formatDateRange,
21860
- formatPlainDate,
21861
21637
  formatValue,
21862
21638
  generateColumnId,
21863
21639
  getAlignment,