@splenddev/kreativ-ui 0.3.0 → 0.3.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/dist/index.cjs +19012 -1976
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +568 -151
- package/dist/index.d.ts +568 -151
- package/dist/index.js +19216 -2211
- package/dist/index.js.map +1 -1
- package/dist/styles/index.css +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { HTMLAttributes, ReactNode, ButtonHTMLAttributes, CSSProperties, ReactElement,
|
|
3
|
-
import { BaseProps, ColorProps, BaseColor, VariantProps, BaseVariant, DisabledProps, LoadingProps, FullWidthProps, TypographyProps, SizeValue, SizeProps, OrientationProps, Orientation, ThemeTogglerTransition, ClearableProps, UndoRedoProps, ValueProps, StateProps, TrimProps, FormFieldStatus, EmbeddedProps, ValidateProps, Styleable, StatusProps, ControlledProps, Size, ResponsiveValue,
|
|
2
|
+
import { HTMLAttributes, ReactNode, ButtonHTMLAttributes, CSSProperties, ReactElement, ComponentPropsWithoutRef, HTMLInputTypeAttribute, TextareaHTMLAttributes, InputHTMLAttributes, ElementType, LabelHTMLAttributes, JSX, RefObject } from 'react';
|
|
3
|
+
import { BaseProps, ColorProps, BaseColor, VariantProps, BaseVariant, DisabledProps, LoadingProps, FullWidthProps, TypographyProps, SizeValue, SizeProps, OrientationProps, Orientation, ThemeTogglerTransition, ClearableProps, UndoRedoProps, ValueProps, StateProps, TrimProps, FormFieldStatus, ValidateOn, EmbeddedProps, ValidateProps, Styleable as Styleable$1, StatusProps, ControlledProps, Size, ResponsiveValue, RecipeCollection, DeepPartial, DefaultRecipeCollection, ThemeOverride as ThemeOverride$1, Typography, SemanticTokens, DesignTokens, Theme } from '@splenddev/kreativ-core/types';
|
|
4
4
|
export * from '@splenddev/kreativ-core/types';
|
|
5
|
-
import
|
|
6
|
-
|
|
5
|
+
import * as _splenddev_kreativ_core from '@splenddev/kreativ-core';
|
|
6
|
+
import { KuiComponent, BaseProps as BaseProps$1, SizeProps as SizeProps$1, ValueProps as ValueProps$1, VariantProps as VariantProps$1, DisabledProps as DisabledProps$1, ClearableProps as ClearableProps$1, StateProps as StateProps$1, Styleable, FormFieldStatus as FormFieldStatus$1, ThemeOverride, ColorMode } from '@splenddev/kreativ-core';
|
|
7
|
+
export { ThemeContext, defineRecipe, defineSemanticToken, defineSemanticTokens, defineTheme, defineToken, defineTokens, defineTypography, resolveTypography } from '@splenddev/kreativ-core';
|
|
8
|
+
import { z } from 'zod';
|
|
7
9
|
export * from '@splenddev/kreativ-core/hooks';
|
|
8
10
|
import { ClassValue } from 'clsx';
|
|
9
11
|
|
|
@@ -151,104 +153,161 @@ interface ThemeTogglerProps extends Omit<BaseProps, "style">, OrientationProps,
|
|
|
151
153
|
|
|
152
154
|
declare function ThemeToggler({ variant, color, activeVariant, activeColor, size, iconOnly, allowSystem, orientation, rounded, unstyled, labels, icons, className, buttonProps, display, animated, transition, }: ThemeTogglerProps): react.JSX.Element;
|
|
153
155
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
/**
|
|
157
|
+
* Internal. Not part of the public API — do not re-export from the package index.
|
|
158
|
+
* Callers resolve `type` themselves. This function has no password concept.
|
|
159
|
+
*/
|
|
160
|
+
type BaseInputExtraAdornmentContext = {
|
|
161
|
+
iconSize: string | number;
|
|
162
|
+
/** Motion-gated icon-button classes. Transition styles are omitted when motion is off. */
|
|
163
|
+
iconButtonClass: string;
|
|
164
|
+
};
|
|
165
|
+
type BaseInputProps = Omit<ComponentPropsWithoutRef<"input">, "size" | "type"> & BaseProps & SizeProps & VariantProps<InputVariant> & DisabledProps & LoadingProps & FullWidthProps & ClearableProps & UndoRedoProps & ValueProps<string | number> & StateProps & TrimProps & TypographyProps & {
|
|
166
|
+
type: HTMLInputTypeAttribute;
|
|
158
167
|
inputClassName?: string;
|
|
159
|
-
|
|
160
|
-
rounded?: boolean;
|
|
168
|
+
scrollIntoViewOnError?: boolean;
|
|
161
169
|
startIcon?: ReactNode;
|
|
162
170
|
endIcon?: ReactNode;
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
171
|
+
rounded?: boolean;
|
|
172
|
+
motion?: boolean;
|
|
173
|
+
validatePattern?: string | RegExp;
|
|
174
|
+
patternMessage?: string;
|
|
175
|
+
embedded?: boolean;
|
|
176
|
+
extraEndAdornment?: ReactNode | ((ctx: BaseInputExtraAdornmentContext) => ReactNode);
|
|
177
|
+
};
|
|
178
|
+
type InputVariant = "outline" | "filled" | "ghost";
|
|
179
|
+
type InputSize = "xs" | "sm" | "md" | "lg";
|
|
180
|
+
type InputKind = "text" | "email" | "tel" | "url" | "search" | "numeric" | "number" | "date" | "time" | "datetime-local" | "month" | "week";
|
|
181
|
+
type PasswordKind = "password-current" | "password-new";
|
|
182
|
+
type KindDefaultBase = {
|
|
166
183
|
type?: string;
|
|
167
|
-
inputMode?: "none" | "text" | "decimal" | "numeric" | "tel" | "search" | "email" | "url";
|
|
168
184
|
autoComplete?: string;
|
|
169
185
|
placeholder?: string;
|
|
170
186
|
pattern?: string;
|
|
171
187
|
min?: number;
|
|
172
188
|
max?: number;
|
|
173
189
|
step?: number;
|
|
190
|
+
};
|
|
191
|
+
type InputKindDefaults = Record<InputKind, KindDefaultBase & {
|
|
192
|
+
inputMode?: "none" | "text" | "decimal" | "numeric" | "tel" | "search" | "email" | "url";
|
|
174
193
|
}>;
|
|
194
|
+
type PasswordInputKindDefaults = Record<PasswordKind, KindDefaultBase & {
|
|
195
|
+
inputMode?: "none" | "text";
|
|
196
|
+
}>;
|
|
197
|
+
type InputProps = Omit<BaseInputProps, "type" | "extraEndAdornment" | "motion"> & {
|
|
198
|
+
kind?: InputKind;
|
|
199
|
+
hideKindIcon?: boolean;
|
|
200
|
+
type?: HTMLInputTypeAttribute;
|
|
201
|
+
motion?: boolean;
|
|
202
|
+
};
|
|
203
|
+
type PasswordInputProps = Omit<BaseInputProps, "type" | "extraEndAdornment" | "motion"> & {
|
|
204
|
+
motion?: boolean;
|
|
205
|
+
kind?: PasswordKind;
|
|
206
|
+
visible?: boolean;
|
|
207
|
+
defaultVisible?: boolean;
|
|
208
|
+
onVisibleChange?: (visible: boolean) => void;
|
|
209
|
+
};
|
|
175
210
|
|
|
176
|
-
declare const Input:
|
|
211
|
+
declare const Input: _splenddev_kreativ_core.KuiComponent<InputProps, HTMLInputElement>;
|
|
177
212
|
|
|
178
|
-
interface
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
213
|
+
interface FormFieldControlProps {
|
|
214
|
+
children: react.ReactElement;
|
|
215
|
+
}
|
|
216
|
+
declare const FormFieldControl: _splenddev_kreativ_core.KuiComponent<FormFieldControlProps, unknown>;
|
|
217
|
+
|
|
218
|
+
type SingleFormControlComponent<P extends object = any> = KuiComponent<P, any> & {
|
|
219
|
+
__kui: {
|
|
220
|
+
formControl: "single";
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* Forge sets this on a safe, motionGated component at render-start.
|
|
225
|
+
* Data attributes stringify, so both the boolean prop and the "true"
|
|
226
|
+
* attribute count as gated.
|
|
227
|
+
*/
|
|
228
|
+
interface MotionGatedProps {
|
|
229
|
+
"data-kui-motion-gated"?: boolean | "true" | "false";
|
|
230
|
+
}
|
|
231
|
+
type ValuePropConvention = "value" | "checked";
|
|
232
|
+
|
|
233
|
+
interface FormFieldError {
|
|
234
|
+
name: string;
|
|
235
|
+
message: react.ReactNode;
|
|
236
|
+
}
|
|
237
|
+
interface FormFieldMessageProps extends react.HTMLAttributes<HTMLParagraphElement> {
|
|
238
|
+
children?: react.ReactNode;
|
|
239
|
+
forceMount?: boolean;
|
|
240
|
+
"data-kui-motion-gated"?: "true" | "false";
|
|
184
241
|
}
|
|
185
242
|
interface FormFieldMessageProps {
|
|
186
243
|
children?: ReactNode;
|
|
187
244
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
declare namespace FormField {
|
|
191
|
-
var Label: typeof FormFieldLabel;
|
|
192
|
-
var Control: typeof FormFieldControl;
|
|
193
|
-
var Description: typeof FormFieldDescription;
|
|
194
|
-
var Message: typeof FormFieldMessage;
|
|
245
|
+
interface FormFieldLabelProps extends react.LabelHTMLAttributes<HTMLLabelElement> {
|
|
246
|
+
children?: react.ReactNode;
|
|
195
247
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
248
|
+
interface FormFieldDescriptionProps extends react.HTMLAttributes<HTMLParagraphElement> {
|
|
249
|
+
children?: react.ReactNode;
|
|
250
|
+
}
|
|
251
|
+
interface FormFieldRootProps {
|
|
252
|
+
id?: string;
|
|
253
|
+
name?: string;
|
|
254
|
+
status?: FormFieldStatus;
|
|
255
|
+
message?: react.ReactNode;
|
|
256
|
+
required?: boolean;
|
|
257
|
+
disabled?: boolean;
|
|
258
|
+
invalid?: boolean;
|
|
199
259
|
className?: string;
|
|
200
|
-
|
|
260
|
+
children?: react.ReactNode;
|
|
261
|
+
validateOn?: ValidateOn;
|
|
262
|
+
valuePropConvention?: ValuePropConvention;
|
|
263
|
+
}
|
|
264
|
+
interface FormFieldProps$1<P extends object = Record<string, never>> extends Omit<FormFieldRootProps, "children"> {
|
|
265
|
+
as?: SingleFormControlComponent<P>;
|
|
266
|
+
controlProps?: Partial<P>;
|
|
267
|
+
label?: react.ReactNode;
|
|
268
|
+
description?: react.ReactNode;
|
|
269
|
+
message?: react.ReactNode;
|
|
270
|
+
children?: react.ReactNode;
|
|
271
|
+
}
|
|
201
272
|
|
|
202
|
-
declare
|
|
203
|
-
|
|
204
|
-
})
|
|
273
|
+
declare const FormField: (<P extends object>(props: FormFieldProps$1<P> & {
|
|
274
|
+
ref?: react.Ref<unknown>;
|
|
275
|
+
}) => react.ReactElement | null) & {
|
|
276
|
+
Root: _splenddev_kreativ_core.KuiComponent<FormFieldRootProps, HTMLDivElement>;
|
|
277
|
+
Label: _splenddev_kreativ_core.KuiComponent<FormFieldLabelProps, HTMLLabelElement>;
|
|
278
|
+
Description: _splenddev_kreativ_core.KuiComponent<FormFieldDescriptionProps, HTMLParagraphElement>;
|
|
279
|
+
Message: _splenddev_kreativ_core.KuiComponent<FormFieldMessageProps, HTMLParagraphElement>;
|
|
280
|
+
Control: _splenddev_kreativ_core.KuiComponent<FormFieldControlProps, unknown>;
|
|
281
|
+
};
|
|
205
282
|
|
|
206
|
-
declare
|
|
283
|
+
declare const FormFieldLabel: _splenddev_kreativ_core.KuiComponent<FormFieldLabelProps, HTMLLabelElement>;
|
|
207
284
|
|
|
208
|
-
|
|
209
|
-
children: ReactElement<T>;
|
|
210
|
-
};
|
|
211
|
-
declare function FormFieldControl<T = Record<string, unknown>>({ children, }: FormFieldControlProps<T>): react.JSX.Element;
|
|
285
|
+
declare const FormFieldDescription: _splenddev_kreativ_core.KuiComponent<FormFieldDescriptionProps, HTMLParagraphElement>;
|
|
212
286
|
|
|
213
|
-
|
|
214
|
-
|
|
287
|
+
declare const FormFieldMessage: _splenddev_kreativ_core.KuiComponent<FormFieldMessageProps, HTMLParagraphElement>;
|
|
288
|
+
|
|
289
|
+
interface SelectRootProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange" | "children" | "defaultValue">, Omit<BaseProps$1, "children">, Omit<SizeProps$1, "size">, ValueProps$1<string | undefined>, VariantProps$1<InputVariant>, DisabledProps$1, Omit<ClearableProps$1, "onClear">, Omit<StateProps$1, "warning" | "scrollIntoViewOnError"> {
|
|
215
290
|
rounded?: boolean;
|
|
216
|
-
error?: boolean;
|
|
217
|
-
success?: boolean;
|
|
218
|
-
value?: string;
|
|
219
291
|
placeholder?: string;
|
|
220
|
-
defaultValue?: string;
|
|
221
|
-
onValueChange?(value: string | undefined): void;
|
|
222
292
|
required?: boolean;
|
|
223
293
|
name?: string;
|
|
224
|
-
disabled?: boolean;
|
|
225
|
-
clearable?: boolean;
|
|
226
|
-
variant?: InputVariant;
|
|
227
294
|
size?: InputSize;
|
|
228
295
|
children: ReactNode;
|
|
229
296
|
}
|
|
230
|
-
interface SelectTriggerProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "value"
|
|
231
|
-
className?: string;
|
|
297
|
+
interface SelectTriggerProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "value" | "className">, Styleable {
|
|
232
298
|
}
|
|
233
|
-
interface SelectContentProps extends HTMLAttributes<HTMLDivElement
|
|
234
|
-
className?: string;
|
|
299
|
+
interface SelectContentProps extends Omit<HTMLAttributes<HTMLDivElement>, "className">, Styleable {
|
|
235
300
|
}
|
|
236
|
-
interface SelectItemProps extends HTMLAttributes<HTMLDivElement
|
|
301
|
+
interface SelectItemProps extends Omit<HTMLAttributes<HTMLDivElement>, "children" | "className">, DisabledProps$1, Styleable {
|
|
237
302
|
value: string;
|
|
238
|
-
disabled?: boolean;
|
|
239
303
|
children: ReactNode;
|
|
240
304
|
}
|
|
241
|
-
interface SelectValueProps {
|
|
305
|
+
interface SelectValueProps extends Styleable {
|
|
242
306
|
placeholder?: string;
|
|
243
|
-
className?: string;
|
|
244
307
|
}
|
|
245
|
-
interface SelectGroupProps {
|
|
246
|
-
children: ReactNode;
|
|
247
|
-
className?: string;
|
|
308
|
+
interface SelectGroupProps extends Styleable, Required<Pick<BaseProps$1, "children">> {
|
|
248
309
|
}
|
|
249
|
-
interface SelectLabelProps {
|
|
250
|
-
children: ReactNode;
|
|
251
|
-
className?: string;
|
|
310
|
+
interface SelectLabelProps extends Styleable, Required<Pick<BaseProps$1, "children">> {
|
|
252
311
|
}
|
|
253
312
|
|
|
254
313
|
declare function SelectContent({ className, children, ...props }: SelectContentProps): react.JSX.Element;
|
|
@@ -261,18 +320,31 @@ declare function SelectGroup({ children, className }: SelectGroupProps): react.J
|
|
|
261
320
|
|
|
262
321
|
declare function SelectLabel({ children, className }: SelectLabelProps): react.JSX.Element;
|
|
263
322
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
var Label: typeof SelectLabel;
|
|
323
|
+
interface SelectOption {
|
|
324
|
+
value: string;
|
|
325
|
+
label: react.ReactNode;
|
|
326
|
+
disabled?: boolean;
|
|
327
|
+
}
|
|
328
|
+
interface SelectProps extends SelectRootProps {
|
|
329
|
+
options?: SelectOption[];
|
|
272
330
|
}
|
|
331
|
+
declare const Select: react.ForwardRefExoticComponent<SelectProps & react.RefAttributes<HTMLDivElement>> & {
|
|
332
|
+
Root: _splenddev_kreativ_core.KuiComponent<SelectRootProps, HTMLDivElement>;
|
|
333
|
+
Trigger: react.ForwardRefExoticComponent<SelectTriggerProps & react.RefAttributes<HTMLButtonElement>>;
|
|
334
|
+
Content: typeof SelectContent;
|
|
335
|
+
Item: typeof SelectItem;
|
|
336
|
+
Value: typeof SelectValue;
|
|
337
|
+
Group: typeof SelectGroup;
|
|
338
|
+
Label: typeof SelectLabel;
|
|
339
|
+
__kui: {
|
|
340
|
+
formControl: "compound";
|
|
341
|
+
};
|
|
342
|
+
};
|
|
273
343
|
|
|
274
344
|
declare const SelectTrigger: react.ForwardRefExoticComponent<SelectTriggerProps & react.RefAttributes<HTMLButtonElement>>;
|
|
275
345
|
|
|
346
|
+
declare const SelectRoot: _splenddev_kreativ_core.KuiComponent<SelectRootProps, HTMLDivElement>;
|
|
347
|
+
|
|
276
348
|
type MarkdownEditorTabs = "write" | "preview";
|
|
277
349
|
interface MarkdownEditorProps extends Omit<TextareaCoreProps, "resize" | "autoResize"> {
|
|
278
350
|
/** Renders the Preview tab. Omit and Preview shows raw text with a dev warning. */
|
|
@@ -298,11 +370,11 @@ type TextareaProps = ({
|
|
|
298
370
|
allowMarkdown: true;
|
|
299
371
|
} & Omit<TextareaCoreProps, "resize"> & MarkdownEditorProps);
|
|
300
372
|
|
|
301
|
-
declare const Textarea:
|
|
373
|
+
declare const Textarea: _splenddev_kreativ_core.KuiComponent<TextareaProps, HTMLTextAreaElement>;
|
|
302
374
|
|
|
303
375
|
declare const MarkdownEditor: react.ForwardRefExoticComponent<MarkdownEditorProps & react.RefAttributes<HTMLTextAreaElement>>;
|
|
304
376
|
|
|
305
|
-
interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "type" | "checked" | "defaultChecked">, Styleable, StateProps, StatusProps, ControlledProps<boolean, "checked", "defaultChecked", "onCheckedChange"> {
|
|
377
|
+
interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "type" | "checked" | "defaultChecked" | "children">, Styleable$1, StateProps, StatusProps, MotionGatedProps, ControlledProps<boolean, "checked", "defaultChecked", "onCheckedChange"> {
|
|
306
378
|
indeterminate?: boolean;
|
|
307
379
|
size?: InputSize;
|
|
308
380
|
disabled?: boolean;
|
|
@@ -310,17 +382,17 @@ interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "siz
|
|
|
310
382
|
description?: ReactNode;
|
|
311
383
|
}
|
|
312
384
|
|
|
313
|
-
declare const Checkbox:
|
|
385
|
+
declare const Checkbox: _splenddev_kreativ_core.KuiComponent<CheckboxProps, HTMLInputElement>;
|
|
314
386
|
|
|
315
387
|
type RadioSize = "sm" | "md" | "lg";
|
|
316
|
-
interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "type" | "checked" | "defaultChecked" | "onChange" | "name" | "value">, Styleable {
|
|
388
|
+
interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "type" | "checked" | "defaultChecked" | "onChange" | "name" | "value">, Styleable$1 {
|
|
317
389
|
value: string;
|
|
318
390
|
disabled?: boolean;
|
|
319
391
|
label?: ReactNode;
|
|
320
392
|
description?: ReactNode;
|
|
321
393
|
}
|
|
322
394
|
|
|
323
|
-
interface RadioGroupProps extends Styleable {
|
|
395
|
+
interface RadioGroupProps extends Styleable$1 {
|
|
324
396
|
value?: string;
|
|
325
397
|
defaultValue?: string;
|
|
326
398
|
onValueChange?: (value: string) => void;
|
|
@@ -339,7 +411,7 @@ declare function RadioGroup({ value: valueProp, defaultValue, onValueChange, nam
|
|
|
339
411
|
declare function Radio({ value, disabled: itemDisabled, label, description, className, ...props }: RadioProps): react.JSX.Element;
|
|
340
412
|
|
|
341
413
|
type SwitchSize = "xs" | "sm" | "md" | "lg";
|
|
342
|
-
interface SwitchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "type" | "checked" | "defaultChecked">, Styleable {
|
|
414
|
+
interface SwitchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "type" | "checked" | "defaultChecked">, Styleable$1 {
|
|
343
415
|
checked?: boolean;
|
|
344
416
|
defaultChecked?: boolean;
|
|
345
417
|
onCheckedChange?: (checked: boolean) => void;
|
|
@@ -350,7 +422,7 @@ interface SwitchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size"
|
|
|
350
422
|
description?: ReactNode;
|
|
351
423
|
}
|
|
352
424
|
|
|
353
|
-
declare const Switch:
|
|
425
|
+
declare const Switch: _splenddev_kreativ_core.KuiComponent<SwitchProps & MotionGatedProps, HTMLInputElement>;
|
|
354
426
|
|
|
355
427
|
interface ComboboxProps extends Omit<BaseProps, "unstyled">, ValueProps<string | undefined>, ControlledProps<string | undefined, "inputValue", "defaultInputValue", "onInputChange">, DisabledProps, VariantProps<BaseVariant>, SizeProps, ClearableProps, StatusProps, StateProps {
|
|
356
428
|
required?: boolean;
|
|
@@ -399,7 +471,7 @@ declare namespace Combobox {
|
|
|
399
471
|
|
|
400
472
|
declare const ComboboxInput: react.ForwardRefExoticComponent<ComboboxInputProps & react.RefAttributes<HTMLInputElement>>;
|
|
401
473
|
|
|
402
|
-
interface MultiSelectProps extends Styleable {
|
|
474
|
+
interface MultiSelectProps extends Styleable$1 {
|
|
403
475
|
value?: string[];
|
|
404
476
|
defaultValue?: string[];
|
|
405
477
|
onValueChange?: (value: string[]) => void;
|
|
@@ -443,6 +515,407 @@ declare const MultiSelectTrigger: react.ForwardRefExoticComponent<{
|
|
|
443
515
|
className?: string;
|
|
444
516
|
} & react.RefAttributes<HTMLButtonElement>>;
|
|
445
517
|
|
|
518
|
+
type FormValues = Record<string, unknown>;
|
|
519
|
+
type FormErrors = Record<string, react.ReactNode | undefined>;
|
|
520
|
+
interface FormContextValue {
|
|
521
|
+
values: FormValues;
|
|
522
|
+
isSubmitting: boolean;
|
|
523
|
+
isDirty: boolean;
|
|
524
|
+
schema: unknown;
|
|
525
|
+
setValue: (name: string, value: unknown) => void;
|
|
526
|
+
getValue: (name: string) => unknown;
|
|
527
|
+
setFieldError: (name: string, message: react.ReactNode | undefined) => void;
|
|
528
|
+
registerField: (name: string, element: HTMLElement | null) => void;
|
|
529
|
+
submit: () => void;
|
|
530
|
+
reset: () => void;
|
|
531
|
+
errors: FormErrors;
|
|
532
|
+
errorList: FormFieldError[];
|
|
533
|
+
}
|
|
534
|
+
declare function useFormContext(): FormContextValue | null;
|
|
535
|
+
|
|
536
|
+
interface SchemaLike {
|
|
537
|
+
safeParse: (values: FormValues) => {
|
|
538
|
+
success: true;
|
|
539
|
+
data: FormValues;
|
|
540
|
+
} | {
|
|
541
|
+
success: false;
|
|
542
|
+
error: {
|
|
543
|
+
issues: Array<{
|
|
544
|
+
path: PropertyKey[];
|
|
545
|
+
message: string;
|
|
546
|
+
}>;
|
|
547
|
+
};
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
type ManualValidator = (values: FormValues) => FormErrors | undefined | Promise<FormErrors | undefined>;
|
|
551
|
+
interface FormRootProps {
|
|
552
|
+
schema?: SchemaLike;
|
|
553
|
+
validate?: ManualValidator;
|
|
554
|
+
defaultValues?: FormValues;
|
|
555
|
+
onSubmit?: (values: FormValues) => void | Promise<void>;
|
|
556
|
+
onSubmitCapture?: (event: react.FormEvent<HTMLFormElement>) => void;
|
|
557
|
+
scrollToFirstOnError?: boolean;
|
|
558
|
+
className?: string;
|
|
559
|
+
children: react.ReactNode;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
interface FormSubmitButtonProps {
|
|
563
|
+
children: react.ReactElement;
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* asChild-style: injects type="submit" + disabled (while invalid or
|
|
567
|
+
* submitting) + aria-busy (while submitting) onto the supplied child.
|
|
568
|
+
* Owns no visual content/spinner of its own — pending state is
|
|
569
|
+
* exposed for the child's own Button to react to.
|
|
570
|
+
*
|
|
571
|
+
* Not a createComponent. It renders no DOM node of its own; the ref is
|
|
572
|
+
* forwarded onto the child. Submit is a one-shot action and is not a
|
|
573
|
+
* video.controlled value.
|
|
574
|
+
*/
|
|
575
|
+
declare const FormSubmitButton: react.ForwardRefExoticComponent<FormSubmitButtonProps & react.RefAttributes<unknown>>;
|
|
576
|
+
interface FormResetButtonProps {
|
|
577
|
+
children: react.ReactElement;
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* asChild-style: injects type="button" + an internal reset handler
|
|
581
|
+
* (native type="reset" isn't used since Form's values are
|
|
582
|
+
* controlled/context-owned, not native-form-reset-compatible) +
|
|
583
|
+
* disabled gated on isDirty rather than validity — resetting an
|
|
584
|
+
* invalid, untouched form is a no-op state that should read as
|
|
585
|
+
* disabled; resetting a dirty form should be available regardless of
|
|
586
|
+
* validity.
|
|
587
|
+
*
|
|
588
|
+
* Not a createComponent. Same reason as FormSubmitButton. Reset is a
|
|
589
|
+
* one-shot action and is not a video.controlled value.
|
|
590
|
+
*/
|
|
591
|
+
declare const FormResetButton: react.ForwardRefExoticComponent<FormResetButtonProps & react.RefAttributes<unknown>>;
|
|
592
|
+
|
|
593
|
+
interface NumberStepperValidationResult {
|
|
594
|
+
valid: boolean;
|
|
595
|
+
value: number | null;
|
|
596
|
+
errors: Array<"required" | "invalid" | "min" | "max" | "step">;
|
|
597
|
+
}
|
|
598
|
+
type NumberStepperClampOn = "change" | "blur" | "commit" | "never";
|
|
599
|
+
type NumberStepperButtonLayout = "vertical" | "horizontal";
|
|
600
|
+
interface NumberStepperProps {
|
|
601
|
+
value?: number;
|
|
602
|
+
defaultValue?: number;
|
|
603
|
+
onValueChange?: BaseInputProps["onValueChange"];
|
|
604
|
+
min?: number;
|
|
605
|
+
max?: number;
|
|
606
|
+
step?: number;
|
|
607
|
+
precision?: number;
|
|
608
|
+
variant?: InputVariant;
|
|
609
|
+
error?: boolean;
|
|
610
|
+
success?: boolean;
|
|
611
|
+
rounded?: boolean;
|
|
612
|
+
fullWidth?: boolean;
|
|
613
|
+
clampOn?: NumberStepperClampOn;
|
|
614
|
+
onValidate?: (result: NumberStepperValidationResult) => void;
|
|
615
|
+
buttonLayout?: NumberStepperButtonLayout;
|
|
616
|
+
disabled?: boolean;
|
|
617
|
+
required?: boolean;
|
|
618
|
+
name?: string;
|
|
619
|
+
size?: "sm" | "md" | "lg";
|
|
620
|
+
className?: string;
|
|
621
|
+
style?: react.CSSProperties;
|
|
622
|
+
"aria-label"?: string;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
interface ComponentPropsMap {
|
|
626
|
+
input: InputProps;
|
|
627
|
+
select: SelectProps;
|
|
628
|
+
switch: SwitchProps;
|
|
629
|
+
textarea: TextareaProps;
|
|
630
|
+
checkbox: CheckboxProps;
|
|
631
|
+
'number-stepper': NumberStepperProps;
|
|
632
|
+
}
|
|
633
|
+
type ComponentKey = keyof ComponentPropsMap;
|
|
634
|
+
|
|
635
|
+
interface FormControlProps {
|
|
636
|
+
id: string;
|
|
637
|
+
"aria-invalid": boolean | undefined;
|
|
638
|
+
"aria-required": boolean | undefined;
|
|
639
|
+
"aria-describedby": string | undefined;
|
|
640
|
+
disabled: boolean;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
interface KuiFormControlValueProps<T = unknown> {
|
|
644
|
+
value?: T;
|
|
645
|
+
onValueChange: (value: T) => void;
|
|
646
|
+
}
|
|
647
|
+
type KuiFormControlComponent<P extends KuiFormControlValueProps<any> = KuiFormControlValueProps<any>> = react.ComponentType<P> & {
|
|
648
|
+
__kui: {
|
|
649
|
+
formControl: "single" | "compound";
|
|
650
|
+
};
|
|
651
|
+
};
|
|
652
|
+
interface FieldState {
|
|
653
|
+
error?: react.ReactNode;
|
|
654
|
+
invalid: boolean;
|
|
655
|
+
isDirty: boolean;
|
|
656
|
+
}
|
|
657
|
+
interface FieldApi<T = unknown> {
|
|
658
|
+
value: T;
|
|
659
|
+
onChange: (value: T) => void;
|
|
660
|
+
onBlur: () => void;
|
|
661
|
+
name: string;
|
|
662
|
+
}
|
|
663
|
+
type CustomFieldRenderer<T = unknown> = (args: {
|
|
664
|
+
field: FieldApi<T>;
|
|
665
|
+
fieldState: FieldState;
|
|
666
|
+
controlProps: FormControlProps;
|
|
667
|
+
}) => react.ReactNode;
|
|
668
|
+
interface FormFieldProps {
|
|
669
|
+
tone?: "default" | "warning" | "info";
|
|
670
|
+
orientation?: "vertical" | "horizontal";
|
|
671
|
+
}
|
|
672
|
+
interface UISectionSchema {
|
|
673
|
+
label?: react.ReactNode;
|
|
674
|
+
description?: react.ReactNode;
|
|
675
|
+
fields: string[];
|
|
676
|
+
layout?: string;
|
|
677
|
+
columns?: string;
|
|
678
|
+
order?: number;
|
|
679
|
+
}
|
|
680
|
+
interface UIFieldSchemaWidgetKey<K extends ComponentKey = ComponentKey> extends UIFieldSchemaBase {
|
|
681
|
+
widget: K;
|
|
682
|
+
props?: Partial<ComponentPropsMap[K]>;
|
|
683
|
+
render?: never;
|
|
684
|
+
}
|
|
685
|
+
interface UIFieldSchemaWidgetComponent<P extends KuiFormControlValueProps = KuiFormControlValueProps> extends UIFieldSchemaBase {
|
|
686
|
+
widget: KuiFormControlComponent<P>;
|
|
687
|
+
props?: Partial<P>;
|
|
688
|
+
render?: never;
|
|
689
|
+
}
|
|
690
|
+
interface UIFieldSchemaWidgetInferred extends UIFieldSchemaBase {
|
|
691
|
+
widget?: never;
|
|
692
|
+
props?: never;
|
|
693
|
+
render?: never;
|
|
694
|
+
}
|
|
695
|
+
interface UIFieldSchemaRender<T = unknown> extends UIFieldSchemaBase {
|
|
696
|
+
widget?: never;
|
|
697
|
+
props?: never;
|
|
698
|
+
render: CustomFieldRenderer<T>;
|
|
699
|
+
}
|
|
700
|
+
interface UIFieldSchemaBase {
|
|
701
|
+
label?: react.ReactNode;
|
|
702
|
+
description?: react.ReactNode;
|
|
703
|
+
order?: number;
|
|
704
|
+
hidden?: boolean;
|
|
705
|
+
formField?: FormFieldProps;
|
|
706
|
+
}
|
|
707
|
+
interface UIFieldSchemaBase {
|
|
708
|
+
label?: react.ReactNode;
|
|
709
|
+
description?: react.ReactNode;
|
|
710
|
+
order?: number;
|
|
711
|
+
hidden?: boolean;
|
|
712
|
+
formField?: FormFieldProps;
|
|
713
|
+
/**
|
|
714
|
+
* CSS `grid-area` name used to place this field inside a `$sections`
|
|
715
|
+
* grid. Only honored for leaf fields (widgets, inferred, custom
|
|
716
|
+
* renderers) — object and array groups ignore it. When the field is
|
|
717
|
+
* claimed by a section, the section's own `layout` grid takes precedence.
|
|
718
|
+
*/
|
|
719
|
+
gridArea?: string;
|
|
720
|
+
}
|
|
721
|
+
type UIFieldSchema<K extends ComponentKey = ComponentKey, P extends KuiFormControlValueProps = KuiFormControlValueProps, T = unknown> = UIFieldSchemaWidgetKey<K> | UIFieldSchemaWidgetComponent<P> | UIFieldSchemaWidgetInferred | UIFieldSchemaRender<T>;
|
|
722
|
+
type UIFieldSchemaFor<V> = V extends Array<infer Item> ? UIArraySchemaFor<Item> : V extends object ? UIObjectSchemaForShape<V> | UIFieldSchema<ComponentKey, any, V> : UIFieldSchema<ComponentKey, any, V>;
|
|
723
|
+
type UIObjectSchema = {
|
|
724
|
+
[key: string]: UIFieldSchema | UIObjectSchema | UIArraySchema;
|
|
725
|
+
} & {
|
|
726
|
+
$sections?: UISectionSchema[];
|
|
727
|
+
};
|
|
728
|
+
interface UIArraySchema {
|
|
729
|
+
label?: react.ReactNode;
|
|
730
|
+
description?: react.ReactNode;
|
|
731
|
+
item: UIFieldSchema | UIObjectSchema;
|
|
732
|
+
addLabel?: react.ReactNode;
|
|
733
|
+
itemLabel?: string;
|
|
734
|
+
removable?: boolean;
|
|
735
|
+
reorderable?: boolean;
|
|
736
|
+
/**
|
|
737
|
+
* CSS `grid-area` name used to place this field inside a `$sections`
|
|
738
|
+
* grid. Only honored for leaf fields (widgets, inferred, custom
|
|
739
|
+
* renderers) — object and array groups ignore it. When the field is
|
|
740
|
+
* claimed by a section, the section's own `layout` grid takes precedence.
|
|
741
|
+
*/
|
|
742
|
+
gridArea?: string;
|
|
743
|
+
}
|
|
744
|
+
type UIObjectSchemaFor<Schema extends z.ZodObject<any>> = {
|
|
745
|
+
[K in keyof z.infer<Schema>]?: UIFieldSchemaFor<z.infer<Schema>[K]>;
|
|
746
|
+
} & {
|
|
747
|
+
$sections?: UISectionSchema[];
|
|
748
|
+
};
|
|
749
|
+
type UIObjectSchemaForShape<V> = {
|
|
750
|
+
[K in keyof V]?: UIFieldSchemaFor<V[K]>;
|
|
751
|
+
};
|
|
752
|
+
type UIArraySchemaFor<Item> = {
|
|
753
|
+
label?: react.ReactNode;
|
|
754
|
+
description?: react.ReactNode;
|
|
755
|
+
item: UIFieldSchemaFor<Item>;
|
|
756
|
+
addLabel?: react.ReactNode;
|
|
757
|
+
itemLabel?: string;
|
|
758
|
+
removable?: boolean;
|
|
759
|
+
reorderable?: boolean;
|
|
760
|
+
/**
|
|
761
|
+
* CSS `grid-area` name used to place this field inside a `$sections`
|
|
762
|
+
* grid. Only honored for leaf fields (widgets, inferred, custom
|
|
763
|
+
* renderers) — object and array groups ignore it. When the field is
|
|
764
|
+
* claimed by a section, the section's own `layout` grid takes precedence.
|
|
765
|
+
*/
|
|
766
|
+
gridArea?: string;
|
|
767
|
+
};
|
|
768
|
+
/**
|
|
769
|
+
* Object schema shape with unconstrained keys.
|
|
770
|
+
*
|
|
771
|
+
* @deprecated Use {@link UIObjectSchemaFor} for strict, Zod-inferred key and
|
|
772
|
+
* widget checking. `UIObjectSchema` accepts any string key and any
|
|
773
|
+
* `UIFieldSchema`, so it won't catch typos or wrong widget names — it exists
|
|
774
|
+
* only as the fallback shape when no Zod schema is in scope (e.g. inside a
|
|
775
|
+
* `<Form>` when `Schema` isn't supplied as a type argument). Prefer typing
|
|
776
|
+
* `uiSchema` against the inferred shape:
|
|
777
|
+
*
|
|
778
|
+
* @example
|
|
779
|
+
* const ui: UIObjectSchemaFor<typeof profileSchema> = { ... };
|
|
780
|
+
*/
|
|
781
|
+
type UISchema = UIObjectSchema;
|
|
782
|
+
|
|
783
|
+
/**
|
|
784
|
+
* Props for using Form.FromSchema inside a parent `<Form schema={...}>`.
|
|
785
|
+
* The schema comes from context, so `schema` is typed `never` here — passing
|
|
786
|
+
* one is a compile error rather than a silent override.
|
|
787
|
+
*/
|
|
788
|
+
interface FormFromSchemaContextProps<Schema extends z.ZodObject<any>> {
|
|
789
|
+
/**
|
|
790
|
+
* Zod object schema to generate fields from. When omitted, the enclosing
|
|
791
|
+
* `<Form>`'s schema is used. Providing it here also drives inference of
|
|
792
|
+
* `Schema` for `uiSchema`.
|
|
793
|
+
*/
|
|
794
|
+
uiSchema?: UIObjectSchemaFor<Schema>;
|
|
795
|
+
/**
|
|
796
|
+
* Presentation overlay keyed by the schema's field names. When `Schema`
|
|
797
|
+
* is known, keys and per-field props are checked against the inferred
|
|
798
|
+
* shape; otherwise keys are unconstrained.
|
|
799
|
+
*/
|
|
800
|
+
schema?: never;
|
|
801
|
+
}
|
|
802
|
+
/**
|
|
803
|
+
* Props for using Form.FromSchema on its own, with `schema` passed directly.
|
|
804
|
+
*/
|
|
805
|
+
interface FormFromSchemaStandaloneProps<Schema extends z.ZodObject<any>> {
|
|
806
|
+
/**
|
|
807
|
+
* Zod object schema to generate fields from. When omitted, the enclosing
|
|
808
|
+
* `<Form>`'s schema is used. Providing it here also drives inference of
|
|
809
|
+
* `Schema` for `uiSchema`.
|
|
810
|
+
*/
|
|
811
|
+
uiSchema?: UIObjectSchemaFor<Schema>;
|
|
812
|
+
/**
|
|
813
|
+
* Presentation overlay keyed by the schema's field names. When `Schema`
|
|
814
|
+
* is known, keys and per-field props are checked against the inferred
|
|
815
|
+
* shape; otherwise keys are unconstrained.
|
|
816
|
+
*/
|
|
817
|
+
schema: Schema;
|
|
818
|
+
}
|
|
819
|
+
/**
|
|
820
|
+
* Props for `<Form.FromSchema>`.
|
|
821
|
+
*
|
|
822
|
+
* `Schema` is inferred from the `schema` prop in standalone mode; when used
|
|
823
|
+
* inside a `<Form>`, supply it explicitly as a type argument to get
|
|
824
|
+
* key-checking on `uiSchema`. Otherwise `uiSchema` falls back to the
|
|
825
|
+
* unconstrained `UIObjectSchema` shape.
|
|
826
|
+
*
|
|
827
|
+
* ### Strict vs. loose `uiSchema` typing
|
|
828
|
+
*
|
|
829
|
+
* - **Strict**: type `uiSchema` as `UIObjectSchemaFor<typeof schema>` (or let
|
|
830
|
+
* it be inferred by passing `schema` directly). Keys, nested field names,
|
|
831
|
+
* widget keys, and per-field `props` are all checked against the Zod
|
|
832
|
+
* output. This is what you want almost everywhere.
|
|
833
|
+
* - **Loose**: `UIObjectSchema` / `UISchema`. Any string key, any
|
|
834
|
+
* `UIFieldSchema`. Used only as the fallback when `Schema` can't be
|
|
835
|
+
* inferred (e.g. `<Form.FromSchema uiSchema={...} />` inside a `<Form>`).
|
|
836
|
+
* Wrong keys, misspelled widgets, and mismatched `props` all type-check.
|
|
837
|
+
*
|
|
838
|
+
* `UISchema` is deprecated for this reason — reach for `UIObjectSchemaFor`
|
|
839
|
+
* whenever you have a Zod schema available.
|
|
840
|
+
*/
|
|
841
|
+
type FormFromSchemaProps<Schema extends z.ZodObject<any> = z.ZodObject<any>> = FormFromSchemaContextProps<Schema> | FormFromSchemaStandaloneProps<Schema>;
|
|
842
|
+
/**
|
|
843
|
+
* Generates a set of fields from a Zod object schema.
|
|
844
|
+
*
|
|
845
|
+
* Write the shape once in Zod, optionally layer presentation on top with a
|
|
846
|
+
* `uiSchema`, and skip writing a `<Field>` for every property. Fields you
|
|
847
|
+
* don't mention in `uiSchema` still render — the generator picks a widget
|
|
848
|
+
* based on the Zod type. Use `uiSchema` only for the ones you want to
|
|
849
|
+
* override.
|
|
850
|
+
*
|
|
851
|
+
* `Schema` is inferred automatically when you pass `schema` directly
|
|
852
|
+
* (standalone mode) — `uiSchema`'s keys are checked against that schema's
|
|
853
|
+
* shape with no extra annotation needed. Inside a `<Form>`, there's no
|
|
854
|
+
* `schema` prop for inference to key off, so `Schema` must be supplied
|
|
855
|
+
* explicitly as a type argument for `uiSchema` to get the same
|
|
856
|
+
* key-checking; omitted, it falls back to the unconstrained shape.
|
|
857
|
+
*
|
|
858
|
+
* Schema resolution, in order:
|
|
859
|
+
* 1. The `schema` prop, if you passed one.
|
|
860
|
+
* 2. The enclosing `<Form>`'s schema, if there is one.
|
|
861
|
+
*
|
|
862
|
+
* If neither exists, or the result isn't a `z.object({...})`, this throws.
|
|
863
|
+
* Errors are prefixed `[kreativ-ui/Form.FromSchema]` so they're easy to
|
|
864
|
+
* grep for.
|
|
865
|
+
*
|
|
866
|
+
* Renders a fragment — no wrapper element — so the fields land directly
|
|
867
|
+
* inside whatever container you put this in.
|
|
868
|
+
*
|
|
869
|
+
* @example
|
|
870
|
+
* // Schema from context — Schema isn't inferable here, so uiSchema is
|
|
871
|
+
* // checked against profileSchema only if you supply the type argument:
|
|
872
|
+
* <Form schema={profileSchema}>
|
|
873
|
+
* <Form.FromSchema<typeof profileSchema> uiSchema={profileUiSchema} />
|
|
874
|
+
* </Form>
|
|
875
|
+
*
|
|
876
|
+
* @example
|
|
877
|
+
* // Schema passed in — Schema is inferred from `schema`, uiSchema is
|
|
878
|
+
* // checked automatically, no type argument needed:
|
|
879
|
+
* <Form.FromSchema schema={profileSchema} uiSchema={profileUiSchema} />
|
|
880
|
+
*/
|
|
881
|
+
declare function FormFromSchema<Schema extends z.ZodObject<any> = z.ZodObject<any>>({ uiSchema, schema: standaloneSchema }: FormFromSchemaProps<Schema>): react.JSX.Element;
|
|
882
|
+
|
|
883
|
+
declare function defineUIField<K extends ComponentKey>(field: UIFieldSchemaWidgetKey<K>): UIFieldSchemaWidgetKey<K>;
|
|
884
|
+
declare function defineUIField<P extends KuiFormControlValueProps<any>>(field: UIFieldSchemaWidgetComponent<P>): UIFieldSchemaWidgetComponent<P>;
|
|
885
|
+
declare function defineUIField(field: UIFieldSchemaWidgetInferred): UIFieldSchemaWidgetInferred;
|
|
886
|
+
declare function defineUIField<T>(field: UIFieldSchemaRender<T>): UIFieldSchemaRender<T>;
|
|
887
|
+
|
|
888
|
+
/**
|
|
889
|
+
* Form owns real orchestration, not a thin semantic <form> wrapper —
|
|
890
|
+
* submit handling, validation orchestration across its FormFields,
|
|
891
|
+
* and error aggregation are all Form's responsibility. It provides a
|
|
892
|
+
* FormContext that FormField reads to auto-wire validation/errors/
|
|
893
|
+
* disabled state.
|
|
894
|
+
*
|
|
895
|
+
* Usage:
|
|
896
|
+
* ```tsx
|
|
897
|
+
* <Form schema={zodSchema} onSubmit={handleSubmit}>
|
|
898
|
+
* <FormField name="email" as={Input} label="Email" />
|
|
899
|
+
* <Form.SubmitButton><Button>Submit</Button></Form.SubmitButton>
|
|
900
|
+
* </Form>
|
|
901
|
+
*```
|
|
902
|
+
* Or, schema-driven field generation:
|
|
903
|
+
* ```tsx
|
|
904
|
+
* <Form schema={zodSchema} onSubmit={handleSubmit}>
|
|
905
|
+
* <Form.FromSchema uiSchema={uiSchema} />
|
|
906
|
+
* <Form.SubmitButton><Button>Submit</Button></Form.SubmitButton>
|
|
907
|
+
* </Form>
|
|
908
|
+
* ```
|
|
909
|
+
*/
|
|
910
|
+
declare const Form: react.ForwardRefExoticComponent<FormRootProps & react.RefAttributes<HTMLFormElement>> & {
|
|
911
|
+
__kui: _splenddev_kreativ_core.KuiMeta<FormRootProps>;
|
|
912
|
+
providerRequired?: _splenddev_kreativ_core.KuiProviderRequirement;
|
|
913
|
+
} & {
|
|
914
|
+
SubmitButton: react.ForwardRefExoticComponent<FormSubmitButtonProps & react.RefAttributes<unknown>>;
|
|
915
|
+
ResetButton: react.ForwardRefExoticComponent<FormResetButtonProps & react.RefAttributes<unknown>>;
|
|
916
|
+
FromSchema: typeof FormFromSchema;
|
|
917
|
+
};
|
|
918
|
+
|
|
446
919
|
interface ContainerProps extends BaseProps {
|
|
447
920
|
/**
|
|
448
921
|
* Max-width of the container, mapped to the Container recipe's `size` variant.
|
|
@@ -562,15 +1035,14 @@ interface CardFooterProps extends ComponentPropsWithoutRef<"div"> {
|
|
|
562
1035
|
children?: ReactNode;
|
|
563
1036
|
}
|
|
564
1037
|
|
|
565
|
-
declare
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
declare function CardFooter({ className, children, ...props }: CardFooterProps): react.JSX.Element;
|
|
1038
|
+
declare const Card: react.ForwardRefExoticComponent<CardProps & react.RefAttributes<HTMLDivElement>> & {
|
|
1039
|
+
__kui: _splenddev_kreativ_core.KuiMeta<CardProps>;
|
|
1040
|
+
providerRequired?: _splenddev_kreativ_core.KuiProviderRequirement;
|
|
1041
|
+
} & {
|
|
1042
|
+
Header: _splenddev_kreativ_core.KuiComponent<CardHeaderProps, HTMLDivElement>;
|
|
1043
|
+
Body: _splenddev_kreativ_core.KuiComponent<CardBodyProps, HTMLDivElement>;
|
|
1044
|
+
Footer: _splenddev_kreativ_core.KuiComponent<CardFooterProps, HTMLDivElement>;
|
|
1045
|
+
};
|
|
574
1046
|
|
|
575
1047
|
type SkeletonShape = {
|
|
576
1048
|
rows?: number;
|
|
@@ -728,10 +1200,10 @@ interface UIProviderProps {
|
|
|
728
1200
|
defaultMode?: ColorMode;
|
|
729
1201
|
as?: keyof JSX.IntrinsicElements;
|
|
730
1202
|
fallbackSize?: string;
|
|
731
|
-
|
|
732
|
-
|
|
1203
|
+
background?: string;
|
|
1204
|
+
textColor?: string;
|
|
733
1205
|
}
|
|
734
|
-
declare function
|
|
1206
|
+
declare function KreativUIProvider({ children, theme: themeOverride, defaultMode, as, fallbackSize, textColor, background, }: UIProviderProps): JSX.Element;
|
|
735
1207
|
|
|
736
1208
|
declare function useFloatingSide(triggerRef: RefObject<HTMLElement | null>, open: boolean): {
|
|
737
1209
|
contentRef: RefObject<HTMLDivElement | null>;
|
|
@@ -739,7 +1211,9 @@ declare function useFloatingSide(triggerRef: RefObject<HTMLElement | null>, open
|
|
|
739
1211
|
};
|
|
740
1212
|
|
|
741
1213
|
type TransitionStatus = Exclude<FormFieldStatus, "none"> | undefined;
|
|
742
|
-
declare function useStatusTransition(status: FormFieldStatus
|
|
1214
|
+
declare function useStatusTransition(status: FormFieldStatus, options?: {
|
|
1215
|
+
enabled?: boolean;
|
|
1216
|
+
}): TransitionStatus;
|
|
743
1217
|
|
|
744
1218
|
type ClearableFieldOptions = {
|
|
745
1219
|
onClear?: () => void;
|
|
@@ -776,8 +1250,6 @@ declare function cn(...inputs: ClassValue[]): string;
|
|
|
776
1250
|
declare function rgbToHex(value: string): string;
|
|
777
1251
|
declare function hexToRgbString(hex: string): string | null;
|
|
778
1252
|
|
|
779
|
-
declare function defineRecipe<T extends RecipeDefinition>(recipe: T): T;
|
|
780
|
-
|
|
781
1253
|
/**
|
|
782
1254
|
* Overrides a single component's recipe against the built-in default
|
|
783
1255
|
* for that component. For overriding just one recipe inline, without
|
|
@@ -793,66 +1265,11 @@ declare function extendRecipes(override?: DeepPartial<RecipeCollection>): Recipe
|
|
|
793
1265
|
|
|
794
1266
|
declare function getRecipeNames(): (keyof DefaultRecipeCollection)[];
|
|
795
1267
|
|
|
796
|
-
declare function defineTypography<T extends Typography>(typography: T): T;
|
|
797
|
-
|
|
798
1268
|
declare function extendTypography(override?: ThemeOverride$1["typography"]): Typography;
|
|
799
1269
|
|
|
800
|
-
declare function defineToken<T extends TokenValue>(value: T): {
|
|
801
|
-
value: T;
|
|
802
|
-
};
|
|
803
|
-
declare function defineTokens<T extends Record<string, TokenValue>>(tokens: T): { [K in keyof T]: ReturnType<typeof defineToken<T[K]>>; };
|
|
804
|
-
/**
|
|
805
|
-
* Defines a semantic token that shares a single value across both light and dark modes.
|
|
806
|
-
*/
|
|
807
|
-
declare function defineSemanticToken<T extends TokenValue>(value: T): SemanticToken<T>;
|
|
808
|
-
declare function defineSemanticToken<T extends TokenValue>(light: T, dark: T): SemanticToken<T>;
|
|
809
|
-
type SemanticTokenInput<T extends TokenValue> = T | {
|
|
810
|
-
light: T;
|
|
811
|
-
dark: T;
|
|
812
|
-
};
|
|
813
|
-
declare function defineSemanticTokens<T extends Record<string, SemanticTokenInput<TokenValue>>>(tokens: T): {
|
|
814
|
-
[K in keyof T]: SemanticToken<T[K] extends {
|
|
815
|
-
light: infer V;
|
|
816
|
-
dark: infer _;
|
|
817
|
-
} ? V extends TokenValue ? V : never : T[K] extends TokenValue ? T[K] : never>;
|
|
818
|
-
};
|
|
819
|
-
|
|
820
1270
|
declare function extendTokens(override?: ThemeOverride$1["tokens"]): DesignTokens;
|
|
821
1271
|
declare function extendSemanticTokens(override?: ThemeOverride$1["semanticTokens"]): SemanticTokens;
|
|
822
1272
|
|
|
823
1273
|
declare function extendTheme(override?: ThemeOverride$1): Theme;
|
|
824
1274
|
|
|
825
|
-
|
|
826
|
-
* Defines a Kreativ UI theme.
|
|
827
|
-
*
|
|
828
|
-
* This function provides a type-safe boundary for creating themes while
|
|
829
|
-
* preserving the exact structure and types of the supplied theme.
|
|
830
|
-
*
|
|
831
|
-
* It does not merge with the default theme or mutate the provided object.
|
|
832
|
-
* Theme extension and resolution are handled separately.
|
|
833
|
-
*
|
|
834
|
-
* @example
|
|
835
|
-
* ```ts
|
|
836
|
-
* export const myTheme = defineTheme({
|
|
837
|
-
* tokens: {
|
|
838
|
-
* // ...
|
|
839
|
-
* },
|
|
840
|
-
* semanticTokens: {
|
|
841
|
-
* // ...
|
|
842
|
-
* },
|
|
843
|
-
* typography: {
|
|
844
|
-
* // ...
|
|
845
|
-
* },
|
|
846
|
-
* recipes: {
|
|
847
|
-
* // ...
|
|
848
|
-
* },
|
|
849
|
-
* intensity: 50,
|
|
850
|
-
* sizes: {
|
|
851
|
-
* // ...
|
|
852
|
-
* },
|
|
853
|
-
* });
|
|
854
|
-
* ```
|
|
855
|
-
*/
|
|
856
|
-
declare function defineTheme<T extends Theme>(theme: T): T;
|
|
857
|
-
|
|
858
|
-
export { Adornment, type AdornmentProps, Button, ButtonGroup, ButtonGroupContext, type ButtonGroupContextValue, ButtonGroupItemContext, type ButtonGroupItemContextValue, type ButtonGroupItemProps, type ButtonGroupLabelProps, type ButtonGroupProps, type ButtonGroupSeparatorProps, type ButtonGroupSpacing, type ButtonGroupTextProps, type ButtonProps, Card, type CardBodyProps, type CardFooterProps, type CardHeaderProps, type CardProps, type CardSize, type CardVariant, Checkbox, type CheckboxProps, Combobox, ComboboxContent, ComboboxInput, type ComboboxInputProps, ComboboxItem, type ComboboxItemProps, type ComboboxProps, Container, type ContainerProps, Flex, type FlexProps, FormField, FormFieldControl, FormFieldDescription, FormFieldLabel, FormFieldMessage, type FormFieldMessageProps, type FormFieldProps, Grid, type GridProps, Input, InputField, type InputFieldProps, type InputKind, type InputKindDefaults, type InputProps, type InputSize, type InputVariant, MarkdownEditor, type MarkdownEditorProps, type MarkdownEditorTabs, MultiSelect, MultiSelectContent, MultiSelectItem, type MultiSelectItemProps, type MultiSelectProps, MultiSelectTrigger, Radio, RadioGroup, type RadioGroupProps, type RadioProps, type RadioSize, Select, SelectContent, type SelectContentProps, SelectGroup, type SelectGroupProps, SelectItem, type SelectItemProps, type SelectLabelProps, type SelectProps, SelectTrigger, type SelectTriggerProps, SelectValue, type SelectValueProps, Stack, type StackProps, Switch, type SwitchProps, type SwitchSize, type TextProps, Textarea, type TextareaCoreProps, type TextareaProps, type TextareaResize, ThemeToggler, type ThemeTogglerColor, type ThemeTogglerDisplay, type ThemeTogglerProps, type ThemeTogglerVariant, UIProvider, type UIProviderProps, cardSkeleton, cn, defineRecipe, defineSemanticToken, defineSemanticTokens, defineTheme, defineToken, defineTokens, defineTypography, extendRecipe, extendRecipes, extendSemanticTokens, extendTheme, extendTokens, extendTypography, getRecipeNames, hexToRgbString, rgbToHex, useButtonGroupContext, useButtonGroupItemContext, useClearableField, useFloatingSide, useKeyboardShortcuts, useOptionalButtonGroupContext, useOptionalButtonGroupItemContext, useStatusTransition };
|
|
1275
|
+
export { Adornment, type AdornmentProps, type BaseInputExtraAdornmentContext, type BaseInputProps, Button, ButtonGroup, ButtonGroupContext, type ButtonGroupContextValue, ButtonGroupItemContext, type ButtonGroupItemContextValue, type ButtonGroupItemProps, type ButtonGroupLabelProps, type ButtonGroupProps, type ButtonGroupSeparatorProps, type ButtonGroupSpacing, type ButtonGroupTextProps, type ButtonProps, Card, type CardBodyProps, type CardFooterProps, type CardHeaderProps, type CardProps, type CardSize, type CardVariant, Checkbox, type CheckboxProps, Combobox, ComboboxContent, ComboboxInput, type ComboboxInputProps, ComboboxItem, type ComboboxItemProps, type ComboboxProps, type ComponentKey, type ComponentPropsMap, Container, type ContainerProps, type CustomFieldRenderer, Flex, type FlexProps, Form, type FormContextValue, type FormControlProps, type FormErrors, FormField, FormFieldControl, FormFieldDescription, type FormFieldDescriptionProps, FormFieldLabel, type FormFieldLabelProps, FormFieldMessage, type FormFieldMessageProps, type FormFieldProps$1 as FormFieldProps, type FormFieldRootProps, FormResetButton, type FormResetButtonProps, type FormRootProps, FormSubmitButton, type FormSubmitButtonProps, type FormValues, Grid, type GridProps, Input, InputField, type InputFieldProps, type InputKind, type InputKindDefaults, type InputProps, type InputSize, type InputVariant, KreativUIProvider, type KuiFormControlComponent, type ManualValidator, MarkdownEditor, type MarkdownEditorProps, type MarkdownEditorTabs, type MotionGatedProps, MultiSelect, MultiSelectContent, MultiSelectItem, type MultiSelectItemProps, type MultiSelectProps, MultiSelectTrigger, type PasswordInputKindDefaults, type PasswordInputProps, type PasswordKind, Radio, RadioGroup, type RadioGroupProps, type RadioProps, type RadioSize, type SchemaLike, Select, SelectContent, type SelectContentProps, SelectGroup, type SelectGroupProps, SelectItem, type SelectItemProps, SelectLabel, type SelectLabelProps, type SelectProps, SelectRoot, type SelectRootProps, SelectTrigger, type SelectTriggerProps, SelectValue, type SelectValueProps, type SingleFormControlComponent, Stack, type StackProps, Switch, type SwitchProps, type SwitchSize, type TextProps, Textarea, type TextareaCoreProps, type TextareaProps, type TextareaResize, ThemeToggler, type ThemeTogglerColor, type ThemeTogglerDisplay, type ThemeTogglerProps, type ThemeTogglerVariant, type UIArraySchema, type UIArraySchemaFor, type UIFieldSchema, type UIFieldSchemaFor, type UIFieldSchemaRender, type UIObjectSchema, type UIObjectSchemaFor, type UIObjectSchemaForShape, type UIProviderProps, type UISchema, type ValuePropConvention, cardSkeleton, cn, defineUIField, extendRecipe, extendRecipes, extendSemanticTokens, extendTheme, extendTokens, extendTypography, getRecipeNames, hexToRgbString, rgbToHex, useButtonGroupContext, useButtonGroupItemContext, useClearableField, useFloatingSide, useFormContext, useKeyboardShortcuts, useOptionalButtonGroupContext, useOptionalButtonGroupItemContext, useStatusTransition };
|