@krak-stack/registry 0.1.32 → 0.1.34
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/ui/code-block.d.ts +8 -6
- package/dist/components/ui/code-block.js +44 -19
- package/dist/components/ui/copy-button.d.ts +9 -6
- package/dist/components/ui/copy-button.js +17 -8
- package/dist/components/ui/data-table.d.ts +9 -5
- package/dist/components/ui/data-table.js +90 -486
- package/dist/components/ui/editing-locale-switcher.d.ts +8 -4
- package/dist/components/ui/editing-locale-switcher.js +26 -448
- package/dist/components/ui/effect-form.d.ts +39 -10
- package/dist/components/ui/effect-form.js +171 -541
- package/dist/components/ui/error-component.d.ts +4 -2
- package/dist/components/ui/error-component.js +28 -450
- package/dist/components/ui/file-picker.d.ts +4 -2
- package/dist/components/ui/file-picker.js +27 -452
- package/dist/components/ui/form.d.ts +123 -71
- package/dist/components/ui/form.js +95 -476
- package/dist/components/ui/google-map.d.ts +3 -2
- package/dist/components/ui/google-map.js +6 -439
- package/dist/components/ui/icon-input.d.ts +50 -1
- package/dist/components/ui/icon-input.js +38 -448
- package/dist/components/ui/krakstack-provider.d.ts +9 -0
- package/dist/components/ui/krakstack-provider.js +28 -0
- package/dist/components/ui/loading.d.ts +7 -1
- package/dist/components/ui/loading.js +6 -438
- package/dist/components/ui/locale-switcher.d.ts +8 -4
- package/dist/components/ui/locale-switcher.js +35 -453
- package/dist/components/ui/pagination.d.ts +5 -3
- package/dist/components/ui/pagination.js +7 -439
- package/dist/components/ui/search-menu.d.ts +4 -2
- package/dist/components/ui/search-menu.js +8 -440
- package/dist/components/ui/theme-switcher.d.ts +5 -3
- package/dist/components/ui/theme-switcher.js +8 -440
- package/dist/components/ui/virtualized-combobox.d.ts +4 -2
- package/dist/components/ui/virtualized-combobox.js +17 -445
- package/dist/lib/docs.d.ts +2 -0
- package/dist/lib/docs.js +92 -481
- package/dist/lib/docs.server.js +4 -20
- package/dist/lib/documentation-toolkit.js +4 -20
- package/dist/lib/markdown/content.d.ts +4 -5
- package/dist/services/agent/client/index.js +81 -463
- package/dist/services/agent/client/widget.d.ts +6 -3
- package/dist/services/notification/client/index.js +11 -440
- package/dist/services/notification/client/notification-menu.d.ts +7 -4
- package/dist/services/notification/public.js +11 -440
- package/package.json +5 -1
- package/dist/paraglide/runtime.d.ts +0 -978
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
copyFailed?: string;
|
|
1
|
+
import { type CopyButtonMessages } from "./copy-button.js";
|
|
2
|
+
export type CodeBlockMessages = CopyButtonMessages & {
|
|
3
|
+
codeDescription: (language: string) => string;
|
|
5
4
|
};
|
|
5
|
+
export type CodeBlockMessageTranslations = Partial<Record<string, Partial<CodeBlockMessages>>>;
|
|
6
|
+
export declare const codeBlockMessages: (locale?: string, translations?: CodeBlockMessageTranslations) => CodeBlockMessages;
|
|
6
7
|
type CodeBlockProps = {
|
|
7
8
|
code: string;
|
|
8
9
|
language?: string;
|
|
9
|
-
|
|
10
|
+
locale?: string;
|
|
11
|
+
messages?: CodeBlockMessageTranslations;
|
|
10
12
|
};
|
|
11
|
-
export declare function CodeBlock({ code, language, messages, }: CodeBlockProps): import("react").JSX.Element;
|
|
13
|
+
export declare function CodeBlock({ code, language, locale: localeOverride, messages, }: CodeBlockProps): import("react").JSX.Element;
|
|
12
14
|
export {};
|
|
@@ -49,12 +49,23 @@ function Button({
|
|
|
49
49
|
// ../../src/components/ui/copy-button.tsx
|
|
50
50
|
import { Check, Copy, TriangleAlert } from "lucide-react";
|
|
51
51
|
import { useEffect, useRef, useState } from "react";
|
|
52
|
+
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider";
|
|
52
53
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
54
|
+
var messages = {
|
|
55
|
+
en: { copy: "Copy", copied: "Copied", copyFailed: "Copy failed" },
|
|
56
|
+
fr: { copy: "Copier", copied: "Copié", copyFailed: "Échec de la copie" }
|
|
57
|
+
};
|
|
58
|
+
var copyButtonMessages = (locale = "en", translations) => ({
|
|
59
|
+
...locale.startsWith("fr") ? messages.fr : messages.en,
|
|
60
|
+
...translations?.[locale.split("-")[0] ?? locale],
|
|
61
|
+
...translations?.[locale]
|
|
62
|
+
});
|
|
53
63
|
function CopyButton({
|
|
54
64
|
value,
|
|
55
65
|
valueDescription,
|
|
56
66
|
copyVariant = "default",
|
|
57
|
-
|
|
67
|
+
locale: localeOverride,
|
|
68
|
+
messages: messages2,
|
|
58
69
|
onCopied,
|
|
59
70
|
onCopyError,
|
|
60
71
|
resetDelay = 1500,
|
|
@@ -63,13 +74,10 @@ function CopyButton({
|
|
|
63
74
|
"aria-label": ariaLabel,
|
|
64
75
|
...props
|
|
65
76
|
}) {
|
|
77
|
+
const locale = useKrakstackLocale(localeOverride);
|
|
66
78
|
const [copyState, setCopyState] = useState("idle");
|
|
67
79
|
const copyTimeout = useRef(undefined);
|
|
68
|
-
const labels =
|
|
69
|
-
copy: messages?.copy ?? "Copy",
|
|
70
|
-
copied: messages?.copied ?? "Copied",
|
|
71
|
-
copyFailed: messages?.copyFailed ?? "Copy failed"
|
|
72
|
-
};
|
|
80
|
+
const labels = copyButtonMessages(locale, messages2);
|
|
73
81
|
const accessibleLabel = ariaLabel ?? (valueDescription ? `${labels.copy} ${valueDescription}` : labels.copy);
|
|
74
82
|
const isLarge = copyVariant === "large";
|
|
75
83
|
const defaultSize = copyVariant === "sm" ? "icon-xs" : isLarge ? "sm" : "icon-sm";
|
|
@@ -91,7 +99,7 @@ function CopyButton({
|
|
|
91
99
|
onCopied?.();
|
|
92
100
|
} catch (error) {
|
|
93
101
|
setCopyState("failed");
|
|
94
|
-
onCopyError?.(error instanceof Error ? error : new Error(
|
|
102
|
+
onCopyError?.(error instanceof Error ? error : new Error(labels.copyFailed, { cause: error }));
|
|
95
103
|
}
|
|
96
104
|
resetCopyState();
|
|
97
105
|
};
|
|
@@ -130,6 +138,7 @@ import { highlight } from "@tanstack/highlight";
|
|
|
130
138
|
import { createThemeCss } from "@tanstack/highlight/theme";
|
|
131
139
|
import { githubDarkTheme } from "@tanstack/highlight/themes/github-dark";
|
|
132
140
|
import { githubLightTheme } from "@tanstack/highlight/themes/github-light";
|
|
141
|
+
import { useKrakstackLocale as useKrakstackLocale2 } from "@krak-stack/registry/krakstack-provider";
|
|
133
142
|
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
134
143
|
var themeCss = `${createThemeCss({
|
|
135
144
|
light: githubLightTheme,
|
|
@@ -147,21 +156,35 @@ var themeCss = `${createThemeCss({
|
|
|
147
156
|
color: inherit;
|
|
148
157
|
}
|
|
149
158
|
[data-code-theme] pre.th-code code { font: inherit; }`;
|
|
159
|
+
var messages2 = {
|
|
160
|
+
en: {
|
|
161
|
+
codeDescription: (language) => `${language} code`,
|
|
162
|
+
copy: "Copy",
|
|
163
|
+
copied: "Copied",
|
|
164
|
+
copyFailed: "Copy failed"
|
|
165
|
+
},
|
|
166
|
+
fr: {
|
|
167
|
+
codeDescription: (language) => `code ${language}`,
|
|
168
|
+
copy: "Copier",
|
|
169
|
+
copied: "Copié",
|
|
170
|
+
copyFailed: "Échec de la copie"
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
var codeBlockMessages = (locale = "en", translations) => ({
|
|
174
|
+
...locale.startsWith("fr") ? messages2.fr : messages2.en,
|
|
175
|
+
...translations?.[locale.split("-")[0] ?? locale],
|
|
176
|
+
...translations?.[locale]
|
|
177
|
+
});
|
|
150
178
|
function CodeBlock({
|
|
151
179
|
code,
|
|
152
180
|
language = "text",
|
|
153
|
-
|
|
181
|
+
locale: localeOverride,
|
|
182
|
+
messages: messages3
|
|
154
183
|
}) {
|
|
184
|
+
const locale = useKrakstackLocale2(localeOverride);
|
|
155
185
|
const normalizedLanguage = language.toLowerCase() || "text";
|
|
156
186
|
const highlighted = highlight(code, { lang: normalizedLanguage });
|
|
157
|
-
const
|
|
158
|
-
if (messages?.copy !== undefined)
|
|
159
|
-
copyMessages.copy = messages.copy;
|
|
160
|
-
if (messages?.copied !== undefined)
|
|
161
|
-
copyMessages.copied = messages.copied;
|
|
162
|
-
if (messages?.copyFailed !== undefined) {
|
|
163
|
-
copyMessages.copyFailed = messages.copyFailed;
|
|
164
|
-
}
|
|
187
|
+
const labels = codeBlockMessages(locale, messages3);
|
|
165
188
|
return /* @__PURE__ */ jsxs2("div", {
|
|
166
189
|
className: "not-prose bg-muted overflow-hidden rounded-md border text-[var(--th-token)]",
|
|
167
190
|
"data-code-theme": true,
|
|
@@ -178,9 +201,10 @@ function CodeBlock({
|
|
|
178
201
|
}),
|
|
179
202
|
/* @__PURE__ */ jsx3(CopyButton, {
|
|
180
203
|
value: code,
|
|
181
|
-
valueDescription:
|
|
204
|
+
valueDescription: labels.codeDescription(highlighted.lang),
|
|
182
205
|
variant: "secondary",
|
|
183
|
-
|
|
206
|
+
locale,
|
|
207
|
+
messages: { [locale]: labels }
|
|
184
208
|
})
|
|
185
209
|
]
|
|
186
210
|
}),
|
|
@@ -192,5 +216,6 @@ function CodeBlock({
|
|
|
192
216
|
});
|
|
193
217
|
}
|
|
194
218
|
export {
|
|
195
|
-
CodeBlock
|
|
219
|
+
CodeBlock,
|
|
220
|
+
codeBlockMessages
|
|
196
221
|
};
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { Button } from "./button.js";
|
|
2
2
|
import type { ComponentProps } from "react";
|
|
3
|
-
type CopyButtonMessages = {
|
|
4
|
-
copy
|
|
5
|
-
copied
|
|
6
|
-
copyFailed
|
|
3
|
+
export type CopyButtonMessages = {
|
|
4
|
+
copy: string;
|
|
5
|
+
copied: string;
|
|
6
|
+
copyFailed: string;
|
|
7
7
|
};
|
|
8
|
+
export type CopyButtonMessageTranslations = Partial<Record<string, Partial<CopyButtonMessages>>>;
|
|
9
|
+
export declare const copyButtonMessages: (locale?: string, translations?: CopyButtonMessageTranslations) => CopyButtonMessages;
|
|
8
10
|
type CopyButtonProps = Omit<ComponentProps<typeof Button>, "children" | "onClick"> & {
|
|
9
11
|
value: string;
|
|
10
12
|
valueDescription?: string;
|
|
11
13
|
copyVariant?: "default" | "sm" | "large";
|
|
12
|
-
|
|
14
|
+
locale?: string;
|
|
15
|
+
messages?: CopyButtonMessageTranslations;
|
|
13
16
|
onCopied?: () => void;
|
|
14
17
|
onCopyError?: (error: Error) => void;
|
|
15
18
|
resetDelay?: number;
|
|
16
19
|
};
|
|
17
|
-
export declare function CopyButton({ value, valueDescription, copyVariant, messages, onCopied, onCopyError, resetDelay, disabled, size, "aria-label": ariaLabel, ...props }: CopyButtonProps): import("react").JSX.Element;
|
|
20
|
+
export declare function CopyButton({ value, valueDescription, copyVariant, locale: localeOverride, messages, onCopied, onCopyError, resetDelay, disabled, size, "aria-label": ariaLabel, ...props }: CopyButtonProps): import("react").JSX.Element;
|
|
18
21
|
export {};
|
|
@@ -49,12 +49,23 @@ function Button({
|
|
|
49
49
|
// ../../src/components/ui/copy-button.tsx
|
|
50
50
|
import { Check, Copy, TriangleAlert } from "lucide-react";
|
|
51
51
|
import { useEffect, useRef, useState } from "react";
|
|
52
|
+
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider";
|
|
52
53
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
54
|
+
var messages = {
|
|
55
|
+
en: { copy: "Copy", copied: "Copied", copyFailed: "Copy failed" },
|
|
56
|
+
fr: { copy: "Copier", copied: "Copié", copyFailed: "Échec de la copie" }
|
|
57
|
+
};
|
|
58
|
+
var copyButtonMessages = (locale = "en", translations) => ({
|
|
59
|
+
...locale.startsWith("fr") ? messages.fr : messages.en,
|
|
60
|
+
...translations?.[locale.split("-")[0] ?? locale],
|
|
61
|
+
...translations?.[locale]
|
|
62
|
+
});
|
|
53
63
|
function CopyButton({
|
|
54
64
|
value,
|
|
55
65
|
valueDescription,
|
|
56
66
|
copyVariant = "default",
|
|
57
|
-
|
|
67
|
+
locale: localeOverride,
|
|
68
|
+
messages: messages2,
|
|
58
69
|
onCopied,
|
|
59
70
|
onCopyError,
|
|
60
71
|
resetDelay = 1500,
|
|
@@ -63,13 +74,10 @@ function CopyButton({
|
|
|
63
74
|
"aria-label": ariaLabel,
|
|
64
75
|
...props
|
|
65
76
|
}) {
|
|
77
|
+
const locale = useKrakstackLocale(localeOverride);
|
|
66
78
|
const [copyState, setCopyState] = useState("idle");
|
|
67
79
|
const copyTimeout = useRef(undefined);
|
|
68
|
-
const labels =
|
|
69
|
-
copy: messages?.copy ?? "Copy",
|
|
70
|
-
copied: messages?.copied ?? "Copied",
|
|
71
|
-
copyFailed: messages?.copyFailed ?? "Copy failed"
|
|
72
|
-
};
|
|
80
|
+
const labels = copyButtonMessages(locale, messages2);
|
|
73
81
|
const accessibleLabel = ariaLabel ?? (valueDescription ? `${labels.copy} ${valueDescription}` : labels.copy);
|
|
74
82
|
const isLarge = copyVariant === "large";
|
|
75
83
|
const defaultSize = copyVariant === "sm" ? "icon-xs" : isLarge ? "sm" : "icon-sm";
|
|
@@ -91,7 +99,7 @@ function CopyButton({
|
|
|
91
99
|
onCopied?.();
|
|
92
100
|
} catch (error) {
|
|
93
101
|
setCopyState("failed");
|
|
94
|
-
onCopyError?.(error instanceof Error ? error : new Error(
|
|
102
|
+
onCopyError?.(error instanceof Error ? error : new Error(labels.copyFailed, { cause: error }));
|
|
95
103
|
}
|
|
96
104
|
resetCopyState();
|
|
97
105
|
};
|
|
@@ -125,5 +133,6 @@ function CopyButton({
|
|
|
125
133
|
});
|
|
126
134
|
}
|
|
127
135
|
export {
|
|
128
|
-
CopyButton
|
|
136
|
+
CopyButton,
|
|
137
|
+
copyButtonMessages
|
|
129
138
|
};
|
|
@@ -33,6 +33,8 @@ export interface DataTableListItemContext<TData> {
|
|
|
33
33
|
export interface DataTableListOptions {
|
|
34
34
|
emptyLabel: ReactNode;
|
|
35
35
|
display?: "list" | "icon";
|
|
36
|
+
locale?: string;
|
|
37
|
+
messages?: DataTableMessageTranslations;
|
|
36
38
|
visibleCount?: number;
|
|
37
39
|
}
|
|
38
40
|
export type DataTableListColumn<TData> = DataTableListOptions & {
|
|
@@ -84,7 +86,7 @@ export type DataTableListCellProps = DataTableListCellActionsProps & (EditableDa
|
|
|
84
86
|
onRemove?: never;
|
|
85
87
|
}));
|
|
86
88
|
export interface DataTableDateOptions {
|
|
87
|
-
/** Defaults to the
|
|
89
|
+
/** Defaults to the DataTable locale, or English outside a DataTable. */
|
|
88
90
|
locale?: string;
|
|
89
91
|
/** Defaults to UTC. Calendar-only strings retain their date in every zone. */
|
|
90
92
|
timeZone?: string;
|
|
@@ -275,7 +277,8 @@ export type DataTableMessages = PaginationMessages & {
|
|
|
275
277
|
selected: string;
|
|
276
278
|
};
|
|
277
279
|
export type DataTableMessageOverrides = Partial<DataTableMessages>;
|
|
278
|
-
export
|
|
280
|
+
export type DataTableMessageTranslations = Partial<Record<string, DataTableMessageOverrides>>;
|
|
281
|
+
export declare const dataTableMessages: (locale?: string, translations?: DataTableMessageTranslations) => {
|
|
279
282
|
pageSize: string;
|
|
280
283
|
results: (count: number) => string;
|
|
281
284
|
selectedOf: (selected: number, total: number) => string;
|
|
@@ -356,11 +359,12 @@ export interface DataTableProps<TData extends RowData> {
|
|
|
356
359
|
getRowId?: (row: TData) => string;
|
|
357
360
|
state?: DataTablePublicState;
|
|
358
361
|
initialState?: Partial<DataTablePublicState>;
|
|
362
|
+
locale?: string;
|
|
359
363
|
onStateChange?: (state: DataTablePublicState) => void;
|
|
360
364
|
status?: DataTableStatus;
|
|
361
365
|
features?: DataTableFeatures<TData>;
|
|
362
366
|
onRowClicked?: (row: TData) => void;
|
|
363
|
-
messages?:
|
|
367
|
+
messages?: DataTableMessageTranslations;
|
|
364
368
|
}
|
|
365
369
|
export interface DataTableColumn<TData extends RowData> {
|
|
366
370
|
id: string;
|
|
@@ -386,8 +390,8 @@ export interface DataTableModel<TData extends RowData> {
|
|
|
386
390
|
export declare const normalizeDataTableColumns: <TData extends RowData>(columnDefs: readonly DataTableColDef<TData>[], columnSizing?: Readonly<Record<string, number>>) => DataTableColumn<TData>[];
|
|
387
391
|
export declare const getDataTableWidth: <TData extends RowData>(columns: readonly DataTableColumn<TData>[], utilityColumns?: number) => number;
|
|
388
392
|
export declare const buildDataTableRows: <TData extends RowData>(rowData: readonly TData[], columns: readonly DataTableColumn<TData>[], getRowId?: (row: TData) => string) => DataTableModelRow<TData>[];
|
|
389
|
-
export declare const getDataTableExportValue: <TData extends RowData>(row: DataTableModelRow<TData>, column: DataTableColumn<TData
|
|
390
|
-
export declare const filterDataTableRows: <TData extends RowData>(rows: readonly DataTableModelRow<TData>[], columns: readonly DataTableColumn<TData>[], globalFilter: string) => DataTableModelRow<TData>[];
|
|
393
|
+
export declare const getDataTableExportValue: <TData extends RowData>(row: DataTableModelRow<TData>, column: DataTableColumn<TData>, locale?: string) => unknown;
|
|
394
|
+
export declare const filterDataTableRows: <TData extends RowData>(rows: readonly DataTableModelRow<TData>[], columns: readonly DataTableColumn<TData>[], globalFilter: string, locale?: string) => DataTableModelRow<TData>[];
|
|
391
395
|
export declare const sortDataTableRows: <TData extends RowData>(rows: readonly DataTableModelRow<TData>[], columns: readonly DataTableColumn<TData>[], sorting: NonNullable<QueryType["sort"]>) => DataTableModelRow<TData>[];
|
|
392
396
|
export declare const paginateDataTableRows: <TData extends RowData>(rows: readonly DataTableModelRow<TData>[], pagination: Pick<QueryType, "page" | "pageSize">) => DataTableModelRow<TData>[];
|
|
393
397
|
export declare const reorderDataTableRows: <TData extends RowData>(rows: readonly DataTableModelRow<TData>[], sourceRowId: string, targetRowId: string) => TData[];
|