@erxes/ui 4.0.0-v2.2 → 4.0.0-v2.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/components/charts.js +3 -1
- package/dist/components/combobox.d.ts +1 -1
- package/dist/components/combobox.js +4 -1
- package/dist/components/date-picker-value.d.ts +5 -9
- package/dist/components/date-picker-value.js +15 -34
- package/dist/components/date-picker.d.ts +0 -4
- package/dist/components/date-picker.js +5 -7
- package/dist/components/date-text-input.d.ts +2 -4
- package/dist/components/date-text-input.js +11 -9
- package/dist/components/dialog.js +1 -1
- package/dist/components/empty.d.ts +5 -1
- package/dist/components/empty.js +24 -2
- package/dist/components/select.d.ts +1 -1
- package/dist/components/select.js +3 -1
- package/dist/components/sheet.js +1 -1
- package/dist/components/sidebar/panel.js +1 -1
- package/dist/index.d.ts +4 -5
- package/dist/index.js +4 -4
- package/dist/lib/format.d.ts +52 -0
- package/dist/lib/format.js +75 -0
- package/dist/lib/stored.d.ts +13 -0
- package/dist/lib/stored.js +41 -0
- package/dist/modules/attachments/use-carousel.js +5 -10
- package/dist/modules/display/components/RelativeDateDisplay.d.ts +4 -5
- package/dist/modules/display/components/RelativeDateDisplay.js +7 -8
- package/dist/modules/filter/components/FilterBar.js +5 -7
- package/dist/modules/filter/components/FilterDialog.js +4 -5
- package/dist/modules/filter/components/FilterPopover.js +1 -1
- package/dist/modules/filter/components/FilterProvider.d.ts +1 -2
- package/dist/modules/filter/components/FilterProvider.js +1 -2
- package/dist/modules/filter/types/filter.d.ts +0 -1
- package/dist/modules/layout/components/AppLayout.d.ts +2 -2
- package/dist/modules/layout/components/AppLayout.js +8 -9
- package/dist/modules/layout/components/AppLayoutResizeHandle.d.ts +5 -12
- package/dist/modules/layout/components/AppLayoutResizeHandle.js +15 -18
- package/dist/modules/navigation-menu/components/NavigationMenu.d.ts +3 -3
- package/dist/modules/navigation-menu/components/NavigationMenu.js +6 -7
- package/dist/modules/record-field/components/NumberField.js +4 -2
- package/dist/modules/record-field/components/TextField.js +9 -2
- package/dist/modules/record-table/components/RecordTableCell.d.ts +9 -0
- package/dist/modules/record-table/components/RecordTableCell.js +16 -2
- package/dist/modules/record-table/components/RecordTableCellInline.js +3 -7
- package/dist/modules/record-table/components/RecordTableCursor.js +15 -20
- package/dist/modules/record-table/hooks/useTablePreferences.d.ts +1 -1
- package/dist/modules/record-table/hooks/useTablePreferences.js +18 -31
- package/dist/modules/record-table/states/RecordTableCursorState.d.ts +21 -1
- package/dist/modules/record-table/states/RecordTableCursorState.js +21 -3
- package/dist/state/sidebarPanelState.js +7 -2
- package/dist/state/themeState.d.ts +8 -2
- package/dist/state/themeState.js +13 -4
- package/package.json +2 -1
- package/dist/constants/IntlLanguages.d.ts +0 -74
- package/dist/constants/IntlLanguages.js +0 -76
- package/dist/hooks/use-query-state.d.ts +0 -16
- package/dist/hooks/use-query-state.js +0 -122
- package/dist/modules/filter/hooks/useFilterQueryState.d.ts +0 -4
- package/dist/modules/filter/hooks/useFilterQueryState.js +0 -14
- package/dist/types/Theme.d.ts +0 -1
- package/dist/types/Theme.js +0 -0
- package/dist/utils/localization/formatDateISOStringToRelativeDate.d.ts +0 -2
- package/dist/utils/localization/formatDateISOStringToRelativeDate.js +0 -16
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useFormat } from "../lib/format.js";
|
|
1
2
|
import { cn } from "../lib/utils.js";
|
|
2
3
|
import { ChartContext, configFor, fillOf, keyOf, useChart } from "./chart-config.js";
|
|
3
4
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -48,6 +49,7 @@ const TooltipIndicator = ({ indicator, color, nested }) => /* @__PURE__ */ jsx("
|
|
|
48
49
|
});
|
|
49
50
|
const TooltipRow = ({ item, index, payload, props, label }) => {
|
|
50
51
|
const { config } = useChart();
|
|
52
|
+
const fmt = useFormat();
|
|
51
53
|
const { indicator = "dot", formatter } = props;
|
|
52
54
|
const nested = label !== null;
|
|
53
55
|
const itemConfig = configFor(config, item, keyOf(props.nameKey, item.name, item.dataKey));
|
|
@@ -66,7 +68,7 @@ const TooltipRow = ({ item, index, payload, props, label }) => {
|
|
|
66
68
|
})]
|
|
67
69
|
}), item.value !== void 0 && /* @__PURE__ */ jsx("span", {
|
|
68
70
|
className: "font-mono font-medium tabular-nums text-foreground",
|
|
69
|
-
children: item.value.
|
|
71
|
+
children: typeof item.value === "number" ? fmt.number(item.value) : String(item.value)
|
|
70
72
|
})]
|
|
71
73
|
})] });
|
|
72
74
|
};
|
|
@@ -7,7 +7,7 @@ type ComboboxTriggerProps = Omit<React.ComponentProps<typeof Button>, 'variant'>
|
|
|
7
7
|
variant?: React.ComponentProps<typeof Button>['variant'] | 'bordered';
|
|
8
8
|
hideChevron?: boolean;
|
|
9
9
|
};
|
|
10
|
-
declare const ComboboxTriggerBase: ({ ref, className, children, hideChevron, variant, ...props }: ComboboxTriggerProps) => React.JSX.Element;
|
|
10
|
+
declare const ComboboxTriggerBase: ({ ref, className, children, hideChevron, variant, id, ...props }: ComboboxTriggerProps) => React.JSX.Element;
|
|
11
11
|
declare const ComboboxTrigger: ({ ref, children, hideChevron, ...props }: ComboboxTriggerProps) => React.JSX.Element;
|
|
12
12
|
declare const ComboboxValue: ({ ref, value, className, placeholder, loading, ...props }: React.HTMLAttributes<HTMLSpanElement> & {
|
|
13
13
|
placeholder?: string;
|
|
@@ -4,14 +4,17 @@ import { Popover } from "./popover.js";
|
|
|
4
4
|
import { Command } from "./command.js";
|
|
5
5
|
import { Skeleton } from "./skeleton.js";
|
|
6
6
|
import { Spinner } from "./spinner.js";
|
|
7
|
+
import { useCellLabel } from "../modules/record-table/components/RecordTableCell.js";
|
|
7
8
|
import { IconCheck, IconChevronDown, IconX } from "@tabler/icons-react";
|
|
8
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
10
|
import "react";
|
|
10
11
|
import { useOnInView } from "react-intersection-observer";
|
|
11
12
|
// src/components/combobox.tsx
|
|
12
|
-
const ComboboxTriggerBase = ({ ref, className, children, hideChevron = false, variant = "outline", ...props }) => {
|
|
13
|
+
const ComboboxTriggerBase = ({ ref, className, children, hideChevron = false, variant = "outline", id, ...props }) => {
|
|
14
|
+
const label = useCellLabel(id);
|
|
13
15
|
return /* @__PURE__ */ jsx(Popover.Trigger, {
|
|
14
16
|
render: /* @__PURE__ */ jsx(Button, {
|
|
17
|
+
...label,
|
|
15
18
|
ref,
|
|
16
19
|
variant: variant === "bordered" ? "outline" : variant,
|
|
17
20
|
...props,
|
|
@@ -6,27 +6,23 @@ export type DatePickerValue = DateInput | DateInput[] | DateRange | {
|
|
|
6
6
|
} | null | undefined;
|
|
7
7
|
export type DatePickerMode = 'single' | 'multiple' | 'range';
|
|
8
8
|
export type NormalizedValue = Date | Date[] | DateRange | undefined;
|
|
9
|
-
/** Formats are written with Day.js tokens (`YYYY-MM-DD`, `MMM D, YYYY`), the picker's public API. */
|
|
10
|
-
export declare const DEFAULT_FORMAT = "YYYY-MM-DD";
|
|
11
|
-
export declare const DEFAULT_DISPLAY_FORMAT = "MMM D, YYYY";
|
|
12
|
-
export declare const formatWith: (date: Date, dayjsFormat: string) => string;
|
|
13
9
|
/** ISO strings without an offset are local time, like the Day.js parser this replaced. */
|
|
14
10
|
export declare const toDate: (value: unknown) => Date | undefined;
|
|
15
11
|
export declare const normalizeValue: (value: DatePickerValue, mode: DatePickerMode) => NormalizedValue;
|
|
16
12
|
export declare const getAnchorDate: (value: NormalizedValue) => Date | undefined;
|
|
17
|
-
/** Masks typed text as `
|
|
18
|
-
export declare const maskInputText: (
|
|
13
|
+
/** Masks typed text as `yyyy-MM-dd`, clamping the month and day. */
|
|
14
|
+
export declare const maskInputText: (value: string) => string;
|
|
19
15
|
export declare const getDateBounds: (withPresent: boolean, minDate?: Date, maxDate?: Date) => {
|
|
20
16
|
minBound: Date | undefined;
|
|
21
17
|
maxBound: Date | undefined;
|
|
22
18
|
};
|
|
23
19
|
export declare const getCalendarDisabled: (disabled: Matcher | Matcher[] | undefined, minBound?: Date, maxBound?: Date) => Matcher[];
|
|
24
|
-
/** Parses typed text strictly;
|
|
25
|
-
export declare const parseInputDate: (text: string,
|
|
20
|
+
/** Parses typed text strictly; `loose` also accepts unpadded months and days. */
|
|
21
|
+
export declare const parseInputDate: (text: string, { minBound, maxBound, loose }: {
|
|
26
22
|
minBound?: Date;
|
|
27
23
|
maxBound?: Date;
|
|
28
24
|
loose?: boolean;
|
|
29
25
|
}) => Date | undefined;
|
|
30
26
|
export declare const isDateRange: (value: NormalizedValue) => value is DateRange;
|
|
31
|
-
export declare const describeValue: (value: NormalizedValue,
|
|
27
|
+
export declare const describeValue: (value: NormalizedValue, formatDay: (date: Date) => string, formatMultiple: (count: number) => string) => string | undefined;
|
|
32
28
|
export {};
|
|
@@ -1,30 +1,12 @@
|
|
|
1
1
|
import { endOfDay, format, getDaysInMonth, isAfter, isBefore, isValid, parse, parseISO, startOfDay } from "date-fns";
|
|
2
2
|
// src/components/date-picker-value.ts
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
"YYYY-MM-D",
|
|
10
|
-
"YYYY-M-DD"
|
|
3
|
+
const INPUT_PATTERN = "yyyy-MM-dd";
|
|
4
|
+
const LOOSE_INPUT_PATTERNS = [
|
|
5
|
+
INPUT_PATTERN,
|
|
6
|
+
"yyyy-M-d",
|
|
7
|
+
"yyyy-MM-d",
|
|
8
|
+
"yyyy-M-dd"
|
|
11
9
|
];
|
|
12
|
-
const DAYJS_TOKEN = /\[([^\]]*)]|YYYY|YY|DD|D|dddd|ddd|A|a|ZZ|Z/g;
|
|
13
|
-
const DATE_FNS_TOKEN = {
|
|
14
|
-
YYYY: "yyyy",
|
|
15
|
-
YY: "yy",
|
|
16
|
-
DD: "dd",
|
|
17
|
-
D: "d",
|
|
18
|
-
dddd: "EEEE",
|
|
19
|
-
ddd: "EEE",
|
|
20
|
-
A: "a",
|
|
21
|
-
a: "aaa",
|
|
22
|
-
ZZ: "xx",
|
|
23
|
-
Z: "xxx"
|
|
24
|
-
};
|
|
25
|
-
/** Turns a Day.js format string into the date-fns pattern with the same output. */
|
|
26
|
-
const toDateFnsPattern = (dayjsFormat) => dayjsFormat.replace(DAYJS_TOKEN, (token, escaped) => escaped === void 0 ? DATE_FNS_TOKEN[token] ?? token : `'${escaped.replaceAll("'", "''")}'`);
|
|
27
|
-
const formatWith = (date, dayjsFormat) => format(date, toDateFnsPattern(dayjsFormat));
|
|
28
10
|
const isDateInput = (value) => value instanceof Date || typeof value === "string" || typeof value === "number";
|
|
29
11
|
/** ISO strings without an offset are local time, like the Day.js parser this replaced. */
|
|
30
12
|
const toDate = (value) => {
|
|
@@ -80,7 +62,8 @@ const daysInMonth = (year, month) => {
|
|
|
80
62
|
if (year?.length !== 4 || !(monthNumber >= 1 && monthNumber <= 12)) return void 0;
|
|
81
63
|
return getDaysInMonth(new Date(Number(year), monthNumber - 1, 1));
|
|
82
64
|
};
|
|
83
|
-
|
|
65
|
+
/** Masks typed text as `yyyy-MM-dd`, clamping the month and day. */
|
|
66
|
+
const maskInputText = (value) => {
|
|
84
67
|
const [year, month, day] = splitDateSegments(value);
|
|
85
68
|
const normalizedMonth = month?.length === 2 ? String(Math.min(Number(month), 12)).padStart(2, "0") : month;
|
|
86
69
|
const maxDay = daysInMonth(year, normalizedMonth);
|
|
@@ -90,8 +73,6 @@ const formatDateMask = (value) => {
|
|
|
90
73
|
day?.length === 2 && maxDay ? String(Math.min(Number(day), maxDay)).padStart(2, "0") : day
|
|
91
74
|
].filter((segment) => segment !== void 0).join("-");
|
|
92
75
|
};
|
|
93
|
-
/** Masks typed text as `YYYY-MM-DD` when the picker uses the default format. */
|
|
94
|
-
const maskInputText = (rawValue, format) => format === "YYYY-MM-DD" ? formatDateMask(rawValue) : rawValue;
|
|
95
76
|
const getDateBounds = (withPresent, minDate, maxDate) => ({
|
|
96
77
|
minBound: minDate ?? (withPresent ? /* @__PURE__ */ new Date("1900-01-01") : void 0),
|
|
97
78
|
maxBound: maxDate ?? (withPresent ? /* @__PURE__ */ new Date() : void 0)
|
|
@@ -102,19 +83,19 @@ const getCalendarDisabled = (disabled, minBound, maxBound) => [
|
|
|
102
83
|
...maxBound ? [{ after: maxBound }] : []
|
|
103
84
|
];
|
|
104
85
|
const isWithinBounds = (date, minBound, maxBound) => !(minBound && isBefore(date, startOfDay(minBound))) && !(maxBound && isAfter(date, endOfDay(maxBound)));
|
|
105
|
-
/** Parses typed text strictly;
|
|
106
|
-
const parseInputDate = (text,
|
|
107
|
-
const parsed = (loose
|
|
86
|
+
/** Parses typed text strictly; `loose` also accepts unpadded months and days. */
|
|
87
|
+
const parseInputDate = (text, { minBound, maxBound, loose }) => {
|
|
88
|
+
const parsed = (loose ? LOOSE_INPUT_PATTERNS : [INPUT_PATTERN]).map((pattern) => ({
|
|
108
89
|
pattern,
|
|
109
90
|
date: parse(text, pattern, /* @__PURE__ */ new Date())
|
|
110
91
|
})).find(({ pattern, date }) => isValid(date) && format(date, pattern) === text)?.date;
|
|
111
92
|
return parsed && isWithinBounds(parsed, minBound, maxBound) ? parsed : void 0;
|
|
112
93
|
};
|
|
113
94
|
const isDateRange = (value) => value !== void 0 && !(value instanceof Date) && !Array.isArray(value);
|
|
114
|
-
const describeValue = (value,
|
|
95
|
+
const describeValue = (value, formatDay, formatMultiple) => {
|
|
115
96
|
if (Array.isArray(value)) return value.length ? formatMultiple(value.length) : void 0;
|
|
116
97
|
if (!isDateRange(value) || !value.from) return void 0;
|
|
117
|
-
const from =
|
|
118
|
-
return value.to ?
|
|
98
|
+
const from = formatDay(value.from);
|
|
99
|
+
return value.to ? [from, formatDay(value.to)].join(" - ") : from;
|
|
119
100
|
};
|
|
120
|
-
export {
|
|
101
|
+
export { describeValue, getAnchorDate, getCalendarDisabled, getDateBounds, isDateRange, maskInputText, normalizeValue, parseInputDate, toDate };
|
|
@@ -11,10 +11,6 @@ export type DatePickerProps = {
|
|
|
11
11
|
minDate?: Date;
|
|
12
12
|
maxDate?: Date;
|
|
13
13
|
mode?: DatePickerMode;
|
|
14
|
-
/** Day.js tokens, e.g. `YYYY-MM-DD`. */
|
|
15
|
-
format?: string;
|
|
16
|
-
/** Day.js tokens, e.g. `DD.MM.YYYY`. */
|
|
17
|
-
displayFormat?: string;
|
|
18
14
|
formatMultiple?: (count: number) => string;
|
|
19
15
|
variant?: 'outline' | 'default' | 'ghost';
|
|
20
16
|
allowNull?: boolean;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Calendar } from "./calendar.js";
|
|
2
2
|
import { Button } from "./button.js";
|
|
3
3
|
import { Popover } from "./popover.js";
|
|
4
|
+
import { useFormat } from "../lib/format.js";
|
|
4
5
|
import { cn } from "../lib/utils.js";
|
|
5
|
-
import {
|
|
6
|
+
import { describeValue, getAnchorDate, getCalendarDisabled, getDateBounds, isDateRange, normalizeValue, toDate } from "./date-picker-value.js";
|
|
6
7
|
import { DateTextInput } from "./date-text-input.js";
|
|
7
8
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
9
|
import { useRef, useState } from "react";
|
|
@@ -88,7 +89,7 @@ const useDatePicker = ({ value, onChange, mode, withPresent, minDate, maxDate, d
|
|
|
88
89
|
};
|
|
89
90
|
};
|
|
90
91
|
/** The props with their defaults; what is left goes to the calendar. */
|
|
91
|
-
const resolveProps = ({ value, onChange, placeholder = "Pick a date", withPresent = false, minDate, maxDate, disabled, className, mode = "single",
|
|
92
|
+
const resolveProps = ({ value, onChange, placeholder = "Pick a date", withPresent = false, minDate, maxDate, disabled, className, mode = "single", formatMultiple = defaultFormatMultiple, variant = "outline", allowNull, clearable = allowNull ?? true, clearLabel = "Clear", calendarClassName, popoverContentProps, inline = false, defaultMonth, ...calendarProps }) => ({
|
|
92
93
|
value,
|
|
93
94
|
onChange,
|
|
94
95
|
placeholder,
|
|
@@ -98,8 +99,6 @@ const resolveProps = ({ value, onChange, placeholder = "Pick a date", withPresen
|
|
|
98
99
|
disabled,
|
|
99
100
|
className,
|
|
100
101
|
mode,
|
|
101
|
-
format,
|
|
102
|
-
displayFormat,
|
|
103
102
|
formatMultiple,
|
|
104
103
|
variant,
|
|
105
104
|
clearable,
|
|
@@ -113,12 +112,11 @@ const resolveProps = ({ value, onChange, placeholder = "Pick a date", withPresen
|
|
|
113
112
|
const DatePicker = (props) => {
|
|
114
113
|
const { calendarProps, ...o } = resolveProps(props);
|
|
115
114
|
const picker = useDatePicker(o);
|
|
115
|
+
const fmt = useFormat();
|
|
116
116
|
const { normalizedValue, isDisabled, hasValue, setIsOpen } = picker;
|
|
117
117
|
const singleInput = /* @__PURE__ */ jsx(DateTextInput, {
|
|
118
118
|
singleDate: normalizedValue instanceof Date ? normalizedValue : void 0,
|
|
119
119
|
onChange: o.onChange,
|
|
120
|
-
format: o.format,
|
|
121
|
-
displayFormat: o.displayFormat,
|
|
122
120
|
bounds: picker.bounds,
|
|
123
121
|
calendarDisabled: picker.calendarDisabled,
|
|
124
122
|
clearable: o.clearable,
|
|
@@ -158,7 +156,7 @@ const DatePicker = (props) => {
|
|
|
158
156
|
render: /* @__PURE__ */ jsx(Button, { variant: o.variant }),
|
|
159
157
|
disabled: isDisabled,
|
|
160
158
|
className: cn("w-full justify-start text-left font-normal", o.className),
|
|
161
|
-
children: describeValue(normalizedValue,
|
|
159
|
+
children: describeValue(normalizedValue, fmt.date, o.formatMultiple) ?? o.placeholder
|
|
162
160
|
}),
|
|
163
161
|
contentProps: o.popoverContentProps,
|
|
164
162
|
children: calendar
|
|
@@ -3,7 +3,6 @@ import { Matcher } from "react-day-picker";
|
|
|
3
3
|
type DateDraftOptions = {
|
|
4
4
|
singleDate?: Date;
|
|
5
5
|
onChange: (date: Date | null) => void;
|
|
6
|
-
format: string;
|
|
7
6
|
bounds: {
|
|
8
7
|
minBound?: Date;
|
|
9
8
|
maxBound?: Date;
|
|
@@ -13,7 +12,6 @@ type DateDraftOptions = {
|
|
|
13
12
|
onOpen?: () => void;
|
|
14
13
|
};
|
|
15
14
|
type DateTextInputProps = DateDraftOptions & {
|
|
16
|
-
displayFormat: string;
|
|
17
15
|
clearLabel: string;
|
|
18
16
|
isDisabled: boolean;
|
|
19
17
|
placeholder: string;
|
|
@@ -21,6 +19,6 @@ type DateTextInputProps = DateDraftOptions & {
|
|
|
21
19
|
inputRef: RefObject<HTMLInputElement | null>;
|
|
22
20
|
onClear: () => void;
|
|
23
21
|
};
|
|
24
|
-
/** Typed date entry for single mode: the
|
|
25
|
-
export declare const DateTextInput: ({
|
|
22
|
+
/** Typed date entry for single mode: the date in the UI's language at rest, `yyyy-MM-dd` while typing. */
|
|
23
|
+
export declare const DateTextInput: ({ clearLabel, isDisabled, placeholder, className, inputRef, onClear, ...options }: DateTextInputProps) => import("react").JSX.Element;
|
|
26
24
|
export {};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { cn } from "../lib/utils.js";
|
|
2
|
-
import {
|
|
2
|
+
import { toIsoDay, useFormat } from "../lib/format.js";
|
|
3
|
+
import { maskInputText, parseInputDate } from "./date-picker-value.js";
|
|
3
4
|
import { IconCalendar, IconX } from "@tabler/icons-react";
|
|
4
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
6
|
import { useState } from "react";
|
|
6
7
|
import { dateMatchModifiers } from "react-day-picker";
|
|
7
8
|
// src/components/date-text-input.tsx
|
|
8
9
|
/** The text being typed (null while not editing, so the text follows the value) and its handlers. */
|
|
9
|
-
const useDateDraft = ({ singleDate, onChange,
|
|
10
|
+
const useDateDraft = ({ singleDate, onChange, bounds, calendarDisabled, clearable, onOpen }) => {
|
|
10
11
|
const [draft, setDraft] = useState(null);
|
|
11
12
|
const singleTime = singleDate?.getTime();
|
|
12
13
|
const parseDraft = (text, loose) => {
|
|
13
|
-
const date = text ? parseInputDate(text,
|
|
14
|
+
const date = text ? parseInputDate(text, {
|
|
14
15
|
...bounds,
|
|
15
16
|
loose
|
|
16
17
|
}) : void 0;
|
|
@@ -20,7 +21,7 @@ const useDateDraft = ({ singleDate, onChange, format, bounds, calendarDisabled,
|
|
|
20
21
|
if (date && date.getTime() !== singleTime) onChange(date);
|
|
21
22
|
};
|
|
22
23
|
const handleChange = (text) => {
|
|
23
|
-
const masked = maskInputText(text
|
|
24
|
+
const masked = maskInputText(text);
|
|
24
25
|
setDraft(masked);
|
|
25
26
|
if (masked) {
|
|
26
27
|
const parsed = parseDraft(masked, false);
|
|
@@ -34,7 +35,7 @@ const useDateDraft = ({ singleDate, onChange, format, bounds, calendarDisabled,
|
|
|
34
35
|
e.stopPropagation();
|
|
35
36
|
const typed = e.key === "Enter" ? parseDraft(draft, true) : void 0;
|
|
36
37
|
if (typed && typed.getTime() !== singleTime) {
|
|
37
|
-
setDraft(
|
|
38
|
+
setDraft(toIsoDay(typed));
|
|
38
39
|
onChange(typed);
|
|
39
40
|
} else if (opensPopover) onOpen?.();
|
|
40
41
|
};
|
|
@@ -43,18 +44,19 @@ const useDateDraft = ({ singleDate, onChange, format, bounds, calendarDisabled,
|
|
|
43
44
|
setDraft,
|
|
44
45
|
handleChange,
|
|
45
46
|
handleKeyDown,
|
|
46
|
-
handleFocus: () => setDraft((current) => current ?? (singleDate ?
|
|
47
|
+
handleFocus: () => setDraft((current) => current ?? (singleDate ? toIsoDay(singleDate) : "")),
|
|
47
48
|
handleBlur: () => {
|
|
48
49
|
changeTo(parseDraft(draft, true));
|
|
49
50
|
setDraft(null);
|
|
50
51
|
}
|
|
51
52
|
};
|
|
52
53
|
};
|
|
53
|
-
/** Typed date entry for single mode: the
|
|
54
|
-
const DateTextInput = ({
|
|
54
|
+
/** Typed date entry for single mode: the date in the UI's language at rest, `yyyy-MM-dd` while typing. */
|
|
55
|
+
const DateTextInput = ({ clearLabel, isDisabled, placeholder, className, inputRef, onClear, ...options }) => {
|
|
55
56
|
const { draft, setDraft, handleChange, handleKeyDown, handleFocus, handleBlur } = useDateDraft(options);
|
|
57
|
+
const fmt = useFormat();
|
|
56
58
|
const { singleDate } = options;
|
|
57
|
-
const inputText = draft ?? (singleDate ?
|
|
59
|
+
const inputText = draft ?? (singleDate ? fmt.date(singleDate) : "");
|
|
58
60
|
return /* @__PURE__ */ jsxs("div", {
|
|
59
61
|
"aria-disabled": isDisabled,
|
|
60
62
|
className: cn("flex h-7 w-full items-center gap-1 rounded-sm bg-background px-3 text-sm text-foreground shadow-xs transition focus-within:shadow-focus", isDisabled && "cursor-not-allowed opacity-50", className),
|
|
@@ -4,8 +4,8 @@ import { IconX } from "@tabler/icons-react";
|
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import "react";
|
|
6
6
|
import { cva } from "class-variance-authority";
|
|
7
|
-
import { Dialog as Dialog$1 } from "@base-ui/react/dialog";
|
|
8
7
|
import { useTranslation } from "react-i18next";
|
|
8
|
+
import { Dialog as Dialog$1 } from "@base-ui/react/dialog";
|
|
9
9
|
// src/components/dialog.tsx
|
|
10
10
|
/** Dims the page under a dialog. Content renders one; a hand-built popup in `Dialog.Portal` uses this. */
|
|
11
11
|
const DialogBackdrop = ({ className, ...props }) => /* @__PURE__ */ jsx(Dialog$1.Backdrop, {
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { VariantProps } from "class-variance-authority";
|
|
2
|
-
declare
|
|
2
|
+
declare const emptyVariants: (props?: ({
|
|
3
|
+
variant?: "default" | "outline" | null | undefined;
|
|
4
|
+
size?: "default" | "sm" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
+
declare function EmptyRoot({ className, variant, size, ...props }: React.ComponentProps<'div'> & VariantProps<typeof emptyVariants>): import("react").JSX.Element;
|
|
3
7
|
declare function EmptyHeader({ className, ...props }: React.ComponentProps<'div'>): import("react").JSX.Element;
|
|
4
8
|
declare const emptyMediaVariants: (props?: ({
|
|
5
9
|
variant?: "default" | "icon" | null | undefined;
|
package/dist/components/empty.js
CHANGED
|
@@ -2,10 +2,32 @@ import { cn } from "../lib/utils.js";
|
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { cva } from "class-variance-authority";
|
|
4
4
|
// src/components/empty.tsx
|
|
5
|
-
|
|
5
|
+
const emptyVariants = cva("flex min-w-0 flex-1 flex-col items-center justify-center gap-6 rounded-lg border-dashed text-center text-balance", {
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
default: "",
|
|
9
|
+
/** A dashed outline on the page background, standing in for missing content. */
|
|
10
|
+
outline: "border bg-background"
|
|
11
|
+
},
|
|
12
|
+
size: {
|
|
13
|
+
default: "px-6 py-12 md:px-12",
|
|
14
|
+
/** Inside a card or a widget, where a page's spacing would crowd it. */
|
|
15
|
+
sm: "p-6"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
variant: "default",
|
|
20
|
+
size: "default"
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
function EmptyRoot({ className, variant, size, ...props }) {
|
|
6
24
|
return /* @__PURE__ */ jsx("div", {
|
|
7
25
|
"data-slot": "empty",
|
|
8
|
-
className: cn(
|
|
26
|
+
className: cn(emptyVariants({
|
|
27
|
+
variant,
|
|
28
|
+
size,
|
|
29
|
+
className
|
|
30
|
+
})),
|
|
9
31
|
...props
|
|
10
32
|
});
|
|
11
33
|
}
|
|
@@ -11,7 +11,7 @@ declare const SelectGroup: (props: Select$1.Group.Props) => string | number | bi
|
|
|
11
11
|
declare const selectTriggerVariants: (props?: ({
|
|
12
12
|
variant?: "bordered" | "default" | "flush" | null | undefined;
|
|
13
13
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
14
|
-
declare const SelectTrigger: ({ className, children, variant, ...props }: Select$1.Trigger.Props & VariantProps<typeof selectTriggerVariants>) => React.JSX.Element;
|
|
14
|
+
declare const SelectTrigger: ({ className, children, variant, id, ...props }: Select$1.Trigger.Props & VariantProps<typeof selectTriggerVariants>) => React.JSX.Element;
|
|
15
15
|
declare const SelectContent: ({ className, children, side, align, ...props }: Select$1.Popup.Props & Pick<Select$1.Positioner.Props, 'side' | 'align'>) => React.JSX.Element;
|
|
16
16
|
declare const SelectLabel: ({ className, ...props }: Select$1.GroupLabel.Props) => React.JSX.Element | null;
|
|
17
17
|
declare const SelectItem: ({ className, children, value, ...props }: Omit<Select$1.Item.Props, 'value'> & {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { useCellLabel } from "../modules/record-table/components/RecordTableCell.js";
|
|
2
3
|
import { IconCheck, IconChevronDown, IconChevronUp } from "@tabler/icons-react";
|
|
3
4
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
5
|
import { createContext, use, useCallback, useLayoutEffect, useState } from "react";
|
|
@@ -38,7 +39,8 @@ const selectTriggerVariants = cva("flex h-7 w-full items-center font-medium just
|
|
|
38
39
|
} },
|
|
39
40
|
defaultVariants: { variant: "default" }
|
|
40
41
|
});
|
|
41
|
-
const SelectTrigger = ({ className, children, variant, ...props }) => /* @__PURE__ */ jsxs(Select$1.Trigger, {
|
|
42
|
+
const SelectTrigger = ({ className, children, variant, id, ...props }) => /* @__PURE__ */ jsxs(Select$1.Trigger, {
|
|
43
|
+
...useCellLabel(id),
|
|
42
44
|
className: cn(selectTriggerVariants({ variant }), className),
|
|
43
45
|
...props,
|
|
44
46
|
children: [children, /* @__PURE__ */ jsx(IconChevronDown, {
|
package/dist/components/sheet.js
CHANGED
|
@@ -4,8 +4,8 @@ import { IconX } from "@tabler/icons-react";
|
|
|
4
4
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import React from "react";
|
|
6
6
|
import { cva } from "class-variance-authority";
|
|
7
|
-
import { Dialog } from "@base-ui/react/dialog";
|
|
8
7
|
import { useTranslation } from "react-i18next";
|
|
8
|
+
import { Dialog } from "@base-ui/react/dialog";
|
|
9
9
|
// src/components/sheet.tsx
|
|
10
10
|
const SheetHeaderActionsContext = React.createContext(null);
|
|
11
11
|
const SheetRoot = ({ headerActions = null, ...props }) => /* @__PURE__ */ jsx(SheetHeaderActionsContext, {
|
|
@@ -6,8 +6,8 @@ import { sidebarPanelOpenState, sidebarPanelOpenedAtState } from "../../state/si
|
|
|
6
6
|
import { IconLayoutSidebarLeftCollapse, IconLayoutSidebarLeftExpand } from "@tabler/icons-react";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import React from "react";
|
|
9
|
-
import { useTranslation } from "react-i18next";
|
|
10
9
|
import { useAtom } from "jotai";
|
|
10
|
+
import { useTranslation } from "react-i18next";
|
|
11
11
|
import { createPortal } from "react-dom";
|
|
12
12
|
import { useLocation } from "react-router-dom";
|
|
13
13
|
// src/components/sidebar/panel.tsx
|
package/dist/index.d.ts
CHANGED
|
@@ -55,10 +55,11 @@ import { Toggle } from "./components/toggle.js";
|
|
|
55
55
|
import { Tooltip } from "./components/tooltip.js";
|
|
56
56
|
import { Upload } from "./components/upload.js";
|
|
57
57
|
import { useConfirm } from "./hooks/use-confirm.js";
|
|
58
|
-
import { useMultiQueryState, useQueryState } from "./hooks/use-query-state.js";
|
|
59
58
|
import { toast, useToast } from "./hooks/use-toast.js";
|
|
60
59
|
import { useUpload } from "./hooks/use-upload.js";
|
|
61
60
|
import { cn } from "./lib/utils.js";
|
|
61
|
+
import { LANGUAGES, formatter, localTimeZone, toIsoDay, useFormat, zoneOffset } from "./lib/format.js";
|
|
62
|
+
import { stored, storedFamily } from "./lib/stored.js";
|
|
62
63
|
import { Editor } from "./modules/blocks/components/LazyEditor.js";
|
|
63
64
|
import { editorText } from "./modules/blocks/utils/parseBlocks.js";
|
|
64
65
|
import { EmailDisplay } from "./modules/display/components/EmailDisplay.js";
|
|
@@ -67,7 +68,6 @@ import { RelativeDateDisplay } from "./modules/display/components/RelativeDateDi
|
|
|
67
68
|
import { SexDisplay } from "./modules/display/components/SexDisplay.js";
|
|
68
69
|
import { Filter } from "./modules/filter/components/Filter.js";
|
|
69
70
|
import { useFilterContext } from "./modules/filter/hooks/useFilterContext.js";
|
|
70
|
-
import { useFilterQueryState } from "./modules/filter/hooks/useFilterQueryState.js";
|
|
71
71
|
import { PopoverScoped } from "./modules/hotkey/components/PopoverScoped.js";
|
|
72
72
|
import { usePreviousHotkeyScope } from "./modules/hotkey/hooks/usePreviousHotkeyScope.js";
|
|
73
73
|
import { useScopedHotkeys } from "./modules/hotkey/hooks/useScopedHotkeys.js";
|
|
@@ -92,9 +92,8 @@ import { RecordTable } from "./modules/record-table/components/RecordTable.js";
|
|
|
92
92
|
import { RecordTableColumnDef } from "./modules/record-table/components/RecordTableProvider.js";
|
|
93
93
|
import { RecordTableInlineCell } from "./modules/record-table/components/RecordTableCellInline.js";
|
|
94
94
|
import { EnumCursorDirection } from "./modules/record-table/types/RecordTableCursorTypes.js";
|
|
95
|
-
import { themeState } from "./state/themeState.js";
|
|
95
|
+
import { ThemeOption, themeState } from "./state/themeState.js";
|
|
96
96
|
import { SexCode } from "./types/SexCode.js";
|
|
97
|
-
import { ThemeOption } from "./types/Theme.js";
|
|
98
97
|
import { IUIConfig, TActivityRowProps, TDashboardWidgetPreview, TPropertyInputMeta, TPropertyInputProps } from "./types/UIConfig.js";
|
|
99
98
|
import { isUndefinedOrNull } from "./utils/IsUndefinedOrNull.js";
|
|
100
99
|
import { readImage } from "./utils/core.js";
|
|
@@ -105,4 +104,4 @@ import { jsonOf } from "./utils/json.js";
|
|
|
105
104
|
import { PluginLiveMessage, PluginRuntime, PluginSession, getPluginRuntime, pluginFetch, pluginJson, setPluginRuntime, useLiveSignal } from "./utils/plugin-runtime.js";
|
|
106
105
|
import { addPluginStyles } from "./utils/plugin-styles.js";
|
|
107
106
|
import { RecordTimeline, RecordTimelineProps, setRecordTimeline } from "./utils/record-timeline.js";
|
|
108
|
-
export { Accordion, Alert, AlertDialog, AppLayout, AppLayoutFooterLink, Avatar, type AvatarProps, BackgroundGradientAnimation, Badge, type BadgeProps, Breadcrumb, Button, type ButtonProps, Calendar, type CalendarProps, Card, type ChartConfig, ChartContainer, ChartLegendContent, ChartTooltipContent, Checkbox, ChoiceboxGroup, Collapsible, ColorPicker, Combobox, Command, CommandBar, ContextMenu, CopyText, DateInput, DatePicker, Dialog, DragHandle, DropdownMenu, Editor, EmailDisplay, EmailListField, Empty, EntityPicker, EnumCursorDirection, type FileStorageAdapter, Filter, Form, FullNameField, FullNameValue, HoverCard, type IUIConfig, IconComponent, IconPicker, IconsProvider, InfoCard, Input, InputGroup, Kbd, Label, type Member, MemberInline, type MemberQueries, type MultiSelectOption, MultipleSelector, NavigationMenuLinkItem, NumberField, PageContainer, PageHeader, PageSubHeader, PhoneDisplay, PhoneField, PhoneInput, type PluginLiveMessage, type PluginRuntime, type PluginSession, Popover, PopoverScoped, RadioGroup, RecordTable, type RecordTableColumnDef, RecordTableInlineCell, RecordTimeline, type RecordTimelineProps, RelativeDateDisplay, Resizable, ScrollArea, Select, SelectMember, Separator, SexCode, SexDisplay, SexField, Sheet, Sidebar, Skeleton, Slider, Spinner, StringArrayInput, Switch, type TActivityRowProps, type TDashboardWidgetPreview, type TPropertyInputMeta, type TPropertyInputProps, TabButton, Table, Tabs, TextField, TextOverflowTooltip, Textarea,
|
|
107
|
+
export { Accordion, Alert, AlertDialog, AppLayout, AppLayoutFooterLink, Avatar, type AvatarProps, BackgroundGradientAnimation, Badge, type BadgeProps, Breadcrumb, Button, type ButtonProps, Calendar, type CalendarProps, Card, type ChartConfig, ChartContainer, ChartLegendContent, ChartTooltipContent, Checkbox, ChoiceboxGroup, Collapsible, ColorPicker, Combobox, Command, CommandBar, ContextMenu, CopyText, DateInput, DatePicker, Dialog, DragHandle, DropdownMenu, Editor, EmailDisplay, EmailListField, Empty, EntityPicker, EnumCursorDirection, type FileStorageAdapter, Filter, Form, FullNameField, FullNameValue, HoverCard, type IUIConfig, IconComponent, IconPicker, IconsProvider, InfoCard, Input, InputGroup, Kbd, LANGUAGES, Label, type Member, MemberInline, type MemberQueries, type MultiSelectOption, MultipleSelector, NavigationMenuLinkItem, NumberField, PageContainer, PageHeader, PageSubHeader, PhoneDisplay, PhoneField, PhoneInput, type PluginLiveMessage, type PluginRuntime, type PluginSession, Popover, PopoverScoped, RadioGroup, RecordTable, type RecordTableColumnDef, RecordTableInlineCell, RecordTimeline, type RecordTimelineProps, RelativeDateDisplay, Resizable, ScrollArea, Select, SelectMember, Separator, SexCode, SexDisplay, SexField, Sheet, Sidebar, Skeleton, Slider, Spinner, StringArrayInput, Switch, type TActivityRowProps, type TDashboardWidgetPreview, type TPropertyInputMeta, type TPropertyInputProps, TabButton, Table, Tabs, TextField, TextOverflowTooltip, Textarea, ThemeOption, TimeField, Toaster, Toggle, ToggleGroup, Tooltip, Upload, addPluginStyles, badgeVariants, buttonVariants, cn, editorText, formatPhoneNumber, formatter, getPluginAssetsUrl, getPluginRuntime, isUndefinedOrNull, jsonOf, localTimeZone, memberName, pluginFetch, pluginJson, readImage, setFileStorage, setPluginRuntime, setRecordTimeline, stored, storedFamily, themeState, toIsoDay, toast, useConfirm, useFilterContext, useFormat, useLiveSignal, useMembersById, usePreviousHotkeyScope, useScopedHotkeys, useToast, useUpload, zoneOffset };
|
package/dist/index.js
CHANGED
|
@@ -53,10 +53,11 @@ import { Toggle } from "./components/toggle.js";
|
|
|
53
53
|
import { Tooltip } from "./components/tooltip.js";
|
|
54
54
|
import { Upload } from "./components/upload.js";
|
|
55
55
|
import { useConfirm } from "./hooks/use-confirm.js";
|
|
56
|
-
import { useMultiQueryState, useQueryState } from "./hooks/use-query-state.js";
|
|
57
56
|
import { toast, useToast } from "./hooks/use-toast.js";
|
|
58
57
|
import { useUpload } from "./hooks/use-upload.js";
|
|
59
58
|
import { cn } from "./lib/utils.js";
|
|
59
|
+
import { LANGUAGES, formatter, localTimeZone, toIsoDay, useFormat, zoneOffset } from "./lib/format.js";
|
|
60
|
+
import { stored, storedFamily } from "./lib/stored.js";
|
|
60
61
|
import { Editor } from "./modules/blocks/components/LazyEditor.js";
|
|
61
62
|
import { editorText } from "./modules/blocks/utils/parseBlocks.js";
|
|
62
63
|
import { EmailDisplay } from "./modules/display/components/EmailDisplay.js";
|
|
@@ -65,7 +66,6 @@ import { RelativeDateDisplay } from "./modules/display/components/RelativeDateDi
|
|
|
65
66
|
import { SexDisplay } from "./modules/display/components/SexDisplay.js";
|
|
66
67
|
import { Filter } from "./modules/filter/components/Filter.js";
|
|
67
68
|
import { useFilterContext } from "./modules/filter/hooks/useFilterContext.js";
|
|
68
|
-
import { useFilterQueryState } from "./modules/filter/hooks/useFilterQueryState.js";
|
|
69
69
|
import { PopoverScoped } from "./modules/hotkey/components/PopoverScoped.js";
|
|
70
70
|
import { usePreviousHotkeyScope } from "./modules/hotkey/hooks/usePreviousHotkeyScope.js";
|
|
71
71
|
import { useScopedHotkeys } from "./modules/hotkey/hooks/useScopedHotkeys.js";
|
|
@@ -89,7 +89,7 @@ import { PhoneInput } from "./modules/record-field/meta-inputs/components/PhoneI
|
|
|
89
89
|
import { RecordTable } from "./modules/record-table/components/RecordTable.js";
|
|
90
90
|
import { RecordTableInlineCell } from "./modules/record-table/components/RecordTableCellInline.js";
|
|
91
91
|
import { EnumCursorDirection } from "./modules/record-table/types/RecordTableCursorTypes.js";
|
|
92
|
-
import { themeState } from "./state/themeState.js";
|
|
92
|
+
import { ThemeOption, themeState } from "./state/themeState.js";
|
|
93
93
|
import { SexCode } from "./types/SexCode.js";
|
|
94
94
|
import { isUndefinedOrNull } from "./utils/IsUndefinedOrNull.js";
|
|
95
95
|
import { readImage } from "./utils/core.js";
|
|
@@ -100,4 +100,4 @@ import { jsonOf } from "./utils/json.js";
|
|
|
100
100
|
import { getPluginRuntime, pluginFetch, pluginJson, setPluginRuntime, useLiveSignal } from "./utils/plugin-runtime.js";
|
|
101
101
|
import { addPluginStyles } from "./utils/plugin-styles.js";
|
|
102
102
|
import { RecordTimeline, setRecordTimeline } from "./utils/record-timeline.js";
|
|
103
|
-
export { Accordion, Alert, AlertDialog, AppLayout, AppLayoutFooterLink, Avatar, BackgroundGradientAnimation, Badge, Breadcrumb, Button, Calendar, Card, ChartContainer, ChartLegendContent, ChartTooltipContent, Checkbox, ChoiceboxGroup, Collapsible, ColorPicker, Combobox, Command, CommandBar, ContextMenu, CopyText, DateInput, DatePicker, Dialog, DragHandle, DropdownMenu, Editor, EmailDisplay, EmailListField, Empty, EntityPicker, EnumCursorDirection, Filter, Form, FullNameField, FullNameValue, HoverCard, IconComponent, IconPicker, IconsProvider, InfoCard, Input, InputGroup, Kbd, Label, MemberInline, MultipleSelector, NavigationMenuLinkItem, NumberField, PageContainer, PageHeader, PageSubHeader, PhoneDisplay, PhoneField, PhoneInput, Popover, PopoverScoped, RadioGroup, RecordTable, RecordTableInlineCell, RecordTimeline, RelativeDateDisplay, Resizable, ScrollArea, Select, SelectMember, Separator, SexCode, SexDisplay, SexField, Sheet, Sidebar, Skeleton, Slider, Spinner, StringArrayInput, Switch, TabButton, Table, Tabs, TextField, TextOverflowTooltip, Textarea, TimeField, Toaster, Toggle, ToggleGroup, Tooltip, Upload, addPluginStyles, badgeVariants, buttonVariants, cn, editorText, formatPhoneNumber, getPluginAssetsUrl, getPluginRuntime, isUndefinedOrNull, jsonOf, memberName, pluginFetch, pluginJson, readImage, setFileStorage, setPluginRuntime, setRecordTimeline, themeState, toast, useConfirm, useFilterContext,
|
|
103
|
+
export { Accordion, Alert, AlertDialog, AppLayout, AppLayoutFooterLink, Avatar, BackgroundGradientAnimation, Badge, Breadcrumb, Button, Calendar, Card, ChartContainer, ChartLegendContent, ChartTooltipContent, Checkbox, ChoiceboxGroup, Collapsible, ColorPicker, Combobox, Command, CommandBar, ContextMenu, CopyText, DateInput, DatePicker, Dialog, DragHandle, DropdownMenu, Editor, EmailDisplay, EmailListField, Empty, EntityPicker, EnumCursorDirection, Filter, Form, FullNameField, FullNameValue, HoverCard, IconComponent, IconPicker, IconsProvider, InfoCard, Input, InputGroup, Kbd, LANGUAGES, Label, MemberInline, MultipleSelector, NavigationMenuLinkItem, NumberField, PageContainer, PageHeader, PageSubHeader, PhoneDisplay, PhoneField, PhoneInput, Popover, PopoverScoped, RadioGroup, RecordTable, RecordTableInlineCell, RecordTimeline, RelativeDateDisplay, Resizable, ScrollArea, Select, SelectMember, Separator, SexCode, SexDisplay, SexField, Sheet, Sidebar, Skeleton, Slider, Spinner, StringArrayInput, Switch, TabButton, Table, Tabs, TextField, TextOverflowTooltip, Textarea, ThemeOption, TimeField, Toaster, Toggle, ToggleGroup, Tooltip, Upload, addPluginStyles, badgeVariants, buttonVariants, cn, editorText, formatPhoneNumber, formatter, getPluginAssetsUrl, getPluginRuntime, isUndefinedOrNull, jsonOf, localTimeZone, memberName, pluginFetch, pluginJson, readImage, setFileStorage, setPluginRuntime, setRecordTimeline, stored, storedFamily, themeState, toIsoDay, toast, useConfirm, useFilterContext, useFormat, useLiveSignal, useMembersById, usePreviousHotkeyScope, useScopedHotkeys, useToast, useUpload, zoneOffset };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** The languages the UI speaks, each with its own name and its date-fns locale. */
|
|
2
|
+
export declare const LANGUAGES: readonly [{
|
|
3
|
+
readonly code: 'en';
|
|
4
|
+
readonly label: 'English';
|
|
5
|
+
readonly dates: import("date-fns").Locale;
|
|
6
|
+
}, {
|
|
7
|
+
readonly code: 'mn';
|
|
8
|
+
readonly label: 'Монгол';
|
|
9
|
+
readonly dates: import("date-fns").Locale;
|
|
10
|
+
}];
|
|
11
|
+
type DateInput = Date | string | number;
|
|
12
|
+
/** The formatters for `language` (an i18next code), for code outside React. */
|
|
13
|
+
export declare const formatter: (language: string) => {
|
|
14
|
+
/** A date in a date-fns pattern; `PP` by default ("Nov 14, 2026"). */
|
|
15
|
+
date: (value: DateInput, pattern?: string) => string;
|
|
16
|
+
/** A date and time: "Nov 14, 2026, 2:30 PM". */
|
|
17
|
+
dateTime: (value: DateInput) => string;
|
|
18
|
+
/** A time of day: "2:30 PM", or "14:30" in a 24-hour language. */
|
|
19
|
+
time: (value: DateInput) => string;
|
|
20
|
+
/** How long ago or ahead: "5 minutes ago", "in 2 days", "less than a minute ago". */
|
|
21
|
+
relative: (value: DateInput, now?: DateInput) => string;
|
|
22
|
+
/** A count or measure: "1,234". */
|
|
23
|
+
number: (value: number) => string;
|
|
24
|
+
/** A list's total; when counting stopped there (`capped`), there are more: "10,000+". */
|
|
25
|
+
count: (value: number, capped?: boolean) => string;
|
|
26
|
+
/** An amount in the currency's main unit: 1500 MNT → "MNT 1,500.00". */
|
|
27
|
+
currency: (value: number, currency: string) => string;
|
|
28
|
+
};
|
|
29
|
+
/** The formatters in the UI's language; a component using them re-renders when it changes. */
|
|
30
|
+
export declare const useFormat: () => {
|
|
31
|
+
/** A date in a date-fns pattern; `PP` by default ("Nov 14, 2026"). */
|
|
32
|
+
date: (value: DateInput, pattern?: string) => string;
|
|
33
|
+
/** A date and time: "Nov 14, 2026, 2:30 PM". */
|
|
34
|
+
dateTime: (value: DateInput) => string;
|
|
35
|
+
/** A time of day: "2:30 PM", or "14:30" in a 24-hour language. */
|
|
36
|
+
time: (value: DateInput) => string;
|
|
37
|
+
/** How long ago or ahead: "5 minutes ago", "in 2 days", "less than a minute ago". */
|
|
38
|
+
relative: (value: DateInput, now?: DateInput) => string;
|
|
39
|
+
/** A count or measure: "1,234". */
|
|
40
|
+
number: (value: number) => string;
|
|
41
|
+
/** A list's total; when counting stopped there (`capped`), there are more: "10,000+". */
|
|
42
|
+
count: (value: number, capped?: boolean) => string;
|
|
43
|
+
/** An amount in the currency's main unit: 1500 MNT → "MNT 1,500.00". */
|
|
44
|
+
currency: (value: number, currency: string) => string;
|
|
45
|
+
};
|
|
46
|
+
/** A local day as stored and typed, `yyyy-MM-dd`, the same in every language. */
|
|
47
|
+
export declare const toIsoDay: (date: Date) => string;
|
|
48
|
+
/** The browser's time zone ("Asia/Ulaanbaatar"), when it says. */
|
|
49
|
+
export declare const localTimeZone: () => string | undefined;
|
|
50
|
+
/** A zone's offset today, "UTC+8"; empty for a zone the browser doesn't know. */
|
|
51
|
+
export declare const zoneOffset: (zone: string) => string;
|
|
52
|
+
export {};
|