@krak-stack/registry 0.7.0 → 0.8.1
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/CHANGELOG.md +13 -0
- package/dist/components/ui/cron-expression-editor.d.ts +14 -0
- package/dist/components/ui/cron-expression-editor.js +206 -0
- package/dist/components/ui/cron-expression-editor.schema.d.ts +7 -0
- package/dist/components/ui/form.d.ts +5 -5
- package/dist/components/ui/phone-number-input.d.ts +20 -0
- package/dist/components/ui/phone-number-input.js +682 -0
- package/dist/services/agent/client/index.js +2 -0
- package/dist/services/notification/client/index.js +135 -91
- package/dist/services/notification/public.js +135 -91
- package/package.json +11 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @krak-stack/registry
|
|
2
2
|
|
|
3
|
+
## 0.8.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Preserve native Space and Shift+Enter typing in the agent textarea instead of activating the reference popover trigger. Include regression coverage for plain text and reference queries.
|
|
8
|
+
- 09d03cc: Expose the notification menu through the browser-safe `@krak-stack/notifications/client` entry point using the optional registry peer. Keep one shared menu implementation. Constrain popover and notification content overflow, place archive actions inside notification cards, and show a labeled Archive all button beneath the tabs. Use the standard rounded trigger button.
|
|
9
|
+
|
|
10
|
+
## 0.8.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- 9f63def: Add a restricted typed Cron Expression Editor with automatic spacing and per-field validation, and a numeric Phone Number Input with live formatting, protected calling codes and searchable countries. Include bilingual guides and interactive previews. Keep scheduling, phone verification and persistence application-owned.
|
|
15
|
+
|
|
3
16
|
## 0.7.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { CronDraftSchema, formatCronDraft, } from "./cron-expression-editor.schema.js";
|
|
2
|
+
export declare const getCronPreview: (expression: string, timeZone: string, referenceTime: Date, count?: number) => readonly Date[] | null;
|
|
3
|
+
export type CronExpressionEditorProps = {
|
|
4
|
+
value: string;
|
|
5
|
+
onValueChange: (value: string) => void;
|
|
6
|
+
timeZone: string;
|
|
7
|
+
/** Explicit instant keeps server rendering and DST previews reproducible. */
|
|
8
|
+
referenceTime: Date;
|
|
9
|
+
locale?: string;
|
|
10
|
+
label?: string;
|
|
11
|
+
name?: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare const CronExpressionEditor: ({ value, onValueChange, timeZone, referenceTime, locale, label, name, disabled, }: CronExpressionEditorProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
// ../../src/components/ui/cron-expression-editor.tsx
|
|
2
|
+
import { useId, useLayoutEffect, useRef } from "react";
|
|
3
|
+
import { Effect as Effect2, Option as Option2 } from "effect";
|
|
4
|
+
import { CronExpressionParser as CronExpressionParser2 } from "cron-parser";
|
|
5
|
+
|
|
6
|
+
// ../../src/components/ui/input.tsx
|
|
7
|
+
import { Input as InputPrimitive } from "@base-ui/react/input";
|
|
8
|
+
|
|
9
|
+
// ../../src/lib/utils.ts
|
|
10
|
+
import { cn } from "cn";
|
|
11
|
+
|
|
12
|
+
// ../../src/components/ui/input.tsx
|
|
13
|
+
import { jsx } from "react/jsx-runtime";
|
|
14
|
+
function Input({ className, type, ...props }) {
|
|
15
|
+
return /* @__PURE__ */ jsx(InputPrimitive, {
|
|
16
|
+
type,
|
|
17
|
+
"data-slot": "input",
|
|
18
|
+
className: cn("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", className),
|
|
19
|
+
...props
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// ../../src/components/ui/cron-expression-editor.tsx
|
|
24
|
+
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider";
|
|
25
|
+
|
|
26
|
+
// ../../src/components/ui/cron-expression-editor.schema.ts
|
|
27
|
+
import { Effect, Option, Schema } from "effect";
|
|
28
|
+
import { CronExpressionParser } from "cron-parser";
|
|
29
|
+
var acceptsField = (token, index) => {
|
|
30
|
+
const fields = ["*", "*", "*", "*", "*"];
|
|
31
|
+
fields[index] = token;
|
|
32
|
+
return Option.isSome(Effect.runSync(Effect.option(Effect.try(() => CronExpressionParser.parse(fields.join(" "))))));
|
|
33
|
+
};
|
|
34
|
+
var CronDraftSchema = Schema.Struct({
|
|
35
|
+
text: Schema.String.check(Schema.isPattern(/^[\d*/,\- ]*$/), Schema.isMaxLength(150)),
|
|
36
|
+
cursor: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))
|
|
37
|
+
}).check(Schema.makeFilter(({ text, cursor }) => {
|
|
38
|
+
if (!text)
|
|
39
|
+
return true;
|
|
40
|
+
const fields = text.split(" ");
|
|
41
|
+
if (fields.length > 5)
|
|
42
|
+
return false;
|
|
43
|
+
const active = text.slice(0, cursor).split(" ").length - 1;
|
|
44
|
+
return fields.every((token, index) => {
|
|
45
|
+
if (acceptsField(token, index))
|
|
46
|
+
return true;
|
|
47
|
+
if (index !== active || /\/0+$/.test(token))
|
|
48
|
+
return false;
|
|
49
|
+
if (!token)
|
|
50
|
+
return index === fields.length - 1;
|
|
51
|
+
return Array.from({ length: 60 }, (_, number) => String(number)).concat("*").some((suffix) => acceptsField(`${token}${suffix}`, index));
|
|
52
|
+
});
|
|
53
|
+
})).annotate({ identifier: "CronDraft" });
|
|
54
|
+
var formatCronDraft = (text, cursor = text.length) => {
|
|
55
|
+
const normalized = text.replace(/\s+/g, " ").trimStart();
|
|
56
|
+
const normalizedCursor = text.slice(0, cursor).replace(/\s+/g, " ").trimStart().length;
|
|
57
|
+
return Schema.is(CronDraftSchema)({
|
|
58
|
+
text: normalized,
|
|
59
|
+
cursor: normalizedCursor
|
|
60
|
+
}) ? normalized : null;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// ../../src/components/ui/cron-expression-editor.tsx
|
|
64
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
65
|
+
var getCronPreview = (expression, timeZone, referenceTime, count = 5) => {
|
|
66
|
+
if (expression.trim().split(/\s+/).length !== 5 || !Number.isFinite(referenceTime.getTime()) || !Number.isInteger(count) || count < 1 || count > 20)
|
|
67
|
+
return null;
|
|
68
|
+
const result = Effect2.runSync(Effect2.option(Effect2.try(() => {
|
|
69
|
+
new Intl.DateTimeFormat("en", { timeZone }).format(referenceTime);
|
|
70
|
+
const interval = CronExpressionParser2.parse(expression, {
|
|
71
|
+
currentDate: referenceTime,
|
|
72
|
+
tz: timeZone
|
|
73
|
+
});
|
|
74
|
+
return Array.from({ length: count }, () => interval.next().toDate());
|
|
75
|
+
})));
|
|
76
|
+
return Option2.getOrNull(result);
|
|
77
|
+
};
|
|
78
|
+
var CronExpressionEditor = ({
|
|
79
|
+
value,
|
|
80
|
+
onValueChange,
|
|
81
|
+
timeZone,
|
|
82
|
+
referenceTime,
|
|
83
|
+
locale,
|
|
84
|
+
label,
|
|
85
|
+
name,
|
|
86
|
+
disabled
|
|
87
|
+
}) => {
|
|
88
|
+
const id = useId();
|
|
89
|
+
const language = useKrakstackLocale(locale);
|
|
90
|
+
const french = language.startsWith("fr");
|
|
91
|
+
const dates = getCronPreview(value, timeZone, referenceTime);
|
|
92
|
+
const selection = useRef(null);
|
|
93
|
+
useLayoutEffect(() => {
|
|
94
|
+
const pending = selection.current;
|
|
95
|
+
if (!pending)
|
|
96
|
+
return;
|
|
97
|
+
selection.current = null;
|
|
98
|
+
pending.element.setSelectionRange(pending.position, pending.position);
|
|
99
|
+
});
|
|
100
|
+
const firstRun = dates?.[0];
|
|
101
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
102
|
+
className: "grid min-w-0 gap-2",
|
|
103
|
+
children: [
|
|
104
|
+
/* @__PURE__ */ jsx2("label", {
|
|
105
|
+
htmlFor: id,
|
|
106
|
+
className: "text-sm font-medium",
|
|
107
|
+
children: label ?? (french ? "Expression cron" : "Cron expression")
|
|
108
|
+
}),
|
|
109
|
+
/* @__PURE__ */ jsx2(Input, {
|
|
110
|
+
id,
|
|
111
|
+
name,
|
|
112
|
+
value,
|
|
113
|
+
disabled,
|
|
114
|
+
autoComplete: "off",
|
|
115
|
+
autoCapitalize: "off",
|
|
116
|
+
spellCheck: false,
|
|
117
|
+
placeholder: "*/15 9 * * 1-5",
|
|
118
|
+
className: "font-mono tracking-wide",
|
|
119
|
+
"aria-invalid": !dates,
|
|
120
|
+
"aria-describedby": `${id}-help`,
|
|
121
|
+
onKeyDown: (event) => {
|
|
122
|
+
if (!event.ctrlKey && !event.metaKey && !event.altKey && event.key.length === 1 && !/[\d*/,\- ]/.test(event.key))
|
|
123
|
+
event.preventDefault();
|
|
124
|
+
},
|
|
125
|
+
onChange: (event) => {
|
|
126
|
+
const raw = event.target.value;
|
|
127
|
+
const cursor = event.target.selectionStart ?? raw.length;
|
|
128
|
+
const next = formatCronDraft(raw, cursor);
|
|
129
|
+
if (next === null)
|
|
130
|
+
return;
|
|
131
|
+
selection.current = {
|
|
132
|
+
element: event.target,
|
|
133
|
+
position: raw.slice(0, cursor).replace(/\s+/g, " ").trimStart().length
|
|
134
|
+
};
|
|
135
|
+
onValueChange(next);
|
|
136
|
+
}
|
|
137
|
+
}),
|
|
138
|
+
/* @__PURE__ */ jsx2("p", {
|
|
139
|
+
id: `${id}-help`,
|
|
140
|
+
className: "text-muted-foreground text-xs",
|
|
141
|
+
children: french ? "Minute · heure · jour du mois · mois · jour de la semaine" : "Minute · hour · day of month · month · day of week"
|
|
142
|
+
}),
|
|
143
|
+
dates && firstRun ? /* @__PURE__ */ jsxs("details", {
|
|
144
|
+
className: "text-muted-foreground min-w-0 text-xs",
|
|
145
|
+
children: [
|
|
146
|
+
/* @__PURE__ */ jsxs("summary", {
|
|
147
|
+
className: "cursor-pointer rounded-sm outline-offset-4",
|
|
148
|
+
children: [
|
|
149
|
+
/* @__PURE__ */ jsx2("span", {
|
|
150
|
+
className: "text-foreground font-medium",
|
|
151
|
+
children: french ? "Prochaines exécutions" : "Next runs"
|
|
152
|
+
}),
|
|
153
|
+
" · ",
|
|
154
|
+
/* @__PURE__ */ jsx2("time", {
|
|
155
|
+
dateTime: firstRun.toISOString(),
|
|
156
|
+
title: timeZone,
|
|
157
|
+
children: new Intl.DateTimeFormat(language, {
|
|
158
|
+
timeZone,
|
|
159
|
+
month: "short",
|
|
160
|
+
day: "numeric",
|
|
161
|
+
hour: "2-digit",
|
|
162
|
+
minute: "2-digit",
|
|
163
|
+
timeZoneName: "short"
|
|
164
|
+
}).format(firstRun)
|
|
165
|
+
}),
|
|
166
|
+
" ",
|
|
167
|
+
/* @__PURE__ */ jsxs("span", {
|
|
168
|
+
children: [
|
|
169
|
+
"+",
|
|
170
|
+
dates.length - 1
|
|
171
|
+
]
|
|
172
|
+
})
|
|
173
|
+
]
|
|
174
|
+
}),
|
|
175
|
+
/* @__PURE__ */ jsx2("p", {
|
|
176
|
+
className: "mt-2 break-all",
|
|
177
|
+
children: timeZone
|
|
178
|
+
}),
|
|
179
|
+
/* @__PURE__ */ jsx2("ol", {
|
|
180
|
+
className: "mt-1 grid gap-1",
|
|
181
|
+
children: dates.map((date) => /* @__PURE__ */ jsx2("li", {
|
|
182
|
+
children: /* @__PURE__ */ jsx2("time", {
|
|
183
|
+
dateTime: date.toISOString(),
|
|
184
|
+
children: new Intl.DateTimeFormat(language, {
|
|
185
|
+
timeZone,
|
|
186
|
+
dateStyle: "medium",
|
|
187
|
+
timeStyle: "long"
|
|
188
|
+
}).format(date)
|
|
189
|
+
})
|
|
190
|
+
}, date.toISOString()))
|
|
191
|
+
})
|
|
192
|
+
]
|
|
193
|
+
}) : /* @__PURE__ */ jsx2("p", {
|
|
194
|
+
role: "status",
|
|
195
|
+
className: "text-destructive text-sm",
|
|
196
|
+
children: french ? "Complétez les cinq champs. Si la règle est complète, vérifiez le fuseau, la date et les prochaines exécutions possibles." : "Complete all five fields. If the rule is complete, check the time zone, reference date and possible next runs."
|
|
197
|
+
})
|
|
198
|
+
]
|
|
199
|
+
});
|
|
200
|
+
};
|
|
201
|
+
export {
|
|
202
|
+
CronDraftSchema,
|
|
203
|
+
CronExpressionEditor,
|
|
204
|
+
formatCronDraft,
|
|
205
|
+
getCronPreview
|
|
206
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
/** The active field may be unfinished, but must still be completable. */
|
|
3
|
+
export declare const CronDraftSchema: Schema.Struct<{
|
|
4
|
+
readonly text: Schema.String;
|
|
5
|
+
readonly cursor: Schema.Int;
|
|
6
|
+
}>;
|
|
7
|
+
export declare const formatCronDraft: (text: string, cursor?: number) => string | null;
|
|
@@ -145,7 +145,7 @@ declare const RevertButton: ({ locale, messages, original, }: {
|
|
|
145
145
|
messages?: FormMessageTranslations;
|
|
146
146
|
original: string;
|
|
147
147
|
}) => JSX.Element | undefined;
|
|
148
|
-
declare const useAppForm: <TFormData, TOnMount extends undefined | import("@tanstack/
|
|
148
|
+
declare const useAppForm: <TFormData, TOnMount extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnChange extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnChangeAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnBlur extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnBlurAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnSubmit extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnSubmitAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnDynamic extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnDynamicAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnServer extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TSubmitMeta>(props: import("@tanstack/form-core").FormOptions<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>) => import("@tanstack/react-form").AppFieldExtendedReactFormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta, {
|
|
149
149
|
readonly TextField: typeof TextField;
|
|
150
150
|
readonly TextAreaField: typeof TextAreaField;
|
|
151
151
|
readonly SelectField: typeof SelectField;
|
|
@@ -161,7 +161,7 @@ declare const useAppForm: <TFormData, TOnMount extends undefined | import("@tans
|
|
|
161
161
|
readonly FormError: typeof FormError;
|
|
162
162
|
readonly FieldWrapper: typeof FieldWrapper;
|
|
163
163
|
readonly BlockNavigation: typeof BlockNavigation;
|
|
164
|
-
}>, withForm: <TFormData, TOnMount extends undefined | import("@tanstack/
|
|
164
|
+
}>, withForm: <TFormData, TOnMount extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnChange extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnChangeAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnBlur extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnBlurAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnSubmit extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnSubmitAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnDynamic extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnDynamicAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnServer extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TSubmitMeta, TRenderProps extends object = {}>({ render, props, }: import("@tanstack/react-form").WithFormProps<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta, {
|
|
165
165
|
readonly TextField: typeof TextField;
|
|
166
166
|
readonly TextAreaField: typeof TextAreaField;
|
|
167
167
|
readonly SelectField: typeof SelectField;
|
|
@@ -178,7 +178,7 @@ declare const useAppForm: <TFormData, TOnMount extends undefined | import("@tans
|
|
|
178
178
|
readonly FieldWrapper: typeof FieldWrapper;
|
|
179
179
|
readonly BlockNavigation: typeof BlockNavigation;
|
|
180
180
|
}, TRenderProps>) => import("react").FunctionComponent<import("react").PropsWithChildren<NoInfer<[unknown] extends [TRenderProps] ? any : TRenderProps> & {
|
|
181
|
-
form: import("@tanstack/react-form").AppFieldExtendedReactFormApi<[unknown] extends [TFormData] ? any : TFormData, [import("@tanstack/
|
|
181
|
+
form: import("@tanstack/react-form").AppFieldExtendedReactFormApi<[unknown] extends [TFormData] ? any : TFormData, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnMount] ? [TOnMount] extends [TOnMount & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnMount : TOnMount, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnChange] ? [TOnChange] extends [TOnChange & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnChange : TOnChange, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnChangeAsync] ? [TOnChangeAsync] extends [TOnChangeAsync & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnChangeAsync : TOnChangeAsync, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnBlur] ? [TOnBlur] extends [TOnBlur & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnBlur : TOnBlur, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnBlurAsync] ? [TOnBlurAsync] extends [TOnBlurAsync & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnBlurAsync : TOnBlurAsync, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnSubmit] ? [TOnSubmit] extends [TOnSubmit & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnSubmit : TOnSubmit, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnSubmitAsync] ? [TOnSubmitAsync] extends [TOnSubmitAsync & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnSubmitAsync : TOnSubmitAsync, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnDynamic] ? [TOnDynamic] extends [TOnDynamic & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnDynamic : TOnDynamic, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnDynamicAsync] ? [TOnDynamicAsync] extends [TOnDynamicAsync & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnDynamicAsync : TOnDynamicAsync, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnServer] ? [TOnServer] extends [TOnServer & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnServer : TOnServer, [unknown] extends [TSubmitMeta] ? any : TSubmitMeta, {
|
|
182
182
|
readonly TextField: typeof TextField;
|
|
183
183
|
readonly TextAreaField: typeof TextAreaField;
|
|
184
184
|
readonly SelectField: typeof SelectField;
|
|
@@ -211,8 +211,8 @@ declare const useAppForm: <TFormData, TOnMount extends undefined | import("@tans
|
|
|
211
211
|
readonly FormError: typeof FormError;
|
|
212
212
|
readonly FieldWrapper: typeof FieldWrapper;
|
|
213
213
|
readonly BlockNavigation: typeof BlockNavigation;
|
|
214
|
-
}, TSubmitMeta, TRenderProps>) => <TFormData, TFields extends import("@tanstack/
|
|
215
|
-
form: import("@tanstack/react-form").AppFieldExtendedReactFieldGroupApi<unknown, TFormData, string | import("@tanstack/
|
|
214
|
+
}, TSubmitMeta, TRenderProps>) => <TFormData, TFields extends import("@tanstack/form-core").DeepKeysOfType<TFormData, TFieldGroupData | null | undefined> | import("@tanstack/form-core").FieldsMap<TFormData, TFieldGroupData>, TOnMount extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnChange extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnChangeAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnBlur extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnBlurAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnSubmit extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnSubmitAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnDynamic extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnDynamicAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnServer extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TFormSubmitMeta>(params: import("react").PropsWithChildren<NoInfer<TRenderProps> & {
|
|
215
|
+
form: import("@tanstack/react-form").AppFieldExtendedReactFieldGroupApi<unknown, TFormData, string | import("@tanstack/form-core").FieldsMap<unknown, TFormData>, any, any, any, any, any, any, any, any, any, any, unknown extends TSubmitMeta ? TFormSubmitMeta : TSubmitMeta, {
|
|
216
216
|
readonly TextField: typeof TextField;
|
|
217
217
|
readonly TextAreaField: typeof TextAreaField;
|
|
218
218
|
readonly SelectField: typeof SelectField;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ComponentProps } from "react";
|
|
2
|
+
import { type CountryCode } from "libphonenumber-js/max";
|
|
3
|
+
import { Input } from "./input.js";
|
|
4
|
+
export type PhoneNumberDetails = {
|
|
5
|
+
e164: string;
|
|
6
|
+
extension: string | null;
|
|
7
|
+
country: CountryCode | null;
|
|
8
|
+
};
|
|
9
|
+
export declare const normalizePhoneNumber: (value: string, country: CountryCode) => PhoneNumberDetails | null;
|
|
10
|
+
export type PhoneNumberInputProps = Omit<ComponentProps<typeof Input>, "value" | "defaultValue" | "onChange" | "type" | "country"> & {
|
|
11
|
+
value: string;
|
|
12
|
+
country: CountryCode;
|
|
13
|
+
onCountryChange: (country: CountryCode) => void;
|
|
14
|
+
onValueChange: (value: string, details: PhoneNumberDetails | null) => void;
|
|
15
|
+
countries?: readonly CountryCode[];
|
|
16
|
+
locale?: string;
|
|
17
|
+
label?: string;
|
|
18
|
+
withExtension?: boolean;
|
|
19
|
+
};
|
|
20
|
+
export declare const PhoneNumberInput: ({ value, country, onCountryChange, onValueChange, countries, locale, label, id, onBlur, name, withExtension, onKeyDown, ...props }: PhoneNumberInputProps) => import("react").JSX.Element;
|