@datum-cloud/datum-ui 1.8.0 → 2.1.0
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/autocomplete/index.mjs +1 -1
- package/dist/{autocomplete-DM6JYV4W.mjs → autocomplete-DZ_HSBak.mjs} +1 -1
- package/dist/autosearch/index.mjs +1 -1
- package/dist/{calendar-date-picker-AzvSqjeS.mjs → calendar-date-picker-ynSGADfR.mjs} +1 -1
- package/dist/components/base/sheet/sheet.d.ts +2 -1
- package/dist/components/features/data-table/columns/selection-column.d.ts +5 -4
- package/dist/components/features/data-table/components/bulk-actions.d.ts +2 -1
- package/dist/components/features/data-table/components/column-header.d.ts +2 -1
- package/dist/components/features/data-table/components/inline-content.d.ts +2 -1
- package/dist/components/features/data-table/components/row-actions.d.ts +2 -1
- package/dist/components/features/data-table/core/client-provider.d.ts +3 -2
- package/dist/components/features/data-table/core/data-table-context.d.ts +46 -6
- package/dist/components/features/data-table/core/features.d.ts +59 -0
- package/dist/components/features/data-table/core/filter-engine.d.ts +4 -3
- package/dist/components/features/data-table/core/server-provider.d.ts +3 -2
- package/dist/components/features/data-table/core/store.d.ts +2 -1
- package/dist/components/features/data-table/hooks/use-data-table-client.d.ts +86 -7
- package/dist/components/features/data-table/hooks/use-data-table-server.d.ts +86 -7
- package/dist/components/features/data-table/hooks/use-selectors.d.ts +7 -6
- package/dist/components/features/data-table/index.d.ts +2 -0
- package/dist/components/features/data-table/types.d.ts +30 -29
- package/dist/components/features/date-time/date-time.d.ts +6 -0
- package/dist/components/features/date-time/formatters.d.ts +13 -0
- package/dist/components/features/date-time/index.d.ts +3 -0
- package/dist/components/features/date-time/types.d.ts +47 -0
- package/dist/components/features/grouped-table/grouped-table.d.ts +2 -1
- package/dist/components/features/grouped-table/lib/bucket-rows.d.ts +3 -2
- package/dist/components/features/grouped-table/lib/compose-columns.d.ts +4 -3
- package/dist/components/features/grouped-table/lib/sort-rows.d.ts +3 -2
- package/dist/components/features/grouped-table/types.d.ts +7 -6
- package/dist/components/features/grouped-table/use-grouped-expansion.d.ts +2 -1
- package/dist/components/features/index.d.ts +1 -0
- package/dist/components/features/logs/components/detail.d.ts +3 -0
- package/dist/components/features/logs/components/explorer.d.ts +3 -0
- package/dist/components/features/logs/components/filters.d.ts +11 -0
- package/dist/components/features/logs/components/root.d.ts +2 -0
- package/dist/components/features/logs/components/status-badge.d.ts +7 -0
- package/dist/components/features/logs/components/table.d.ts +3 -0
- package/dist/components/features/logs/components/toolbar.d.ts +12 -0
- package/dist/components/features/logs/fixtures/index.d.ts +2 -0
- package/dist/components/features/logs/hooks/use-controllable-state.d.ts +5 -0
- package/dist/components/features/logs/hooks/use-logs.d.ts +3 -0
- package/dist/components/features/logs/index.d.ts +4 -0
- package/dist/components/features/logs/logs.d.ts +18 -0
- package/dist/components/features/logs/types.d.ts +105 -0
- package/dist/components/features/logs/utils/build-logql.d.ts +2 -0
- package/dist/components/features/logs/utils/constants.d.ts +6 -0
- package/dist/components/features/logs/utils/facets.d.ts +3 -0
- package/dist/components/features/logs/utils/flatten-loki.d.ts +3 -0
- package/dist/components/features/logs/utils/format-timestamp.d.ts +4 -0
- package/dist/components/features/logs/utils/index.d.ts +8 -0
- package/dist/components/features/logs/utils/parse-log-line.d.ts +7 -0
- package/dist/components/features/logs/utils/severity.d.ts +5 -0
- package/dist/components/features/logs/utils/time-range.d.ts +3 -0
- package/dist/data-table/index.mjs +2 -2
- package/dist/{data-table-mByk373T.mjs → data-table-Du7_FLBi.mjs} +44 -12
- package/dist/date-picker/index.mjs +3 -3
- package/dist/date-time/index.mjs +2 -0
- package/dist/date-time-CA-09lnw.mjs +134 -0
- package/dist/date-time-picker/index.mjs +1 -1
- package/dist/{date-time-picker-D3-DeNo8.mjs → date-time-picker-BzcHrf-A.mjs} +1 -1
- package/dist/{picker-b5-x-EHs.mjs → date-time-range-picker-Dog33Ry0.mjs} +22 -456
- package/dist/form/index.mjs +1 -1
- package/dist/{form-BUUNQfC9.mjs → form-BhBsoMFA.mjs} +4 -4
- package/dist/grouped-table/index.mjs +1 -1
- package/dist/{grouped-table-b2jDEPR6.mjs → grouped-table--jejU1Jy.mjs} +5 -6
- package/dist/index.mjs +19 -18
- package/dist/logs/fixtures/index.mjs +231 -0
- package/dist/logs/index.mjs +980 -0
- package/dist/mobile-sheet/index.mjs +1 -1
- package/dist/{mobile-sheet-D9L-JOee.mjs → mobile-sheet-BYp-QQmn.mjs} +1 -1
- package/dist/more-actions/index.mjs +1 -1
- package/dist/{more-actions-Bx443Ccx.mjs → more-actions-B1FUf2rm.mjs} +1 -1
- package/dist/multi-select/index.mjs +1 -1
- package/dist/{multi-select-PHaMEbY-.mjs → multi-select-PtdMChPF.mjs} +1 -1
- package/dist/picker/index.mjs +2 -1
- package/dist/picker-raVuDxsh.mjs +453 -0
- package/dist/responsive-dropdown/index.mjs +1 -1
- package/dist/{responsive-dropdown-fCmduKaz.mjs → responsive-dropdown-n0Txkax5.mjs} +1 -1
- package/dist/responsive-popover/index.mjs +1 -1
- package/dist/{responsive-popover-DJZgXWIE.mjs → responsive-popover-C_1nzIvm.mjs} +1 -1
- package/dist/rich-text-editor/index.mjs +1 -1
- package/dist/{rich-text-editor-CGuSn8xi.mjs → rich-text-editor-Dohp-pbf.mjs} +1 -1
- package/dist/sheet/index.mjs +1 -1
- package/dist/{sheet-BZViad2U.mjs → sheet-C2i2k5i2.mjs} +2 -2
- package/dist/task-queue/index.mjs +1 -1
- package/dist/{task-queue-dropdown-pqFd4rSf.mjs → task-queue-dropdown-ClLLTMxU.mjs} +1 -1
- package/dist/time-picker/index.mjs +1 -1
- package/dist/{time-picker-B_fN5vhO.mjs → time-picker-CFhaHTtI.mjs} +1 -1
- package/dist/{to-api-format-43Boq7OR.mjs → to-api-format-WC7b9Mcv.mjs} +2 -2
- package/package.json +20 -5
|
@@ -3,20 +3,20 @@ import { t as Badge } from "./badge-BTNW_FEU.mjs";
|
|
|
3
3
|
import { t as Button } from "./button-A1qTjZ8U.mjs";
|
|
4
4
|
import { t as Checkbox } from "./checkbox-C6P12fio.mjs";
|
|
5
5
|
import { t as Input } from "./input-j4tbmYYz.mjs";
|
|
6
|
-
import { t as ResponsiveDropdown } from "./responsive-dropdown-
|
|
6
|
+
import { t as ResponsiveDropdown } from "./responsive-dropdown-n0Txkax5.mjs";
|
|
7
7
|
import { i as SelectItem, l as SelectTrigger, n as SelectContent, t as Select, u as SelectValue } from "./select-DCU44UO6.mjs";
|
|
8
8
|
import { Skeleton } from "./skeleton/index.mjs";
|
|
9
9
|
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "./table/index.mjs";
|
|
10
|
-
import { t as Autocomplete } from "./autocomplete-
|
|
11
|
-
import { t as CalendarDatePicker } from "./calendar-date-picker-
|
|
10
|
+
import { t as Autocomplete } from "./autocomplete-DZ_HSBak.mjs";
|
|
11
|
+
import { t as CalendarDatePicker } from "./calendar-date-picker-ynSGADfR.mjs";
|
|
12
12
|
import { t as ActionRow } from "./action-row-DTvs91_3.mjs";
|
|
13
13
|
import { n as useDebouncedSearchInput } from "./use-debounced-search-input-yu_F0QBt.mjs";
|
|
14
|
-
import { t as MultiSelect } from "./multi-select-
|
|
14
|
+
import { t as MultiSelect } from "./multi-select-PtdMChPF.mjs";
|
|
15
15
|
import { ArrowDown, ArrowUp, ArrowUpDown, ChevronLeft, ChevronRight, MoreHorizontal, X } from "lucide-react";
|
|
16
16
|
import { createContext, memo, use, useCallback, useContext, useEffect, useId, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
17
17
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
18
18
|
import { parseAsInteger, parseAsString, useQueryStates } from "nuqs";
|
|
19
|
-
import { flexRender,
|
|
19
|
+
import { columnFilteringFeature, columnSizingFeature, columnVisibilityFeature, createFilteredRowModel, createPaginatedRowModel, createSortedRowModel, filterFns, flexRender, globalFilteringFeature, rowPaginationFeature, rowSelectionFeature, rowSortingFeature, sortFns, tableFeatures, useTable } from "@tanstack/react-table";
|
|
20
20
|
//#region src/components/features/data-table/constants.ts
|
|
21
21
|
const DEFAULT_PAGE_SIZE = 20;
|
|
22
22
|
const DEFAULT_PAGE_SIZES = [
|
|
@@ -206,6 +206,40 @@ function DataTableRowActions({ row, actions, isLoading = false, className, respo
|
|
|
206
206
|
});
|
|
207
207
|
}
|
|
208
208
|
//#endregion
|
|
209
|
+
//#region src/components/features/data-table/core/features.ts
|
|
210
|
+
/**
|
|
211
|
+
* The single TanStack Table v9 feature set used by every table in this package.
|
|
212
|
+
*
|
|
213
|
+
* v9 made features opt-in and threaded a `TFeatures` generic through every
|
|
214
|
+
* public type (`ColumnDef<TFeatures, TData, TValue>`, `Row<TFeatures, TData>`,
|
|
215
|
+
* ...). Leaving that generic open would push the parameter into every exported
|
|
216
|
+
* type in this library and force consumers to thread it through their own code.
|
|
217
|
+
*
|
|
218
|
+
* Declaring one concrete feature set and referencing `DataTableFeatures`
|
|
219
|
+
* internally keeps our public types parameterised on `TData` alone, which is
|
|
220
|
+
* what they were in v8.
|
|
221
|
+
*
|
|
222
|
+
* `data-table` needs sorting, pagination and row selection; `grouped-table`
|
|
223
|
+
* additionally needs global filtering for its search box. Both need column
|
|
224
|
+
* sizing (`columnDef.size` drives the shared grid template) and column
|
|
225
|
+
* visibility (`enableHiding` on the injected selection column). The set is the
|
|
226
|
+
* union rather than `stockFeatures` so unused features stay out of the bundle.
|
|
227
|
+
*/
|
|
228
|
+
const dataTableFeatures = tableFeatures({
|
|
229
|
+
columnFilteringFeature,
|
|
230
|
+
columnSizingFeature,
|
|
231
|
+
columnVisibilityFeature,
|
|
232
|
+
globalFilteringFeature,
|
|
233
|
+
rowPaginationFeature,
|
|
234
|
+
rowSelectionFeature,
|
|
235
|
+
rowSortingFeature,
|
|
236
|
+
filteredRowModel: createFilteredRowModel(),
|
|
237
|
+
paginatedRowModel: createPaginatedRowModel(),
|
|
238
|
+
sortedRowModel: createSortedRowModel(),
|
|
239
|
+
filterFns,
|
|
240
|
+
sortFns
|
|
241
|
+
});
|
|
242
|
+
//#endregion
|
|
209
243
|
//#region src/components/features/data-table/core/filter-engine.ts
|
|
210
244
|
/**
|
|
211
245
|
* Resolve a dot-path on an object (e.g. "status.registrationApproval").
|
|
@@ -1107,7 +1141,8 @@ function useClientTable(store, options) {
|
|
|
1107
1141
|
const { columns, getRowId, enableRowSelection = false, stateAdapter } = options;
|
|
1108
1142
|
const resolvedColumns = useMemo(() => enableRowSelection ? withSelectionColumn(columns, typeof enableRowSelection === "object" ? enableRowSelection : {}) : columns, [columns, enableRowSelection]);
|
|
1109
1143
|
const { filteredData, sorting, rowSelection, pageIndex, pageSize: storePageSize, filters, search } = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot);
|
|
1110
|
-
const table =
|
|
1144
|
+
const table = useTable({
|
|
1145
|
+
features: dataTableFeatures,
|
|
1111
1146
|
data: filteredData,
|
|
1112
1147
|
columns: resolvedColumns,
|
|
1113
1148
|
state: {
|
|
@@ -1133,9 +1168,6 @@ function useClientTable(store, options) {
|
|
|
1133
1168
|
}) : updater;
|
|
1134
1169
|
store.setPagination(next.pageIndex, next.pageSize);
|
|
1135
1170
|
},
|
|
1136
|
-
getCoreRowModel: getCoreRowModel(),
|
|
1137
|
-
getSortedRowModel: getSortedRowModel(),
|
|
1138
|
-
getPaginationRowModel: getPaginationRowModel(),
|
|
1139
1171
|
getRowId,
|
|
1140
1172
|
enableRowSelection: !!enableRowSelection
|
|
1141
1173
|
});
|
|
@@ -1345,7 +1377,8 @@ function useServerTable(store, options) {
|
|
|
1345
1377
|
store
|
|
1346
1378
|
]);
|
|
1347
1379
|
const resolvedColumns = useMemo(() => enableRowSelection ? withSelectionColumn(columns, typeof enableRowSelection === "object" ? enableRowSelection : {}) : columns, [columns, enableRowSelection]);
|
|
1348
|
-
const table =
|
|
1380
|
+
const table = useTable({
|
|
1381
|
+
features: dataTableFeatures,
|
|
1349
1382
|
data: store.getSnapshot().data,
|
|
1350
1383
|
columns: resolvedColumns,
|
|
1351
1384
|
state: {
|
|
@@ -1360,7 +1393,6 @@ function useServerTable(store, options) {
|
|
|
1360
1393
|
manualSorting: true,
|
|
1361
1394
|
manualFiltering: true,
|
|
1362
1395
|
pageCount: hasNextPageRef.current ? pageIndex + 2 : pageIndex + 1,
|
|
1363
|
-
getCoreRowModel: getCoreRowModel(),
|
|
1364
1396
|
getRowId,
|
|
1365
1397
|
enableRowSelection: !!enableRowSelection,
|
|
1366
1398
|
onSortingChange: (updater) => {
|
|
@@ -1579,4 +1611,4 @@ const DataTable = {
|
|
|
1579
1611
|
DatePickerFilter
|
|
1580
1612
|
};
|
|
1581
1613
|
//#endregion
|
|
1582
|
-
export {
|
|
1614
|
+
export { useNuqsAdapter as _, useDataTablePagination as a, DEFAULT_PAGE_SIZE as b, useDataTableSelection as c, resolvePath as d, rowMatchesSearch as f, createSelectionColumn as g, DataTableColumnHeader as h, useDataTableLoading as i, useDataTableSorting as l, DataTableRowActions as m, useDataTableFilters as n, useDataTableRows as o, dataTableFeatures as p, useDataTableInlineContents as r, useDataTableSearch as s, DataTable as t, createDataTableStore as u, DEFAULT_DEBOUNCE_MS as v, DEFAULT_PAGE_SIZES as x, DEFAULT_LOADING_ROWS as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as CalendarDatePicker } from "../calendar-date-picker-
|
|
3
|
-
import { _ as getShortTimezoneDisplay, a as TimeRangePicker, b as utcToLocalInputString, c as getPresetByKey, d as TimezoneSelector, f as QuickRangesPanel, g as getDefaultTimezoneOptions, h as formatUtcForDisplay, i as formatTimeRangeDisplay, l as getPresetByShortcut, m as createTimezoneOption, n as formatDateForInput, o as DEFAULT_PRESETS, p as CustomRangePanel, r as formatSingleTimeDisplay, s as getDefaultPreset, t as toApiTimeRange, u as getPresetRange, v as localInputStringToUtc, x as zonedDateToUtcString, y as utcStringToZonedDate } from "../to-api-format-
|
|
1
|
+
import { M as getBrowserTimezone, N as getTimezoneOffset, j as formatTimezoneLabel } from "../date-time-range-picker-Dog33Ry0.mjs";
|
|
2
|
+
import { t as CalendarDatePicker } from "../calendar-date-picker-ynSGADfR.mjs";
|
|
3
|
+
import { _ as getShortTimezoneDisplay, a as TimeRangePicker, b as utcToLocalInputString, c as getPresetByKey, d as TimezoneSelector, f as QuickRangesPanel, g as getDefaultTimezoneOptions, h as formatUtcForDisplay, i as formatTimeRangeDisplay, l as getPresetByShortcut, m as createTimezoneOption, n as formatDateForInput, o as DEFAULT_PRESETS, p as CustomRangePanel, r as formatSingleTimeDisplay, s as getDefaultPreset, t as toApiTimeRange, u as getPresetRange, v as localInputStringToUtc, x as zonedDateToUtcString, y as utcStringToZonedDate } from "../to-api-format-WC7b9Mcv.mjs";
|
|
4
4
|
export { CustomRangePanel as AbsoluteRangePanel, CustomRangePanel, CalendarDatePicker, DEFAULT_PRESETS, QuickRangesPanel, TimeRangePicker, TimezoneSelector, createTimezoneOption, formatDateForInput, formatSingleTimeDisplay, formatTimeRangeDisplay, formatTimezoneLabel, formatUtcForDisplay, getBrowserTimezone, getDefaultPreset, getDefaultTimezoneOptions, getPresetByKey, getPresetByShortcut, getPresetRange, getShortTimezoneDisplay, getTimezoneOffset, localInputStringToUtc, toApiTimeRange, utcStringToZonedDate, utcToLocalInputString, zonedDateToUtcString };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as formatRelativeDate, c as getTimestamp, i as formatCombinedDate, l as getTimezoneAbbreviation, n as DEFAULT_DATE_FORMAT, o as formatTimezoneDate, r as formatAbsoluteDate, s as formatUTCDate, t as DateTime, u as parseDate } from "../date-time-CA-09lnw.mjs";
|
|
2
|
+
export { DEFAULT_DATE_FORMAT, DateTime, formatAbsoluteDate, formatCombinedDate, formatRelativeDate, formatTimezoneDate, formatUTCDate, getTimestamp, getTimezoneAbbreviation, parseDate };
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { t as cn } from "./utils-Bu32wN-x.mjs";
|
|
2
|
+
import { t as Tooltip } from "./tooltip-C_SL1imw.mjs";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { formatInTimeZone } from "date-fns-tz";
|
|
5
|
+
import { format, formatDistanceToNowStrict } from "date-fns";
|
|
6
|
+
import { enUS } from "date-fns/locale/en-US";
|
|
7
|
+
//#region src/components/features/date-time/formatters.ts
|
|
8
|
+
/** e.g. "June 12th at 11:30 AM" — used for absolute / table dates. */
|
|
9
|
+
const DEFAULT_DATE_FORMAT = "MMMM do 'at' h:mm a";
|
|
10
|
+
function getBrowserTimezone() {
|
|
11
|
+
try {
|
|
12
|
+
return new Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
13
|
+
} catch {
|
|
14
|
+
return "UTC";
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function parseDate(date) {
|
|
18
|
+
const parsedDate = date instanceof Date ? date : new Date(date);
|
|
19
|
+
if (!date || Number.isNaN(parsedDate.getTime())) return null;
|
|
20
|
+
return parsedDate;
|
|
21
|
+
}
|
|
22
|
+
function formatAbsoluteDate(date, options) {
|
|
23
|
+
const formatString = options.format || "MMMM do 'at' h:mm a";
|
|
24
|
+
if (options.disableTimezone) return format(date, formatString, { locale: enUS });
|
|
25
|
+
return formatInTimeZone(date, options.timezone, formatString, { locale: enUS });
|
|
26
|
+
}
|
|
27
|
+
function formatRelativeDate(date, options) {
|
|
28
|
+
return formatDistanceToNowStrict(date, { addSuffix: options.addSuffix ?? true });
|
|
29
|
+
}
|
|
30
|
+
function getTimezoneAbbreviation(date, timezone) {
|
|
31
|
+
return formatInTimeZone(date, timezone, "zzz", { locale: enUS });
|
|
32
|
+
}
|
|
33
|
+
function formatCombinedDate(date, options, separator = " ") {
|
|
34
|
+
return `${formatAbsoluteDate(date, options)}${separator}(${formatRelativeDate(date, options)})`;
|
|
35
|
+
}
|
|
36
|
+
function formatUTCDate(date, format = "dd MMM yy HH:mm:ss") {
|
|
37
|
+
return formatInTimeZone(date, "UTC", format, { locale: enUS });
|
|
38
|
+
}
|
|
39
|
+
function formatTimezoneDate(date, timezone, format = "dd MMM yy HH:mm:ss") {
|
|
40
|
+
return formatInTimeZone(date, timezone, format, { locale: enUS });
|
|
41
|
+
}
|
|
42
|
+
/** Microseconds since epoch, matching the Datum DateTime tooltip. */
|
|
43
|
+
function getTimestamp(date) {
|
|
44
|
+
return (date.getTime() * 1e3).toString();
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/components/features/date-time/date-time.tsx
|
|
48
|
+
/**
|
|
49
|
+
* Date display with the shared Datum hover tooltip (UTC, local zone, relative, epoch).
|
|
50
|
+
*/
|
|
51
|
+
function DateTime({ date, variant = "detailed", format, addSuffix, tooltip = "auto", timezone, disableTimezone = false, className, separator = " ", timestamp, children }) {
|
|
52
|
+
if (!date) return null;
|
|
53
|
+
const parsedDate = parseDate(date);
|
|
54
|
+
if (!parsedDate) return null;
|
|
55
|
+
const timeZone = timezone ?? getBrowserTimezone();
|
|
56
|
+
const formatterOptions = {
|
|
57
|
+
timezone: timeZone,
|
|
58
|
+
disableTimezone,
|
|
59
|
+
format,
|
|
60
|
+
addSuffix
|
|
61
|
+
};
|
|
62
|
+
const shouldShowTooltip = tooltip !== false && !disableTimezone;
|
|
63
|
+
const textClass = cn("text-sm", shouldShowTooltip && "cursor-pointer", className);
|
|
64
|
+
const trigger = children ?? /* @__PURE__ */ jsx("time", {
|
|
65
|
+
dateTime: parsedDate.toISOString(),
|
|
66
|
+
className: textClass,
|
|
67
|
+
children: formatTriggerContent(parsedDate, variant, formatterOptions, separator)
|
|
68
|
+
});
|
|
69
|
+
if (!shouldShowTooltip) return trigger;
|
|
70
|
+
const showDetailedTooltip = variant === "detailed" || tooltip === "detailed";
|
|
71
|
+
return /* @__PURE__ */ jsx(Tooltip, {
|
|
72
|
+
message: getTooltipContent(parsedDate, variant, tooltip, formatterOptions, timeZone, timestamp),
|
|
73
|
+
contentClassName: showDetailedTooltip ? "min-w-64 text-left" : void 0,
|
|
74
|
+
children: trigger
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
function formatTriggerContent(date, variant, options, separator) {
|
|
78
|
+
switch (variant) {
|
|
79
|
+
case "relative": return formatRelativeDate(date, options);
|
|
80
|
+
case "both": return formatCombinedDate(date, options, separator);
|
|
81
|
+
default: return formatAbsoluteDate(date, options);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function getTooltipContent(date, variant, tooltip, options, timeZone, timestamp) {
|
|
85
|
+
if (variant === "detailed" || tooltip === "detailed") {
|
|
86
|
+
const rows = [
|
|
87
|
+
{
|
|
88
|
+
label: "UTC",
|
|
89
|
+
value: formatUTCDate(date)
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
label: timeZone.replaceAll("_", " "),
|
|
93
|
+
value: formatTimezoneDate(date, timeZone)
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
label: "Relative",
|
|
97
|
+
value: formatRelativeDate(date, options)
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
label: "Timestamp",
|
|
101
|
+
value: timestamp ?? getTimestamp(date)
|
|
102
|
+
}
|
|
103
|
+
];
|
|
104
|
+
return /* @__PURE__ */ jsx("div", {
|
|
105
|
+
className: "space-y-2 text-xs",
|
|
106
|
+
children: rows.map((row) => /* @__PURE__ */ jsxs("div", {
|
|
107
|
+
className: "flex items-center justify-between gap-2",
|
|
108
|
+
children: [
|
|
109
|
+
/* @__PURE__ */ jsx("span", {
|
|
110
|
+
className: "font-medium",
|
|
111
|
+
children: row.label
|
|
112
|
+
}),
|
|
113
|
+
/* @__PURE__ */ jsx("span", { className: "mx-1 flex-1 border-b border-dotted border-current/50" }),
|
|
114
|
+
/* @__PURE__ */ jsx("span", {
|
|
115
|
+
className: "text-right",
|
|
116
|
+
children: row.value
|
|
117
|
+
})
|
|
118
|
+
]
|
|
119
|
+
}, row.label))
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
if (tooltip === "timezone") return /* @__PURE__ */ jsx("p", { children: `${timeZone.replaceAll("_", " ")} (${getTimezoneAbbreviation(date, timeZone)})` });
|
|
123
|
+
if (tooltip === "alternate") {
|
|
124
|
+
if (variant === "relative") return formatAbsoluteDate(date, options);
|
|
125
|
+
if (variant === "absolute" || variant === "both") return formatRelativeDate(date, options);
|
|
126
|
+
}
|
|
127
|
+
if (tooltip === "auto" || tooltip === true) switch (variant) {
|
|
128
|
+
case "relative": return formatAbsoluteDate(date, options);
|
|
129
|
+
default: return /* @__PURE__ */ jsx("p", { children: `${timeZone.replaceAll("_", " ")} (${getTimezoneAbbreviation(date, timeZone)})` });
|
|
130
|
+
}
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
//#endregion
|
|
134
|
+
export { formatRelativeDate as a, getTimestamp as c, formatCombinedDate as i, getTimezoneAbbreviation as l, DEFAULT_DATE_FORMAT as n, formatTimezoneDate as o, formatAbsoluteDate as r, formatUTCDate as s, DateTime as t, parseDate as u };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as DateTimePicker } from "../date-time-picker-
|
|
1
|
+
import { t as DateTimePicker } from "../date-time-picker-BzcHrf-A.mjs";
|
|
2
2
|
export { DateTimePicker };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as DateTimePicker$1 } from "./picker-b5-x-EHs.mjs";
|
|
2
1
|
import { t as useDeprecationWarning } from "./use-deprecation-warning-DXrGc0jX.mjs";
|
|
2
|
+
import { r as DateTimePicker$1 } from "./picker-raVuDxsh.mjs";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
//#region src/components/features/date-time-picker/date-time-picker.tsx
|
|
5
5
|
/**
|