@trackunit/react-table-base-components 2.1.2 → 2.1.4

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/index.cjs.js CHANGED
@@ -7,6 +7,7 @@ var tailwindMerge = require('tailwind-merge');
7
7
  var reactFormComponents = require('@trackunit/react-form-components');
8
8
  var cssClassVarianceUtilities = require('@trackunit/css-class-variance-utilities');
9
9
  var dateAndTimeUtils = require('@trackunit/date-and-time-utils');
10
+ var reactDateAndTimeHooks = require('@trackunit/react-date-and-time-hooks');
10
11
  var react = require('react');
11
12
  var sharedUtils = require('@trackunit/shared-utils');
12
13
 
@@ -287,7 +288,11 @@ const cvaDateTimeSince$1 = cssClassVarianceUtilities.cvaMerge(["slashed-zero", "
287
288
  * @param {DateTimeCellProps} props - The props for the DateTimeCell component
288
289
  * @returns {ReactElement} DateTimeCell component
289
290
  */
290
- const DateTimeCell = ({ format, timeZone, locale, date, withTimeSince = true, className, "data-testid": dataTestId, style, }) => {
291
+ const DateTimeCell = ({ format, date, withTimeSince = true, className, "data-testid": dataTestId, style, timeZone: timeZoneProp, locale: localeProp, }) => {
292
+ const { preferred: preferredTimezone } = reactDateAndTimeHooks.useTimezone();
293
+ const resolvedLocale = reactDateAndTimeHooks.useLocale();
294
+ const timeZone = timeZoneProp ?? preferredTimezone.id;
295
+ const locale = localeProp ?? resolvedLocale;
291
296
  if (!date) {
292
297
  return null;
293
298
  }
package/index.esm.js CHANGED
@@ -5,6 +5,7 @@ import { twMerge } from 'tailwind-merge';
5
5
  import { Checkbox } from '@trackunit/react-form-components';
6
6
  import { cvaMerge } from '@trackunit/css-class-variance-utilities';
7
7
  import { formatDateUtil, timeSinceAuto, timeSinceInDays, Temporal } from '@trackunit/date-and-time-utils';
8
+ import { useTimezone, useLocale } from '@trackunit/react-date-and-time-hooks';
8
9
  import { useMemo, useState, useEffect, isValidElement, cloneElement } from 'react';
9
10
  import { DateTimeFormat } from '@trackunit/shared-utils';
10
11
 
@@ -285,7 +286,11 @@ const cvaDateTimeSince$1 = cvaMerge(["slashed-zero", "text-neutral-500", "text-x
285
286
  * @param {DateTimeCellProps} props - The props for the DateTimeCell component
286
287
  * @returns {ReactElement} DateTimeCell component
287
288
  */
288
- const DateTimeCell = ({ format, timeZone, locale, date, withTimeSince = true, className, "data-testid": dataTestId, style, }) => {
289
+ const DateTimeCell = ({ format, date, withTimeSince = true, className, "data-testid": dataTestId, style, timeZone: timeZoneProp, locale: localeProp, }) => {
290
+ const { preferred: preferredTimezone } = useTimezone();
291
+ const resolvedLocale = useLocale();
292
+ const timeZone = timeZoneProp ?? preferredTimezone.id;
293
+ const locale = localeProp ?? resolvedLocale;
289
294
  if (!date) {
290
295
  return null;
291
296
  }
package/package.json CHANGED
@@ -1,19 +1,20 @@
1
1
  {
2
2
  "name": "@trackunit/react-table-base-components",
3
- "version": "2.1.2",
3
+ "version": "2.1.4",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
7
7
  "node": ">=24.x"
8
8
  },
9
9
  "dependencies": {
10
- "@trackunit/react-components": "2.1.1",
11
- "@trackunit/ui-icons": "1.13.12",
12
- "@trackunit/react-form-components": "2.1.2",
13
- "@trackunit/css-class-variance-utilities": "1.13.12",
14
- "@trackunit/date-and-time-utils": "1.13.13",
15
- "@trackunit/shared-utils": "1.15.12",
16
- "@trackunit/i18n-library-translation": "2.0.3",
10
+ "@trackunit/react-components": "2.1.3",
11
+ "@trackunit/ui-icons": "1.13.14",
12
+ "@trackunit/react-form-components": "2.1.4",
13
+ "@trackunit/css-class-variance-utilities": "1.13.13",
14
+ "@trackunit/date-and-time-utils": "1.13.14",
15
+ "@trackunit/react-date-and-time-hooks": "2.1.4",
16
+ "@trackunit/shared-utils": "1.15.13",
17
+ "@trackunit/i18n-library-translation": "2.0.5",
17
18
  "tailwind-merge": "^2.0.0"
18
19
  },
19
20
  "peerDependencies": {
@@ -1,5 +1,6 @@
1
1
  import { TemporalFormat } from "@trackunit/date-and-time-utils";
2
2
  import { CommonProps, Refable, type Styleable } from "@trackunit/react-components";
3
+ import { ReactElement } from "react";
3
4
  export interface DateTimeCellProps extends CommonProps, Refable<HTMLDivElement>, Styleable {
4
5
  /**
5
6
  * The date to render.
@@ -20,13 +21,16 @@ export interface DateTimeCellProps extends CommonProps, Refable<HTMLDivElement>,
20
21
  */
21
22
  format?: TemporalFormat;
22
23
  /**
23
- * The time zone to use for the date.
24
- * See the formatDateUtil function for more information.
24
+ * Explicit timezone override (IANA timezone string, e.g. `"America/New_York"`).
25
+ * When provided, takes precedence over the automatically resolved timezone from context.
26
+ *
27
+ * In most cases you do not need this — the component resolves the correct timezone
28
+ * automatically via `AssetTimezoneProvider` and user preference context.
25
29
  */
26
30
  timeZone?: string;
27
31
  /**
28
- * The locale to use for the date.
29
- * See the formatDateUtil function for more information.
32
+ * Explicit locale override (BCP 47 language tag, e.g. `"en-US"`).
33
+ * When provided, takes precedence over the locale resolved from context.
30
34
  */
31
35
  locale?: string;
32
36
  }
@@ -86,7 +90,4 @@ export interface DateTimeCellProps extends CommonProps, Refable<HTMLDivElement>,
86
90
  * @param {DateTimeCellProps} props - The props for the DateTimeCell component
87
91
  * @returns {ReactElement} DateTimeCell component
88
92
  */
89
- export declare const DateTimeCell: ({ format, timeZone, locale, date, withTimeSince, className, "data-testid": dataTestId, style, }: DateTimeCellProps) => import("react/jsx-runtime").JSX.Element | null;
90
- export interface TimeSinceProps extends Pick<DateTimeCellProps, "date" | "timeZone" | "locale"> {
91
- date: Date;
92
- }
93
+ export declare const DateTimeCell: ({ format, date, withTimeSince, className, "data-testid": dataTestId, style, timeZone: timeZoneProp, locale: localeProp, }: DateTimeCellProps) => ReactElement | null;