@homebound/beam 3.2.0-alpha.2 → 3.2.0-alpha.3

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.d.cts CHANGED
@@ -4735,6 +4735,7 @@ type InfiniteScroll = {
4735
4735
  endOffsetPx?: number;
4736
4736
  };
4737
4737
 
4738
+ type GridCellValue = number | string | Date | boolean | Temporal.PlainDate | Temporal.ZonedDateTime | null | undefined;
4738
4739
  /**
4739
4740
  * Allows a cell to be more than just a RectNode, i.e. declare its alignment or
4740
4741
  * primitive value for filtering and sorting.
@@ -4748,9 +4749,9 @@ type GridCellContent = {
4748
4749
  content: MaybeFn<ReactNode>;
4749
4750
  alignment?: GridCellAlignment;
4750
4751
  /** Allow value to be a function in case it's a dynamic value i.e. reading from an inline-edited proxy. */
4751
- value?: MaybeFn<number | string | Date | boolean | null | undefined>;
4752
+ value?: MaybeFn<GridCellValue>;
4752
4753
  /** The value to use specifically for sorting (i.e. if `value` is used for filtering); defaults to `value`. */
4753
- sortValue?: MaybeFn<number | string | Date | boolean | null | undefined>;
4754
+ sortValue?: MaybeFn<GridCellValue>;
4754
4755
  colspan?: number;
4755
4756
  typeScale?: Typography;
4756
4757
  /** Allows the cell to stay in place when the user scrolls horizontally, i.e. frozen columns. */
package/dist/index.d.ts CHANGED
@@ -4735,6 +4735,7 @@ type InfiniteScroll = {
4735
4735
  endOffsetPx?: number;
4736
4736
  };
4737
4737
 
4738
+ type GridCellValue = number | string | Date | boolean | Temporal.PlainDate | Temporal.ZonedDateTime | null | undefined;
4738
4739
  /**
4739
4740
  * Allows a cell to be more than just a RectNode, i.e. declare its alignment or
4740
4741
  * primitive value for filtering and sorting.
@@ -4748,9 +4749,9 @@ type GridCellContent = {
4748
4749
  content: MaybeFn<ReactNode>;
4749
4750
  alignment?: GridCellAlignment;
4750
4751
  /** Allow value to be a function in case it's a dynamic value i.e. reading from an inline-edited proxy. */
4751
- value?: MaybeFn<number | string | Date | boolean | null | undefined>;
4752
+ value?: MaybeFn<GridCellValue>;
4752
4753
  /** The value to use specifically for sorting (i.e. if `value` is used for filtering); defaults to `value`. */
4753
- sortValue?: MaybeFn<number | string | Date | boolean | null | undefined>;
4754
+ sortValue?: MaybeFn<GridCellValue>;
4754
4755
  colspan?: number;
4755
4756
  typeScale?: Typography;
4756
4757
  /** Allows the cell to stay in place when the user scrolls horizontally, i.e. frozen columns. */
package/dist/index.js CHANGED
@@ -7516,6 +7516,7 @@ var RowState = class {
7516
7516
  };
7517
7517
 
7518
7518
  // src/components/Table/utils/sortRows.ts
7519
+ import { Temporal as Temporal2 } from "temporal-polyfill";
7519
7520
  function sortRows(columns, rows, sortState, caseSensitive) {
7520
7521
  const fn = sortFn(columns, sortState, caseSensitive);
7521
7522
  const sorted = [...rows].sort(fn);
@@ -7580,7 +7581,7 @@ function sortValue(value, caseSensitive) {
7580
7581
  if (maybeFn instanceof Function) {
7581
7582
  maybeFn = maybeFn();
7582
7583
  }
7583
- return typeof maybeFn === "string" && !caseSensitive ? maybeFn.toLowerCase() : maybeFn;
7584
+ return normalizeSortValue(maybeFn, caseSensitive);
7584
7585
  }
7585
7586
  function ensureClientSideSortValueIsSortable(sortOn, isHeader, column2, idx, maybeContent) {
7586
7587
  if (process.env.NODE_ENV !== "production" && !isHeader && sortOn === "client" && column2.clientSideSort !== false) {
@@ -7595,7 +7596,24 @@ function ensureClientSideSortValueIsSortable(sortOn, isHeader, column2, idx, may
7595
7596
  }
7596
7597
  function canClientSideSort(value) {
7597
7598
  const t = typeof value;
7598
- return value === null || t === "undefined" || t === "number" || t === "string" || t === "boolean" || value instanceof Date;
7599
+ return value === null || t === "undefined" || t === "number" || t === "string" || t === "bigint" || t === "boolean" || value instanceof Date || isPlainDate2(value) || isZonedDateTime(value);
7600
+ }
7601
+ function normalizeSortValue(value, caseSensitive) {
7602
+ if (isPlainDate2(value)) {
7603
+ return value.toString();
7604
+ } else if (isZonedDateTime(value)) {
7605
+ return value.epochNanoseconds;
7606
+ } else if (typeof value === "string" && !caseSensitive) {
7607
+ return value.toLowerCase();
7608
+ } else {
7609
+ return value;
7610
+ }
7611
+ }
7612
+ function isPlainDate2(value) {
7613
+ return value instanceof Temporal2.PlainDate;
7614
+ }
7615
+ function isZonedDateTime(value) {
7616
+ return value instanceof Temporal2.ZonedDateTime;
7599
7617
  }
7600
7618
 
7601
7619
  // src/components/Table/components/Row.tsx
@@ -12209,7 +12227,7 @@ function CheckboxGroupItem(props) {
12209
12227
  import { useState as useState20 } from "react";
12210
12228
 
12211
12229
  // src/inputs/DateFields/utils.ts
12212
- import { Temporal as Temporal2 } from "temporal-polyfill";
12230
+ import { Temporal as Temporal3 } from "temporal-polyfill";
12213
12231
  var dateFormats = {
12214
12232
  short: "shortDate",
12215
12233
  medium: "shortWeekdayMonthDay",
@@ -12236,7 +12254,7 @@ function parseDateRange(str, format) {
12236
12254
  const [from = "", to = ""] = str.split("-");
12237
12255
  const fromDate = parseDateString(from.trim(), format);
12238
12256
  const toDate = parseDateString(to.trim(), format);
12239
- if (toDate && fromDate && Temporal2.PlainDate.compare(toDate, fromDate) < 0) {
12257
+ if (toDate && fromDate && Temporal3.PlainDate.compare(toDate, fromDate) < 0) {
12240
12258
  return { from: toDate, to: fromDate };
12241
12259
  }
12242
12260
  if (toDate === void 0 && fromDate === void 0) {
@@ -12263,7 +12281,7 @@ function parseDateString(str, format) {
12263
12281
  return void 0;
12264
12282
  }
12265
12283
  try {
12266
- return Temporal2.PlainDate.from({
12284
+ return Temporal3.PlainDate.from({
12267
12285
  year: yearLength === 2 ? normalizeTwoDigitYear(year, todayPlainDate().year) : year,
12268
12286
  month,
12269
12287
  day