@splenddev/kreativ-ui 0.3.4 → 0.3.6
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/chunk-4KNQFZZT.cjs +211 -0
- package/dist/chunk-4KNQFZZT.cjs.map +1 -0
- package/dist/chunk-52AQLHWM.cjs +208 -0
- package/dist/chunk-52AQLHWM.cjs.map +1 -0
- package/dist/chunk-6ZVPNLAW.cjs +31 -0
- package/dist/chunk-6ZVPNLAW.cjs.map +1 -0
- package/dist/chunk-CXR2HHQQ.js +12 -0
- package/dist/chunk-CXR2HHQQ.js.map +1 -0
- package/dist/chunk-EZIFSNRD.js +151 -0
- package/dist/chunk-EZIFSNRD.js.map +1 -0
- package/dist/chunk-KGNJ2KLQ.cjs +1280 -0
- package/dist/chunk-KGNJ2KLQ.cjs.map +1 -0
- package/dist/chunk-MAUKS2DZ.cjs +16 -0
- package/dist/chunk-MAUKS2DZ.cjs.map +1 -0
- package/dist/chunk-PW2S3ZJG.js +28 -0
- package/dist/chunk-PW2S3ZJG.js.map +1 -0
- package/dist/chunk-TGYV2M2L.js +88 -0
- package/dist/chunk-TGYV2M2L.js.map +1 -0
- package/dist/chunk-WF6Y3BRR.js +1241 -0
- package/dist/chunk-WF6Y3BRR.js.map +1 -0
- package/dist/components/index.cjs +22360 -0
- package/dist/components/index.cjs.map +1 -0
- package/dist/components/index.d.cts +1622 -0
- package/dist/components/index.d.ts +1622 -0
- package/dist/components/index.js +22285 -0
- package/dist/components/index.js.map +1 -0
- package/dist/core/index.cjs +69 -0
- package/dist/core/index.cjs.map +1 -0
- package/dist/core/index.d.cts +26 -0
- package/dist/core/index.d.ts +26 -0
- package/dist/core/index.js +4 -0
- package/dist/core/index.js.map +1 -0
- package/dist/hooks/index.cjs +77 -0
- package/dist/hooks/index.cjs.map +1 -0
- package/dist/hooks/index.d.cts +35 -0
- package/dist/hooks/index.d.ts +35 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/index.cjs +19 -23977
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -1700
- package/dist/index.d.ts +4 -1700
- package/dist/index.js +9 -23839
- package/dist/index.js.map +1 -1
- package/dist/styles/index.css +1 -1
- package/dist/types/index.cjs +4 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.d.cts +21 -0
- package/dist/types/index.d.ts +21 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/index.cjs +149 -0
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.d.cts +39 -0
- package/dist/utils/index.d.ts +39 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +27 -2
|
@@ -0,0 +1,1622 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode, ButtonHTMLAttributes, CSSProperties, ReactElement, ComponentPropsWithoutRef, HTMLInputTypeAttribute, TextareaHTMLAttributes, InputHTMLAttributes, ElementType, UIEvent, RefObject, LabelHTMLAttributes } 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, MotionGatedProps as MotionGatedProps$1, ControlledProps, Size, ResponsiveValue } from '@splenddev/kreativ-core/types';
|
|
4
|
+
import * as _splenddev_kreativ_core from '@splenddev/kreativ-core';
|
|
5
|
+
import { MotionGatedProps, 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 } from '@splenddev/kreativ-core';
|
|
6
|
+
import { ValuePropConvention, SingleFormControlComponent, SpaceValue, RadiusValue } from '../types/index.cjs';
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
|
|
9
|
+
interface AdornmentProps extends HTMLAttributes<HTMLSpanElement> {
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
position?: "start" | "end";
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare const Adornment: react.ForwardRefExoticComponent<AdornmentProps & react.RefAttributes<HTMLSpanElement>>;
|
|
15
|
+
|
|
16
|
+
type ButtonSize = SizeValue | "icon";
|
|
17
|
+
type ButtonVariant = BaseVariant | "link";
|
|
18
|
+
type ButtonColor = BaseColor | "black";
|
|
19
|
+
interface ButtonRenderProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onDrag" | "onDragStart" | "onDragEnd" | "onAnimationStart" | "onAnimationEnd" | "onAnimationIteration" | "color"> {
|
|
20
|
+
className?: string;
|
|
21
|
+
style?: CSSProperties;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
"aria-disabled"?: boolean;
|
|
24
|
+
"aria-busy"?: boolean;
|
|
25
|
+
"data-kui-responsive"?: string;
|
|
26
|
+
children?: ReactNode;
|
|
27
|
+
}
|
|
28
|
+
interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onDrag" | "onDragStart" | "onDragEnd" | "onAnimationStart" | "onAnimationEnd" | "onAnimationIteration" | "color">, BaseProps, ColorProps<ButtonColor>, VariantProps<ButtonVariant>, DisabledProps, LoadingProps, FullWidthProps, TypographyProps {
|
|
29
|
+
size?: ButtonSize;
|
|
30
|
+
leftIcon?: ReactNode;
|
|
31
|
+
rightIcon?: ReactNode;
|
|
32
|
+
iconOnly?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Custom rendering escape hatch.
|
|
35
|
+
*
|
|
36
|
+
* Receives the resolved Button props and allows the consumer
|
|
37
|
+
* to render the Button using another element or component.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```tsx
|
|
41
|
+
* <Button
|
|
42
|
+
* render={(props) => (
|
|
43
|
+
* <a {...props} href="/templates">
|
|
44
|
+
* Templates
|
|
45
|
+
* </a>
|
|
46
|
+
* )}
|
|
47
|
+
* >
|
|
48
|
+
* Templates
|
|
49
|
+
* </Button>
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @remarks
|
|
53
|
+
* The render function must be created inside a Client Component
|
|
54
|
+
* when using Next.js App Router. Functions cannot be passed from
|
|
55
|
+
* Server Components to Client Components.
|
|
56
|
+
*/
|
|
57
|
+
render?: (props: ButtonRenderProps) => ReactElement;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
61
|
+
|
|
62
|
+
type ButtonGroupSpacing = "none" | "sm" | "md" | "lg";
|
|
63
|
+
interface ButtonGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, "color" | "size">, Omit<BaseProps, "unstyled">, SizeProps, OrientationProps {
|
|
64
|
+
/**
|
|
65
|
+
* Whether adjacent buttons should visually connect.
|
|
66
|
+
*
|
|
67
|
+
* @default false
|
|
68
|
+
*/
|
|
69
|
+
attached?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Space between group items when not attached.
|
|
72
|
+
*
|
|
73
|
+
* @default "md"
|
|
74
|
+
*/
|
|
75
|
+
spacing?: ButtonGroupSpacing;
|
|
76
|
+
}
|
|
77
|
+
interface ButtonGroupSeparatorProps extends Omit<HTMLAttributes<HTMLDivElement>, "children">, OrientationProps {
|
|
78
|
+
}
|
|
79
|
+
interface ButtonGroupTextProps extends HTMLAttributes<HTMLSpanElement>, Omit<BaseProps, "unstyled"> {
|
|
80
|
+
}
|
|
81
|
+
interface ButtonGroupLabelProps extends HTMLAttributes<HTMLSpanElement>, Omit<BaseProps, "unstyled"> {
|
|
82
|
+
}
|
|
83
|
+
interface ButtonGroupItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
declare const ButtonGroup: react.ForwardRefExoticComponent<ButtonGroupProps & react.RefAttributes<HTMLDivElement>> & {
|
|
87
|
+
Separator: react.ForwardRefExoticComponent<ButtonGroupSeparatorProps & react.RefAttributes<HTMLDivElement>>;
|
|
88
|
+
Text: react.ForwardRefExoticComponent<ButtonGroupTextProps & react.RefAttributes<HTMLSpanElement>>;
|
|
89
|
+
Label: react.ForwardRefExoticComponent<ButtonGroupLabelProps & react.RefAttributes<HTMLSpanElement>>;
|
|
90
|
+
Item: react.ForwardRefExoticComponent<ButtonGroupItemProps & react.RefAttributes<HTMLDivElement>>;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
interface ButtonGroupContextValue {
|
|
94
|
+
orientation: Orientation;
|
|
95
|
+
attached: boolean;
|
|
96
|
+
spacing: ButtonGroupSpacing;
|
|
97
|
+
size?: ButtonProps["size"];
|
|
98
|
+
}
|
|
99
|
+
interface ButtonGroupItemContextValue {
|
|
100
|
+
embedded: true;
|
|
101
|
+
}
|
|
102
|
+
declare const ButtonGroupContext: react.Context<ButtonGroupContextValue>;
|
|
103
|
+
declare const ButtonGroupItemContext: react.Context<ButtonGroupItemContextValue | null>;
|
|
104
|
+
/**
|
|
105
|
+
* Hook to consume the button group context.
|
|
106
|
+
* Throws an error if used outside of a `ButtonGroup` provider.
|
|
107
|
+
*/
|
|
108
|
+
declare function useButtonGroupContext(): ButtonGroupContextValue;
|
|
109
|
+
/**
|
|
110
|
+
* Hook to consume the button group context without throwing.
|
|
111
|
+
* Returns the default context if used outside a provider.
|
|
112
|
+
*/
|
|
113
|
+
declare function useOptionalButtonGroupContext(): ButtonGroupContextValue;
|
|
114
|
+
/**
|
|
115
|
+
* Hook to check if a button is embedded inside a `ButtonGroupItem`.
|
|
116
|
+
* Returns `true` if used inside an item, otherwise `false`.
|
|
117
|
+
*/
|
|
118
|
+
declare function useButtonGroupItemContext(): boolean;
|
|
119
|
+
declare function useOptionalButtonGroupItemContext(): ButtonGroupItemContextValue | null;
|
|
120
|
+
|
|
121
|
+
type ThemeTogglerVariant = Exclude<ButtonVariant, "link">;
|
|
122
|
+
type ThemeTogglerDisplay = "buttons" | "cycle";
|
|
123
|
+
type ThemeTogglerColor = Exclude<BaseColor, "destructive" | "warning" | "success" | "white" | "info">;
|
|
124
|
+
interface ThemeTogglerProps extends Omit<BaseProps, "style">, OrientationProps, VariantProps<ButtonVariant> {
|
|
125
|
+
variant?: ButtonVariant;
|
|
126
|
+
color?: ButtonProps["color"];
|
|
127
|
+
activeVariant?: ButtonVariant;
|
|
128
|
+
activeColor?: ButtonProps["color"];
|
|
129
|
+
size?: ButtonProps["size"];
|
|
130
|
+
iconOnly?: boolean;
|
|
131
|
+
allowSystem?: boolean;
|
|
132
|
+
rounded?: boolean;
|
|
133
|
+
labels?: {
|
|
134
|
+
light?: string;
|
|
135
|
+
dark?: string;
|
|
136
|
+
system?: string;
|
|
137
|
+
};
|
|
138
|
+
icons?: {
|
|
139
|
+
light?: ReactNode;
|
|
140
|
+
dark?: ReactNode;
|
|
141
|
+
system?: ReactNode;
|
|
142
|
+
};
|
|
143
|
+
buttonProps?: ButtonProps;
|
|
144
|
+
display?: "buttons" | "cycle";
|
|
145
|
+
animated?: boolean;
|
|
146
|
+
transition?: ThemeTogglerTransition;
|
|
147
|
+
indicatorClassName?: string;
|
|
148
|
+
indicatorStyle?: CSSProperties;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
declare const ThemeToggler: _splenddev_kreativ_core.KuiComponent<ThemeTogglerProps & MotionGatedProps, HTMLElement>;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Internal. Not part of the public API — do not re-export from the package index.
|
|
155
|
+
* Callers resolve `type` themselves. This function has no password concept.
|
|
156
|
+
*/
|
|
157
|
+
type BaseInputExtraAdornmentContext = {
|
|
158
|
+
iconSize: string | number;
|
|
159
|
+
/** Motion-gated icon-button classes. Transition styles are omitted when motion is off. */
|
|
160
|
+
iconButtonClass: string;
|
|
161
|
+
};
|
|
162
|
+
type BaseInputProps = Omit<ComponentPropsWithoutRef<"input">, "size" | "type"> & BaseProps & SizeProps & VariantProps<InputVariant> & DisabledProps & LoadingProps & FullWidthProps & ClearableProps & UndoRedoProps & ValueProps<string | number> & StateProps & TrimProps & TypographyProps & {
|
|
163
|
+
type: HTMLInputTypeAttribute;
|
|
164
|
+
inputClassName?: string;
|
|
165
|
+
scrollIntoViewOnError?: boolean;
|
|
166
|
+
startIcon?: ReactNode;
|
|
167
|
+
endIcon?: ReactNode;
|
|
168
|
+
rounded?: boolean;
|
|
169
|
+
motion?: boolean;
|
|
170
|
+
validatePattern?: string | RegExp;
|
|
171
|
+
patternMessage?: string;
|
|
172
|
+
embedded?: boolean;
|
|
173
|
+
extraEndAdornment?: ReactNode | ((ctx: BaseInputExtraAdornmentContext) => ReactNode);
|
|
174
|
+
};
|
|
175
|
+
type InputVariant = "outline" | "filled" | "ghost";
|
|
176
|
+
type InputSize = "xs" | "sm" | "md" | "lg";
|
|
177
|
+
type InputKind = "text" | "email" | "tel" | "url" | "search" | "numeric" | "number" | "date" | "time" | "datetime-local" | "month" | "week";
|
|
178
|
+
type PasswordKind = "password-current" | "password-new";
|
|
179
|
+
type KindDefaultBase = {
|
|
180
|
+
type?: string;
|
|
181
|
+
autoComplete?: string;
|
|
182
|
+
placeholder?: string;
|
|
183
|
+
pattern?: string;
|
|
184
|
+
min?: number;
|
|
185
|
+
max?: number;
|
|
186
|
+
step?: number;
|
|
187
|
+
};
|
|
188
|
+
type InputKindDefaults = Record<InputKind, KindDefaultBase & {
|
|
189
|
+
inputMode?: "none" | "text" | "decimal" | "numeric" | "tel" | "search" | "email" | "url";
|
|
190
|
+
}>;
|
|
191
|
+
type PasswordInputKindDefaults = Record<PasswordKind, KindDefaultBase & {
|
|
192
|
+
inputMode?: "none" | "text";
|
|
193
|
+
}>;
|
|
194
|
+
type InputProps = Omit<BaseInputProps, "type" | "extraEndAdornment" | "motion"> & {
|
|
195
|
+
kind?: InputKind;
|
|
196
|
+
hideKindIcon?: boolean;
|
|
197
|
+
type?: HTMLInputTypeAttribute;
|
|
198
|
+
motion?: boolean;
|
|
199
|
+
};
|
|
200
|
+
type PasswordInputProps = Omit<BaseInputProps, "type" | "extraEndAdornment" | "motion"> & {
|
|
201
|
+
motion?: boolean;
|
|
202
|
+
kind?: PasswordKind;
|
|
203
|
+
visible?: boolean;
|
|
204
|
+
defaultVisible?: boolean;
|
|
205
|
+
onVisibleChange?: (visible: boolean) => void;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
declare const Input: _splenddev_kreativ_core.KuiComponent<InputProps, HTMLInputElement>;
|
|
209
|
+
|
|
210
|
+
interface FormFieldControlProps {
|
|
211
|
+
children: react.ReactElement;
|
|
212
|
+
}
|
|
213
|
+
declare const FormFieldControl: _splenddev_kreativ_core.KuiComponent<FormFieldControlProps, unknown>;
|
|
214
|
+
|
|
215
|
+
interface FormFieldError {
|
|
216
|
+
name: string;
|
|
217
|
+
message: react.ReactNode;
|
|
218
|
+
}
|
|
219
|
+
interface FormFieldMessageProps extends react.HTMLAttributes<HTMLParagraphElement> {
|
|
220
|
+
children?: react.ReactNode;
|
|
221
|
+
forceMount?: boolean;
|
|
222
|
+
"data-kui-motion-gated"?: "true" | "false";
|
|
223
|
+
}
|
|
224
|
+
interface FormFieldMessageProps {
|
|
225
|
+
children?: ReactNode;
|
|
226
|
+
}
|
|
227
|
+
interface FormFieldLabelProps extends react.LabelHTMLAttributes<HTMLLabelElement> {
|
|
228
|
+
children?: react.ReactNode;
|
|
229
|
+
}
|
|
230
|
+
interface FormFieldDescriptionProps extends react.HTMLAttributes<HTMLParagraphElement> {
|
|
231
|
+
children?: react.ReactNode;
|
|
232
|
+
}
|
|
233
|
+
interface FormFieldRootProps {
|
|
234
|
+
id?: string;
|
|
235
|
+
name?: string;
|
|
236
|
+
status?: FormFieldStatus;
|
|
237
|
+
message?: react.ReactNode;
|
|
238
|
+
required?: boolean;
|
|
239
|
+
disabled?: boolean;
|
|
240
|
+
invalid?: boolean;
|
|
241
|
+
className?: string;
|
|
242
|
+
children?: react.ReactNode;
|
|
243
|
+
validateOn?: ValidateOn;
|
|
244
|
+
valuePropConvention?: ValuePropConvention;
|
|
245
|
+
}
|
|
246
|
+
interface FormFieldProps$1<P extends object = Record<string, never>> extends Omit<FormFieldRootProps, "children"> {
|
|
247
|
+
as?: SingleFormControlComponent<P>;
|
|
248
|
+
controlProps?: Partial<P>;
|
|
249
|
+
label?: react.ReactNode;
|
|
250
|
+
description?: react.ReactNode;
|
|
251
|
+
message?: react.ReactNode;
|
|
252
|
+
children?: react.ReactNode;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
declare const FormField: (<P extends object>(props: FormFieldProps$1<P> & {
|
|
256
|
+
ref?: react.Ref<unknown>;
|
|
257
|
+
}) => react.ReactElement | null) & {
|
|
258
|
+
Root: _splenddev_kreativ_core.KuiComponent<FormFieldRootProps, HTMLDivElement>;
|
|
259
|
+
Label: _splenddev_kreativ_core.KuiComponent<FormFieldLabelProps, HTMLLabelElement>;
|
|
260
|
+
Description: _splenddev_kreativ_core.KuiComponent<FormFieldDescriptionProps, HTMLParagraphElement>;
|
|
261
|
+
Message: _splenddev_kreativ_core.KuiComponent<FormFieldMessageProps, HTMLParagraphElement>;
|
|
262
|
+
Control: _splenddev_kreativ_core.KuiComponent<FormFieldControlProps, unknown>;
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
declare const FormFieldLabel: _splenddev_kreativ_core.KuiComponent<FormFieldLabelProps, HTMLLabelElement>;
|
|
266
|
+
|
|
267
|
+
declare const FormFieldDescription: _splenddev_kreativ_core.KuiComponent<FormFieldDescriptionProps, HTMLParagraphElement>;
|
|
268
|
+
|
|
269
|
+
declare const FormFieldMessage: _splenddev_kreativ_core.KuiComponent<FormFieldMessageProps, HTMLParagraphElement>;
|
|
270
|
+
|
|
271
|
+
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"> {
|
|
272
|
+
rounded?: boolean;
|
|
273
|
+
placeholder?: string;
|
|
274
|
+
required?: boolean;
|
|
275
|
+
name?: string;
|
|
276
|
+
size?: InputSize;
|
|
277
|
+
children: ReactNode;
|
|
278
|
+
}
|
|
279
|
+
interface SelectTriggerProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "value" | "className">, Styleable {
|
|
280
|
+
}
|
|
281
|
+
interface SelectContentProps extends Omit<HTMLAttributes<HTMLDivElement>, "className">, Styleable {
|
|
282
|
+
}
|
|
283
|
+
interface SelectItemProps extends Omit<HTMLAttributes<HTMLDivElement>, "children" | "className">, DisabledProps$1, Styleable {
|
|
284
|
+
value: string;
|
|
285
|
+
children: ReactNode;
|
|
286
|
+
}
|
|
287
|
+
interface SelectValueProps extends Styleable {
|
|
288
|
+
placeholder?: string;
|
|
289
|
+
}
|
|
290
|
+
interface SelectGroupProps extends Styleable, Required<Pick<BaseProps$1, "children">> {
|
|
291
|
+
}
|
|
292
|
+
interface SelectLabelProps extends Styleable, Required<Pick<BaseProps$1, "children">> {
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
declare function SelectContent({ className, children, ...props }: SelectContentProps): react.JSX.Element;
|
|
296
|
+
|
|
297
|
+
declare function SelectItem({ value, disabled, children, className, ...props }: SelectItemProps): react.JSX.Element;
|
|
298
|
+
|
|
299
|
+
declare function SelectValue({ placeholder, className }: SelectValueProps): react.JSX.Element;
|
|
300
|
+
|
|
301
|
+
declare function SelectGroup({ children, className }: SelectGroupProps): react.JSX.Element;
|
|
302
|
+
|
|
303
|
+
declare function SelectLabel({ children, className }: SelectLabelProps): react.JSX.Element;
|
|
304
|
+
|
|
305
|
+
interface SelectOption {
|
|
306
|
+
value: string;
|
|
307
|
+
label: react.ReactNode;
|
|
308
|
+
disabled?: boolean;
|
|
309
|
+
}
|
|
310
|
+
interface SelectProps extends Omit<SelectRootProps, "children"> {
|
|
311
|
+
options?: SelectOption[];
|
|
312
|
+
children?: react.ReactNode;
|
|
313
|
+
label?: string | react.ReactNode;
|
|
314
|
+
}
|
|
315
|
+
declare const Select: react.ForwardRefExoticComponent<SelectProps & react.RefAttributes<HTMLDivElement>> & {
|
|
316
|
+
Root: _splenddev_kreativ_core.KuiComponent<SelectRootProps, HTMLDivElement>;
|
|
317
|
+
Trigger: react.ForwardRefExoticComponent<SelectTriggerProps & react.RefAttributes<HTMLButtonElement>>;
|
|
318
|
+
Content: typeof SelectContent;
|
|
319
|
+
Item: typeof SelectItem;
|
|
320
|
+
Value: typeof SelectValue;
|
|
321
|
+
Group: typeof SelectGroup;
|
|
322
|
+
Label: typeof SelectLabel;
|
|
323
|
+
__kui: {
|
|
324
|
+
formControl: "compound";
|
|
325
|
+
};
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
declare const SelectTrigger: react.ForwardRefExoticComponent<SelectTriggerProps & react.RefAttributes<HTMLButtonElement>>;
|
|
329
|
+
|
|
330
|
+
declare const SelectRoot: _splenddev_kreativ_core.KuiComponent<SelectRootProps, HTMLDivElement>;
|
|
331
|
+
|
|
332
|
+
type TextareaResize = "none" | "both" | "horizontal" | "vertical";
|
|
333
|
+
interface TextareaCoreProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, "size" | "defaultValue" | "value">, Omit<BaseProps, "unstyled" | "style">, SizeProps, StateProps, VariantProps<InputVariant>, ClearableProps, ValueProps, FullWidthProps, EmbeddedProps, StateProps, TrimProps, ValidateProps<string>, TypographyProps {
|
|
334
|
+
resize?: TextareaResize;
|
|
335
|
+
autoResize?: boolean;
|
|
336
|
+
minRows?: number;
|
|
337
|
+
maxRows?: number;
|
|
338
|
+
characterCounter?: boolean;
|
|
339
|
+
debounceDelay?: number;
|
|
340
|
+
}
|
|
341
|
+
type TextareaProps = TextareaCoreProps;
|
|
342
|
+
|
|
343
|
+
declare const Textarea: _splenddev_kreativ_core.KuiComponent<TextareaCoreProps, HTMLTextAreaElement>;
|
|
344
|
+
|
|
345
|
+
type MarkdownEditorTabs = "write" | "preview";
|
|
346
|
+
interface MarkdownEditorProps extends Omit<TextareaCoreProps, "resize" | "autoResize"> {
|
|
347
|
+
/** Renders the Preview tab. Omit and Preview shows raw text with a dev warning. */
|
|
348
|
+
renderMarkdown?: (value: string) => ReactNode;
|
|
349
|
+
tab?: MarkdownEditorTabs;
|
|
350
|
+
defaultTab?: MarkdownEditorTabs;
|
|
351
|
+
onTabChange?: (tab: MarkdownEditorTabs) => void;
|
|
352
|
+
hint?: ReactNode;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
declare const MarkdownEditor: _splenddev_kreativ_core.KuiComponent<MarkdownEditorProps & MotionGatedProps, HTMLTextAreaElement>;
|
|
356
|
+
|
|
357
|
+
interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "type" | "checked" | "defaultChecked" | "children">, Styleable$1, StateProps, StatusProps, MotionGatedProps$1, ControlledProps<boolean, "checked", "defaultChecked", "onCheckedChange"> {
|
|
358
|
+
indeterminate?: boolean;
|
|
359
|
+
size?: InputSize;
|
|
360
|
+
disabled?: boolean;
|
|
361
|
+
label?: ReactNode;
|
|
362
|
+
description?: ReactNode;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
declare const Checkbox: _splenddev_kreativ_core.KuiComponent<CheckboxProps, HTMLInputElement>;
|
|
366
|
+
|
|
367
|
+
type RadioSize = "sm" | "md" | "lg";
|
|
368
|
+
interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "type" | "checked" | "defaultChecked" | "onChange" | "name" | "value">, Styleable$1 {
|
|
369
|
+
value: string;
|
|
370
|
+
disabled?: boolean;
|
|
371
|
+
label?: ReactNode;
|
|
372
|
+
description?: ReactNode;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
interface RadioGroupProps extends Styleable$1 {
|
|
376
|
+
value?: string;
|
|
377
|
+
defaultValue?: string;
|
|
378
|
+
onValueChange?: (value: string) => void;
|
|
379
|
+
name?: string;
|
|
380
|
+
disabled?: boolean;
|
|
381
|
+
required?: boolean;
|
|
382
|
+
orientation?: "horizontal" | "vertical";
|
|
383
|
+
size?: RadioSize;
|
|
384
|
+
error?: boolean;
|
|
385
|
+
success?: boolean;
|
|
386
|
+
children: ReactNode;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
declare function RadioGroup({ value: valueProp, defaultValue, onValueChange, name: nameProp, disabled, required, orientation, size, error, success, className, children, }: RadioGroupProps): react.JSX.Element;
|
|
390
|
+
|
|
391
|
+
declare function Radio({ value, disabled: itemDisabled, label, description, className, ...props }: RadioProps): react.JSX.Element;
|
|
392
|
+
|
|
393
|
+
type SwitchSize = "xs" | "sm" | "md" | "lg";
|
|
394
|
+
interface SwitchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "type" | "checked" | "defaultChecked">, Styleable$1 {
|
|
395
|
+
checked?: boolean;
|
|
396
|
+
defaultChecked?: boolean;
|
|
397
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
398
|
+
size?: SwitchSize;
|
|
399
|
+
error?: boolean;
|
|
400
|
+
success?: boolean;
|
|
401
|
+
label?: ReactNode;
|
|
402
|
+
description?: ReactNode;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
declare const Switch: _splenddev_kreativ_core.KuiComponent<SwitchProps & MotionGatedProps$1, HTMLInputElement>;
|
|
406
|
+
|
|
407
|
+
interface ComboboxProps extends Omit<BaseProps, "unstyled">, ValueProps<string | undefined>, ControlledProps<string | undefined, "inputValue", "defaultInputValue", "onInputChange">, DisabledProps, VariantProps<BaseVariant>, SizeProps, ClearableProps, StatusProps, StateProps {
|
|
408
|
+
required?: boolean;
|
|
409
|
+
rounded?: boolean;
|
|
410
|
+
name?: string;
|
|
411
|
+
placeholder?: string;
|
|
412
|
+
allowFreeText?: boolean;
|
|
413
|
+
}
|
|
414
|
+
interface ComboboxItemProps {
|
|
415
|
+
value: string;
|
|
416
|
+
disabled?: boolean;
|
|
417
|
+
children: ReactNode;
|
|
418
|
+
className?: string;
|
|
419
|
+
}
|
|
420
|
+
interface ComboboxInputProps extends InputProps {
|
|
421
|
+
allowFreeText?: boolean;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
declare function ComboboxItem({ value, disabled, children, className, }: ComboboxItemProps): react.JSX.Element | null;
|
|
425
|
+
|
|
426
|
+
declare function ComboboxContent({ className, children, }: {
|
|
427
|
+
className?: string;
|
|
428
|
+
children: React.ReactNode;
|
|
429
|
+
}): react.JSX.Element | null;
|
|
430
|
+
|
|
431
|
+
interface ComboboxEmptyProps {
|
|
432
|
+
children?: React.ReactNode;
|
|
433
|
+
className?: string;
|
|
434
|
+
}
|
|
435
|
+
declare function ComboboxEmpty({ children }: ComboboxEmptyProps): react.JSX.Element | null;
|
|
436
|
+
|
|
437
|
+
interface ComboboxLoadingProps {
|
|
438
|
+
children?: React.ReactNode;
|
|
439
|
+
className?: string;
|
|
440
|
+
}
|
|
441
|
+
declare function ComboboxLoading({ children, className, }: ComboboxLoadingProps): react.JSX.Element;
|
|
442
|
+
|
|
443
|
+
declare function Combobox({ value, onValueChange, inputValue: inputValueProp, defaultInputValue, onInputChange, disabled, name, error, success, rounded, className, children, }: ComboboxProps): react.JSX.Element;
|
|
444
|
+
declare namespace Combobox {
|
|
445
|
+
var Input: react.ForwardRefExoticComponent<ComboboxInputProps & react.RefAttributes<HTMLInputElement>>;
|
|
446
|
+
var Item: typeof ComboboxItem;
|
|
447
|
+
var Content: typeof ComboboxContent;
|
|
448
|
+
var Empty: typeof ComboboxEmpty;
|
|
449
|
+
var Loading: typeof ComboboxLoading;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
declare const ComboboxInput: react.ForwardRefExoticComponent<ComboboxInputProps & react.RefAttributes<HTMLInputElement>>;
|
|
453
|
+
|
|
454
|
+
interface MultiSelectProps extends Styleable$1 {
|
|
455
|
+
value?: string[];
|
|
456
|
+
defaultValue?: string[];
|
|
457
|
+
onValueChange?: (value: string[]) => void;
|
|
458
|
+
disabled?: boolean;
|
|
459
|
+
required?: boolean;
|
|
460
|
+
error?: boolean;
|
|
461
|
+
success?: boolean;
|
|
462
|
+
rounded?: boolean;
|
|
463
|
+
clearable?: boolean;
|
|
464
|
+
name?: string;
|
|
465
|
+
variant?: InputVariant;
|
|
466
|
+
size?: InputSize;
|
|
467
|
+
placeholder?: string;
|
|
468
|
+
maxVisibleChips?: number;
|
|
469
|
+
children: ReactNode;
|
|
470
|
+
}
|
|
471
|
+
interface MultiSelectItemProps {
|
|
472
|
+
value: string;
|
|
473
|
+
disabled?: boolean;
|
|
474
|
+
children: ReactNode;
|
|
475
|
+
className?: string;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
interface MultiSelectContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
479
|
+
className?: string;
|
|
480
|
+
}
|
|
481
|
+
declare function MultiSelectContent({ className, children, ...props }: MultiSelectContentProps): react.JSX.Element | null;
|
|
482
|
+
|
|
483
|
+
declare function MultiSelectItem({ value, disabled, children, className, }: MultiSelectItemProps): react.JSX.Element;
|
|
484
|
+
|
|
485
|
+
declare function MultiSelect({ value: valueProp, defaultValue, onValueChange, disabled, required, name, variant, size, placeholder, maxVisibleChips, className, children, error, success, rounded, clearable, }: MultiSelectProps): react.JSX.Element;
|
|
486
|
+
declare namespace MultiSelect {
|
|
487
|
+
var Trigger: react.ForwardRefExoticComponent<{
|
|
488
|
+
className?: string;
|
|
489
|
+
} & react.RefAttributes<HTMLButtonElement>>;
|
|
490
|
+
var Content: typeof MultiSelectContent;
|
|
491
|
+
var Item: typeof MultiSelectItem;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
declare const MultiSelectTrigger: react.ForwardRefExoticComponent<{
|
|
495
|
+
className?: string;
|
|
496
|
+
} & react.RefAttributes<HTMLButtonElement>>;
|
|
497
|
+
|
|
498
|
+
type FormValues = Record<string, unknown>;
|
|
499
|
+
type FormErrors = Record<string, react.ReactNode | undefined>;
|
|
500
|
+
interface FormContextValue {
|
|
501
|
+
values: FormValues;
|
|
502
|
+
isSubmitting: boolean;
|
|
503
|
+
isDirty: boolean;
|
|
504
|
+
schema: unknown;
|
|
505
|
+
setValue: (name: string, value: unknown) => void;
|
|
506
|
+
getValue: (name: string) => unknown;
|
|
507
|
+
setFieldError: (name: string, message: react.ReactNode | undefined) => void;
|
|
508
|
+
registerField: (name: string, element: HTMLElement | null) => void;
|
|
509
|
+
submit: () => void;
|
|
510
|
+
reset: () => void;
|
|
511
|
+
errors: FormErrors;
|
|
512
|
+
errorList: FormFieldError[];
|
|
513
|
+
}
|
|
514
|
+
declare function useFormContext(): FormContextValue | null;
|
|
515
|
+
|
|
516
|
+
interface SchemaLike {
|
|
517
|
+
safeParse: (values: FormValues) => {
|
|
518
|
+
success: true;
|
|
519
|
+
data: FormValues;
|
|
520
|
+
} | {
|
|
521
|
+
success: false;
|
|
522
|
+
error: {
|
|
523
|
+
issues: Array<{
|
|
524
|
+
path: PropertyKey[];
|
|
525
|
+
message: string;
|
|
526
|
+
}>;
|
|
527
|
+
};
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
type ManualValidator = (values: FormValues) => FormErrors | undefined | Promise<FormErrors | undefined>;
|
|
531
|
+
interface FormRootProps {
|
|
532
|
+
schema?: SchemaLike;
|
|
533
|
+
validate?: ManualValidator;
|
|
534
|
+
defaultValues?: FormValues;
|
|
535
|
+
onSubmit?: (values: FormValues) => void | Promise<void>;
|
|
536
|
+
onSubmitCapture?: (event: react.FormEvent<HTMLFormElement>) => void;
|
|
537
|
+
scrollToFirstOnError?: boolean;
|
|
538
|
+
className?: string;
|
|
539
|
+
children: react.ReactNode;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
interface FormSubmitButtonProps {
|
|
543
|
+
children: react.ReactElement;
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* asChild-style: injects type="submit" + disabled (while invalid or
|
|
547
|
+
* submitting) + aria-busy (while submitting) onto the supplied child.
|
|
548
|
+
* Owns no visual content/spinner of its own — pending state is
|
|
549
|
+
* exposed for the child's own Button to react to.
|
|
550
|
+
*
|
|
551
|
+
* Not a createComponent. It renders no DOM node of its own; the ref is
|
|
552
|
+
* forwarded onto the child. Submit is a one-shot action and is not a
|
|
553
|
+
* video.controlled value.
|
|
554
|
+
*/
|
|
555
|
+
declare const FormSubmitButton: react.ForwardRefExoticComponent<FormSubmitButtonProps & react.RefAttributes<unknown>>;
|
|
556
|
+
interface FormResetButtonProps {
|
|
557
|
+
children: react.ReactElement;
|
|
558
|
+
}
|
|
559
|
+
/**
|
|
560
|
+
* asChild-style: injects type="button" + an internal reset handler
|
|
561
|
+
* (native type="reset" isn't used since Form's values are
|
|
562
|
+
* controlled/context-owned, not native-form-reset-compatible) +
|
|
563
|
+
* disabled gated on isDirty rather than validity — resetting an
|
|
564
|
+
* invalid, untouched form is a no-op state that should read as
|
|
565
|
+
* disabled; resetting a dirty form should be available regardless of
|
|
566
|
+
* validity.
|
|
567
|
+
*
|
|
568
|
+
* Not a createComponent. Same reason as FormSubmitButton. Reset is a
|
|
569
|
+
* one-shot action and is not a video.controlled value.
|
|
570
|
+
*/
|
|
571
|
+
declare const FormResetButton: react.ForwardRefExoticComponent<FormResetButtonProps & react.RefAttributes<unknown>>;
|
|
572
|
+
|
|
573
|
+
interface NumberStepperValidationResult {
|
|
574
|
+
valid: boolean;
|
|
575
|
+
value: number | null;
|
|
576
|
+
errors: Array<"required" | "invalid" | "min" | "max" | "step">;
|
|
577
|
+
}
|
|
578
|
+
type NumberStepperClampOn = "change" | "blur" | "commit" | "never";
|
|
579
|
+
type NumberStepperButtonLayout = "vertical" | "horizontal";
|
|
580
|
+
interface NumberStepperProps {
|
|
581
|
+
value?: number;
|
|
582
|
+
defaultValue?: number;
|
|
583
|
+
onValueChange?: BaseInputProps["onValueChange"];
|
|
584
|
+
min?: number;
|
|
585
|
+
max?: number;
|
|
586
|
+
step?: number;
|
|
587
|
+
precision?: number;
|
|
588
|
+
variant?: InputVariant;
|
|
589
|
+
hideKindIcon?: InputProps["hideKindIcon"];
|
|
590
|
+
error?: boolean;
|
|
591
|
+
success?: boolean;
|
|
592
|
+
rounded?: boolean;
|
|
593
|
+
fullWidth?: boolean;
|
|
594
|
+
clampOn?: NumberStepperClampOn;
|
|
595
|
+
onValidate?: (result: NumberStepperValidationResult) => void;
|
|
596
|
+
buttonLayout?: NumberStepperButtonLayout;
|
|
597
|
+
disabled?: boolean;
|
|
598
|
+
required?: boolean;
|
|
599
|
+
name?: string;
|
|
600
|
+
size?: "sm" | "md" | "lg";
|
|
601
|
+
className?: string;
|
|
602
|
+
style?: react.CSSProperties;
|
|
603
|
+
"aria-label"?: string;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
interface ComponentPropsMap {
|
|
607
|
+
input: InputProps;
|
|
608
|
+
select: SelectProps;
|
|
609
|
+
switch: SwitchProps;
|
|
610
|
+
textarea: TextareaProps;
|
|
611
|
+
checkbox: CheckboxProps;
|
|
612
|
+
'number-stepper': NumberStepperProps;
|
|
613
|
+
}
|
|
614
|
+
type ComponentKey = keyof ComponentPropsMap;
|
|
615
|
+
|
|
616
|
+
interface FormControlProps {
|
|
617
|
+
id: string;
|
|
618
|
+
"aria-invalid": boolean | undefined;
|
|
619
|
+
"aria-required": boolean | undefined;
|
|
620
|
+
"aria-describedby": string | undefined;
|
|
621
|
+
disabled: boolean;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
interface KuiFormControlValueProps<T = unknown> {
|
|
625
|
+
value?: T;
|
|
626
|
+
onValueChange: (value: T) => void;
|
|
627
|
+
}
|
|
628
|
+
type KuiFormControlComponent<P extends KuiFormControlValueProps<any> = KuiFormControlValueProps<any>> = react.ComponentType<P> & {
|
|
629
|
+
__kui: {
|
|
630
|
+
formControl: "single" | "compound";
|
|
631
|
+
};
|
|
632
|
+
};
|
|
633
|
+
interface FieldState {
|
|
634
|
+
error?: react.ReactNode;
|
|
635
|
+
invalid: boolean;
|
|
636
|
+
isDirty: boolean;
|
|
637
|
+
}
|
|
638
|
+
interface FieldApi<T = unknown> {
|
|
639
|
+
value: T;
|
|
640
|
+
onChange: (value: T) => void;
|
|
641
|
+
onBlur: () => void;
|
|
642
|
+
name: string;
|
|
643
|
+
}
|
|
644
|
+
type CustomFieldRenderer<T = unknown> = (args: {
|
|
645
|
+
field: FieldApi<T>;
|
|
646
|
+
fieldState: FieldState;
|
|
647
|
+
controlProps: FormControlProps;
|
|
648
|
+
}) => react.ReactNode;
|
|
649
|
+
interface FormFieldProps {
|
|
650
|
+
tone?: "default" | "warning" | "info";
|
|
651
|
+
orientation?: "vertical" | "horizontal";
|
|
652
|
+
}
|
|
653
|
+
interface UISectionSchema {
|
|
654
|
+
label?: react.ReactNode;
|
|
655
|
+
description?: react.ReactNode;
|
|
656
|
+
fields: string[];
|
|
657
|
+
layout?: string;
|
|
658
|
+
columns?: string;
|
|
659
|
+
order?: number;
|
|
660
|
+
}
|
|
661
|
+
interface UIFieldSchemaWidgetKey<K extends ComponentKey = ComponentKey> extends UIFieldSchemaBase {
|
|
662
|
+
widget: K;
|
|
663
|
+
props?: Partial<ComponentPropsMap[K]>;
|
|
664
|
+
render?: never;
|
|
665
|
+
}
|
|
666
|
+
interface UIFieldSchemaWidgetComponent<P extends KuiFormControlValueProps = KuiFormControlValueProps> extends UIFieldSchemaBase {
|
|
667
|
+
widget: KuiFormControlComponent<P>;
|
|
668
|
+
props?: Partial<P>;
|
|
669
|
+
render?: never;
|
|
670
|
+
}
|
|
671
|
+
interface UIFieldSchemaWidgetInferred extends UIFieldSchemaBase {
|
|
672
|
+
widget?: never;
|
|
673
|
+
props?: never;
|
|
674
|
+
render?: never;
|
|
675
|
+
}
|
|
676
|
+
interface UIFieldSchemaRender<T = unknown> extends UIFieldSchemaBase {
|
|
677
|
+
widget?: never;
|
|
678
|
+
props?: never;
|
|
679
|
+
render: CustomFieldRenderer<T>;
|
|
680
|
+
}
|
|
681
|
+
interface UIFieldSchemaBase {
|
|
682
|
+
label?: react.ReactNode;
|
|
683
|
+
description?: react.ReactNode;
|
|
684
|
+
order?: number;
|
|
685
|
+
hidden?: boolean;
|
|
686
|
+
formField?: FormFieldProps;
|
|
687
|
+
}
|
|
688
|
+
interface UIFieldSchemaBase {
|
|
689
|
+
label?: react.ReactNode;
|
|
690
|
+
description?: react.ReactNode;
|
|
691
|
+
order?: number;
|
|
692
|
+
hidden?: boolean;
|
|
693
|
+
formField?: FormFieldProps;
|
|
694
|
+
/**
|
|
695
|
+
* CSS `grid-area` name used to place this field inside a `$sections`
|
|
696
|
+
* grid. Only honored for leaf fields (widgets, inferred, custom
|
|
697
|
+
* renderers) — object and array groups ignore it. When the field is
|
|
698
|
+
* claimed by a section, the section's own `layout` grid takes precedence.
|
|
699
|
+
*/
|
|
700
|
+
gridArea?: string;
|
|
701
|
+
}
|
|
702
|
+
type UIFieldSchema<K extends ComponentKey = ComponentKey, P extends KuiFormControlValueProps = KuiFormControlValueProps, T = unknown> = UIFieldSchemaWidgetKey<K> | UIFieldSchemaWidgetComponent<P> | UIFieldSchemaWidgetInferred | UIFieldSchemaRender<T>;
|
|
703
|
+
type UIFieldSchemaFor<V> = V extends Array<infer Item> ? UIArraySchemaFor<Item> : V extends object ? UIObjectSchemaForShape<V> | UIFieldSchema<ComponentKey, any, V> : UIFieldSchema<ComponentKey, any, V>;
|
|
704
|
+
type UIObjectSchema = {
|
|
705
|
+
[key: string]: UIFieldSchema | UIObjectSchema | UIArraySchema;
|
|
706
|
+
} & {
|
|
707
|
+
$sections?: UISectionSchema[];
|
|
708
|
+
};
|
|
709
|
+
interface UIArraySchema {
|
|
710
|
+
label?: react.ReactNode;
|
|
711
|
+
description?: react.ReactNode;
|
|
712
|
+
item: UIFieldSchema | UIObjectSchema;
|
|
713
|
+
addLabel?: react.ReactNode;
|
|
714
|
+
itemLabel?: string;
|
|
715
|
+
removable?: boolean;
|
|
716
|
+
reorderable?: boolean;
|
|
717
|
+
/**
|
|
718
|
+
* CSS `grid-area` name used to place this field inside a `$sections`
|
|
719
|
+
* grid. Only honored for leaf fields (widgets, inferred, custom
|
|
720
|
+
* renderers) — object and array groups ignore it. When the field is
|
|
721
|
+
* claimed by a section, the section's own `layout` grid takes precedence.
|
|
722
|
+
*/
|
|
723
|
+
gridArea?: string;
|
|
724
|
+
}
|
|
725
|
+
type UIObjectSchemaFor<Schema extends z.ZodObject<any>> = {
|
|
726
|
+
[K in keyof z.infer<Schema>]?: UIFieldSchemaFor<z.infer<Schema>[K]>;
|
|
727
|
+
} & {
|
|
728
|
+
$sections?: UISectionSchema[];
|
|
729
|
+
};
|
|
730
|
+
type UIObjectSchemaForShape<V> = {
|
|
731
|
+
[K in keyof V]?: UIFieldSchemaFor<V[K]>;
|
|
732
|
+
};
|
|
733
|
+
type UIArraySchemaFor<Item> = {
|
|
734
|
+
label?: react.ReactNode;
|
|
735
|
+
description?: react.ReactNode;
|
|
736
|
+
item: UIFieldSchemaFor<Item>;
|
|
737
|
+
addLabel?: react.ReactNode;
|
|
738
|
+
itemLabel?: string;
|
|
739
|
+
removable?: boolean;
|
|
740
|
+
reorderable?: boolean;
|
|
741
|
+
/**
|
|
742
|
+
* CSS `grid-area` name used to place this field inside a `$sections`
|
|
743
|
+
* grid. Only honored for leaf fields (widgets, inferred, custom
|
|
744
|
+
* renderers) — object and array groups ignore it. When the field is
|
|
745
|
+
* claimed by a section, the section's own `layout` grid takes precedence.
|
|
746
|
+
*/
|
|
747
|
+
gridArea?: string;
|
|
748
|
+
};
|
|
749
|
+
/**
|
|
750
|
+
* Object schema shape with unconstrained keys.
|
|
751
|
+
*
|
|
752
|
+
* @deprecated Use {@link UIObjectSchemaFor} for strict, Zod-inferred key and
|
|
753
|
+
* widget checking. `UIObjectSchema` accepts any string key and any
|
|
754
|
+
* `UIFieldSchema`, so it won't catch typos or wrong widget names — it exists
|
|
755
|
+
* only as the fallback shape when no Zod schema is in scope (e.g. inside a
|
|
756
|
+
* `<Form>` when `Schema` isn't supplied as a type argument). Prefer typing
|
|
757
|
+
* `uiSchema` against the inferred shape:
|
|
758
|
+
*
|
|
759
|
+
* @example
|
|
760
|
+
* const ui: UIObjectSchemaFor<typeof profileSchema> = { ... };
|
|
761
|
+
*/
|
|
762
|
+
type UISchema = UIObjectSchema;
|
|
763
|
+
|
|
764
|
+
/**
|
|
765
|
+
* Props for using Form.FromSchema inside a parent `<Form schema={...}>`.
|
|
766
|
+
* The schema comes from context, so `schema` is typed `never` here — passing
|
|
767
|
+
* one is a compile error rather than a silent override.
|
|
768
|
+
*/
|
|
769
|
+
interface FormFromSchemaContextProps<Schema extends z.ZodObject<any>> {
|
|
770
|
+
/**
|
|
771
|
+
* Zod object schema to generate fields from. When omitted, the enclosing
|
|
772
|
+
* `<Form>`'s schema is used. Providing it here also drives inference of
|
|
773
|
+
* `Schema` for `uiSchema`.
|
|
774
|
+
*/
|
|
775
|
+
uiSchema?: UIObjectSchemaFor<Schema>;
|
|
776
|
+
/**
|
|
777
|
+
* Presentation overlay keyed by the schema's field names. When `Schema`
|
|
778
|
+
* is known, keys and per-field props are checked against the inferred
|
|
779
|
+
* shape; otherwise keys are unconstrained.
|
|
780
|
+
*/
|
|
781
|
+
schema?: never;
|
|
782
|
+
}
|
|
783
|
+
/**
|
|
784
|
+
* Props for using Form.FromSchema on its own, with `schema` passed directly.
|
|
785
|
+
*/
|
|
786
|
+
interface FormFromSchemaStandaloneProps<Schema extends z.ZodObject<any>> {
|
|
787
|
+
/**
|
|
788
|
+
* Zod object schema to generate fields from. When omitted, the enclosing
|
|
789
|
+
* `<Form>`'s schema is used. Providing it here also drives inference of
|
|
790
|
+
* `Schema` for `uiSchema`.
|
|
791
|
+
*/
|
|
792
|
+
uiSchema?: UIObjectSchemaFor<Schema>;
|
|
793
|
+
/**
|
|
794
|
+
* Presentation overlay keyed by the schema's field names. When `Schema`
|
|
795
|
+
* is known, keys and per-field props are checked against the inferred
|
|
796
|
+
* shape; otherwise keys are unconstrained.
|
|
797
|
+
*/
|
|
798
|
+
schema: Schema;
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
* Props for `<Form.FromSchema>`.
|
|
802
|
+
*
|
|
803
|
+
* `Schema` is inferred from the `schema` prop in standalone mode; when used
|
|
804
|
+
* inside a `<Form>`, supply it explicitly as a type argument to get
|
|
805
|
+
* key-checking on `uiSchema`. Otherwise `uiSchema` falls back to the
|
|
806
|
+
* unconstrained `UIObjectSchema` shape.
|
|
807
|
+
*
|
|
808
|
+
* ### Strict vs. loose `uiSchema` typing
|
|
809
|
+
*
|
|
810
|
+
* - **Strict**: type `uiSchema` as `UIObjectSchemaFor<typeof schema>` (or let
|
|
811
|
+
* it be inferred by passing `schema` directly). Keys, nested field names,
|
|
812
|
+
* widget keys, and per-field `props` are all checked against the Zod
|
|
813
|
+
* output. This is what you want almost everywhere.
|
|
814
|
+
* - **Loose**: `UIObjectSchema` / `UISchema`. Any string key, any
|
|
815
|
+
* `UIFieldSchema`. Used only as the fallback when `Schema` can't be
|
|
816
|
+
* inferred (e.g. `<Form.FromSchema uiSchema={...} />` inside a `<Form>`).
|
|
817
|
+
* Wrong keys, misspelled widgets, and mismatched `props` all type-check.
|
|
818
|
+
*
|
|
819
|
+
* `UISchema` is deprecated for this reason — reach for `UIObjectSchemaFor`
|
|
820
|
+
* whenever you have a Zod schema available.
|
|
821
|
+
*/
|
|
822
|
+
type FormFromSchemaProps<Schema extends z.ZodObject<any> = z.ZodObject<any>> = FormFromSchemaContextProps<Schema> | FormFromSchemaStandaloneProps<Schema>;
|
|
823
|
+
/**
|
|
824
|
+
* Generates a set of fields from a Zod object schema.
|
|
825
|
+
*
|
|
826
|
+
* Write the shape once in Zod, optionally layer presentation on top with a
|
|
827
|
+
* `uiSchema`, and skip writing a `<Field>` for every property. Fields you
|
|
828
|
+
* don't mention in `uiSchema` still render — the generator picks a widget
|
|
829
|
+
* based on the Zod type. Use `uiSchema` only for the ones you want to
|
|
830
|
+
* override.
|
|
831
|
+
*
|
|
832
|
+
* `Schema` is inferred automatically when you pass `schema` directly
|
|
833
|
+
* (standalone mode) — `uiSchema`'s keys are checked against that schema's
|
|
834
|
+
* shape with no extra annotation needed. Inside a `<Form>`, there's no
|
|
835
|
+
* `schema` prop for inference to key off, so `Schema` must be supplied
|
|
836
|
+
* explicitly as a type argument for `uiSchema` to get the same
|
|
837
|
+
* key-checking; omitted, it falls back to the unconstrained shape.
|
|
838
|
+
*
|
|
839
|
+
* Schema resolution, in order:
|
|
840
|
+
* 1. The `schema` prop, if you passed one.
|
|
841
|
+
* 2. The enclosing `<Form>`'s schema, if there is one.
|
|
842
|
+
*
|
|
843
|
+
* If neither exists, or the result isn't a `z.object({...})`, this throws.
|
|
844
|
+
* Errors are prefixed `[kreativ-ui/Form.FromSchema]` so they're easy to
|
|
845
|
+
* grep for.
|
|
846
|
+
*
|
|
847
|
+
* Renders a fragment — no wrapper element — so the fields land directly
|
|
848
|
+
* inside whatever container you put this in.
|
|
849
|
+
*
|
|
850
|
+
* @example
|
|
851
|
+
* // Schema from context — Schema isn't inferable here, so uiSchema is
|
|
852
|
+
* // checked against profileSchema only if you supply the type argument:
|
|
853
|
+
* <Form schema={profileSchema}>
|
|
854
|
+
* <Form.FromSchema<typeof profileSchema> uiSchema={profileUiSchema} />
|
|
855
|
+
* </Form>
|
|
856
|
+
*
|
|
857
|
+
* @example
|
|
858
|
+
* // Schema passed in — Schema is inferred from `schema`, uiSchema is
|
|
859
|
+
* // checked automatically, no type argument needed:
|
|
860
|
+
* <Form.FromSchema schema={profileSchema} uiSchema={profileUiSchema} />
|
|
861
|
+
*/
|
|
862
|
+
declare function FormFromSchema<Schema extends z.ZodObject<any> = z.ZodObject<any>>({ uiSchema, schema: standaloneSchema }: FormFromSchemaProps<Schema>): react.JSX.Element;
|
|
863
|
+
|
|
864
|
+
declare function defineUIField<K extends ComponentKey>(field: UIFieldSchemaWidgetKey<K>): UIFieldSchemaWidgetKey<K>;
|
|
865
|
+
declare function defineUIField<P extends KuiFormControlValueProps<any>>(field: UIFieldSchemaWidgetComponent<P>): UIFieldSchemaWidgetComponent<P>;
|
|
866
|
+
declare function defineUIField(field: UIFieldSchemaWidgetInferred): UIFieldSchemaWidgetInferred;
|
|
867
|
+
declare function defineUIField<T>(field: UIFieldSchemaRender<T>): UIFieldSchemaRender<T>;
|
|
868
|
+
|
|
869
|
+
/**
|
|
870
|
+
* Form owns real orchestration, not a thin semantic <form> wrapper —
|
|
871
|
+
* submit handling, validation orchestration across its FormFields,
|
|
872
|
+
* and error aggregation are all Form's responsibility. It provides a
|
|
873
|
+
* FormContext that FormField reads to auto-wire validation/errors/
|
|
874
|
+
* disabled state.
|
|
875
|
+
*
|
|
876
|
+
* Usage:
|
|
877
|
+
* ```tsx
|
|
878
|
+
* <Form schema={zodSchema} onSubmit={handleSubmit}>
|
|
879
|
+
* <FormField name="email" as={Input} label="Email" />
|
|
880
|
+
* <Form.SubmitButton><Button>Submit</Button></Form.SubmitButton>
|
|
881
|
+
* </Form>
|
|
882
|
+
*```
|
|
883
|
+
* Or, schema-driven field generation:
|
|
884
|
+
* ```tsx
|
|
885
|
+
* <Form schema={zodSchema} onSubmit={handleSubmit}>
|
|
886
|
+
* <Form.FromSchema uiSchema={uiSchema} />
|
|
887
|
+
* <Form.SubmitButton><Button>Submit</Button></Form.SubmitButton>
|
|
888
|
+
* </Form>
|
|
889
|
+
* ```
|
|
890
|
+
*/
|
|
891
|
+
declare const Form: react.ForwardRefExoticComponent<FormRootProps & react.RefAttributes<HTMLFormElement>> & {
|
|
892
|
+
__kui: _splenddev_kreativ_core.KuiMeta<FormRootProps>;
|
|
893
|
+
providerRequired?: _splenddev_kreativ_core.KuiProviderRequirement;
|
|
894
|
+
} & {
|
|
895
|
+
SubmitButton: react.ForwardRefExoticComponent<FormSubmitButtonProps & react.RefAttributes<unknown>>;
|
|
896
|
+
ResetButton: react.ForwardRefExoticComponent<FormResetButtonProps & react.RefAttributes<unknown>>;
|
|
897
|
+
FromSchema: typeof FormFromSchema;
|
|
898
|
+
};
|
|
899
|
+
|
|
900
|
+
interface ContainerProps extends BaseProps {
|
|
901
|
+
/** @default "lg" */
|
|
902
|
+
maxWidth?: Size | (string & {});
|
|
903
|
+
/** Token name ("sm"), pixel number (24), or raw length ("24px"). */
|
|
904
|
+
padding?: ResponsiveValue<SpaceValue>;
|
|
905
|
+
/** @default true */
|
|
906
|
+
centered?: boolean;
|
|
907
|
+
as?: ElementType;
|
|
908
|
+
children?: ReactNode;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
declare const Container: react.ForwardRefExoticComponent<ContainerProps & react.RefAttributes<HTMLDivElement>>;
|
|
912
|
+
|
|
913
|
+
interface FlexProps extends BaseProps {
|
|
914
|
+
/**
|
|
915
|
+
* `display: inline-flex` instead of `flex`.
|
|
916
|
+
* Use when the container should sit in a line of text or shrink to its content.
|
|
917
|
+
* @default false
|
|
918
|
+
*/
|
|
919
|
+
inline?: boolean;
|
|
920
|
+
/**
|
|
921
|
+
* `flex-direction`. Main axis of the items.
|
|
922
|
+
* @default "row"
|
|
923
|
+
*/
|
|
924
|
+
direction?: ResponsiveValue<CSSProperties["flexDirection"]>;
|
|
925
|
+
/**
|
|
926
|
+
* `flex-wrap`. Whether items stay on one line or wrap onto new lines.
|
|
927
|
+
* @default "nowrap"
|
|
928
|
+
*/
|
|
929
|
+
wrap?: ResponsiveValue<CSSProperties["flexWrap"]>;
|
|
930
|
+
/**
|
|
931
|
+
* `align-items`. Alignment on the cross axis.
|
|
932
|
+
* `"stretch"` fills the cross size; `"center"` centers; `"start"` / `"end"` pin to an edge.
|
|
933
|
+
*/
|
|
934
|
+
align?: ResponsiveValue<CSSProperties["alignItems"]>;
|
|
935
|
+
/**
|
|
936
|
+
* `justify-content`. Distribution on the main axis.
|
|
937
|
+
* `"between"` pushes the first and last items to the edges; `"center"` groups them in the middle.
|
|
938
|
+
*/
|
|
939
|
+
justify?: ResponsiveValue<CSSProperties["justifyContent"]>;
|
|
940
|
+
/**
|
|
941
|
+
* `gap` on both axes. Token (`"sm"`), pixel number (`24`), or raw length (`"24px"`).
|
|
942
|
+
* Overridden per axis by `gapX` / `gapY`.
|
|
943
|
+
*/
|
|
944
|
+
gap?: ResponsiveValue<SpaceValue>;
|
|
945
|
+
/**
|
|
946
|
+
* `column-gap`. Space between items on the inline axis.
|
|
947
|
+
* Overrides `gap` for that axis only.
|
|
948
|
+
*/
|
|
949
|
+
gapX?: ResponsiveValue<SpaceValue>;
|
|
950
|
+
/**
|
|
951
|
+
* `row-gap`. Space between items on the block axis.
|
|
952
|
+
* Overrides `gap` for that axis only.
|
|
953
|
+
*/
|
|
954
|
+
gapY?: ResponsiveValue<SpaceValue>;
|
|
955
|
+
/**
|
|
956
|
+
* `flex-grow`. How much free space this item takes on the main axis.
|
|
957
|
+
* - `true` is `1` (share leftover space).
|
|
958
|
+
* - `false` is `0` (do not grow).
|
|
959
|
+
* - A number, or a responsive map, is passed through.
|
|
960
|
+
*/
|
|
961
|
+
grow?: ResponsiveValue<CSSProperties["flexGrow"]> | boolean;
|
|
962
|
+
/**
|
|
963
|
+
* `flex-shrink`. How readily this item gives up space when the line is tight.
|
|
964
|
+
* - `true` is `1` (may shrink; the CSS default).
|
|
965
|
+
* - `false` is `0` (keep its size).
|
|
966
|
+
* - A number, or a responsive map, is passed through.
|
|
967
|
+
*/
|
|
968
|
+
shrink?: ResponsiveValue<CSSProperties["flexShrink"]> | boolean;
|
|
969
|
+
/**
|
|
970
|
+
* `flex-basis`. Starting size before free space is distributed.
|
|
971
|
+
* `"auto"` uses the item's width/height. `"0"` ignores content size and shares space by `grow`.
|
|
972
|
+
* Also accepts `"content"`, a length, or a percentage.
|
|
973
|
+
*/
|
|
974
|
+
basis?: ResponsiveValue<CSSProperties["flexBasis"]>;
|
|
975
|
+
/** `width: 100%`. */
|
|
976
|
+
fullWidth?: boolean;
|
|
977
|
+
/** `height: 100%`. */
|
|
978
|
+
fullHeight?: boolean;
|
|
979
|
+
/**
|
|
980
|
+
* Element to render.
|
|
981
|
+
* @default "div"
|
|
982
|
+
*/
|
|
983
|
+
as?: ElementType;
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
declare const Flex: _splenddev_kreativ_core.KuiComponent<FlexProps, HTMLDivElement>;
|
|
987
|
+
|
|
988
|
+
interface StackProps extends BaseProps {
|
|
989
|
+
/**
|
|
990
|
+
* Layout direction of the stack.
|
|
991
|
+
* @default "vertical"
|
|
992
|
+
*/
|
|
993
|
+
orientation?: Orientation;
|
|
994
|
+
gap?: ResponsiveValue<Size | (string & {})>;
|
|
995
|
+
align?: ResponsiveValue<CSSProperties["alignItems"]>;
|
|
996
|
+
justify?: ResponsiveValue<CSSProperties["justifyContent"]>;
|
|
997
|
+
wrap?: ResponsiveValue<CSSProperties["flexWrap"]>;
|
|
998
|
+
/** Renders between each child. */
|
|
999
|
+
divider?: ReactNode;
|
|
1000
|
+
as?: ElementType;
|
|
1001
|
+
children?: ReactNode;
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
declare const Stack: react.ForwardRefExoticComponent<StackProps & react.RefAttributes<HTMLDivElement>>;
|
|
1005
|
+
|
|
1006
|
+
interface GridProps extends BaseProps {
|
|
1007
|
+
/**
|
|
1008
|
+
* Equal columns. `columns={3}` is `repeat(3, minmax(0, 1fr))`.
|
|
1009
|
+
* Do not combine with `minChildWidth` or `templateColumns`.
|
|
1010
|
+
*/
|
|
1011
|
+
columns?: ResponsiveValue<number>;
|
|
1012
|
+
/**
|
|
1013
|
+
* Wrap columns to the container. `minChildWidth="200px"` is
|
|
1014
|
+
* `repeat(auto-fit, minmax(200px, 1fr))`.
|
|
1015
|
+
* Do not combine with `columns` or `templateColumns`.
|
|
1016
|
+
*/
|
|
1017
|
+
minChildWidth?: ResponsiveValue<Size | (string & {})>;
|
|
1018
|
+
/**
|
|
1019
|
+
* Raw `grid-template-columns`. Wins over `columns` and `minChildWidth`.
|
|
1020
|
+
*/
|
|
1021
|
+
templateColumns?: ResponsiveValue<string>;
|
|
1022
|
+
/** Raw `grid-template-rows`. */
|
|
1023
|
+
templateRows?: ResponsiveValue<string>;
|
|
1024
|
+
/**
|
|
1025
|
+
* Raw `grid-template-areas`.
|
|
1026
|
+
* Not responsive. Areas rarely change by breakpoint.
|
|
1027
|
+
*/
|
|
1028
|
+
templateAreas?: string;
|
|
1029
|
+
/**
|
|
1030
|
+
* `grid-auto-flow`. `"row dense"` packs holes.
|
|
1031
|
+
*/
|
|
1032
|
+
autoFlow?: ResponsiveValue<CSSProperties["gridAutoFlow"]>;
|
|
1033
|
+
/**
|
|
1034
|
+
* `gap` on both axes. Token, pixel number, or raw length.
|
|
1035
|
+
* Overridden per axis by `gapX` / `gapY`.
|
|
1036
|
+
*/
|
|
1037
|
+
gap?: ResponsiveValue<SpaceValue>;
|
|
1038
|
+
/** `column-gap`. Overrides `gap` on the inline axis. */
|
|
1039
|
+
gapX?: ResponsiveValue<SpaceValue>;
|
|
1040
|
+
/** `row-gap`. Overrides `gap` on the block axis. */
|
|
1041
|
+
gapY?: ResponsiveValue<SpaceValue>;
|
|
1042
|
+
/** `align-items`. Alignment inside the cell, on the block axis. */
|
|
1043
|
+
align?: ResponsiveValue<CSSProperties["alignItems"]>;
|
|
1044
|
+
/** `justify-items`. Alignment inside the cell, on the inline axis. */
|
|
1045
|
+
justifyItems?: ResponsiveValue<CSSProperties["justifyItems"]>;
|
|
1046
|
+
/**
|
|
1047
|
+
* `display: inline-grid` instead of `grid`.
|
|
1048
|
+
* @default false
|
|
1049
|
+
*/
|
|
1050
|
+
inline?: boolean;
|
|
1051
|
+
/**
|
|
1052
|
+
* Element to render.
|
|
1053
|
+
* @default "div"
|
|
1054
|
+
*/
|
|
1055
|
+
as?: ElementType;
|
|
1056
|
+
}
|
|
1057
|
+
interface GridItemProps extends BaseProps {
|
|
1058
|
+
/**
|
|
1059
|
+
* `grid-column`. A number is `span <n>`. `"full"` is `1 / -1`.
|
|
1060
|
+
*/
|
|
1061
|
+
span?: ResponsiveValue<number | "full">;
|
|
1062
|
+
/**
|
|
1063
|
+
* `grid-row`. A number is `span <n>`. `"full"` is `1 / -1`.
|
|
1064
|
+
*/
|
|
1065
|
+
rowSpan?: ResponsiveValue<number | "full">;
|
|
1066
|
+
/**
|
|
1067
|
+
* Element to render.
|
|
1068
|
+
* @default "div"
|
|
1069
|
+
*/
|
|
1070
|
+
as?: ElementType;
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
declare const Grid: react.ForwardRefExoticComponent<GridProps & react.RefAttributes<HTMLDivElement>> & {
|
|
1074
|
+
__kui: _splenddev_kreativ_core.KuiMeta<GridProps>;
|
|
1075
|
+
providerRequired?: _splenddev_kreativ_core.KuiProviderRequirement;
|
|
1076
|
+
} & {
|
|
1077
|
+
Item: _splenddev_kreativ_core.KuiComponent<GridItemProps, HTMLDivElement>;
|
|
1078
|
+
};
|
|
1079
|
+
|
|
1080
|
+
type CardVariant = "solid" | "outline" | "ghost" | "elevated" | "compact";
|
|
1081
|
+
type CardSize = "sm" | "md" | "lg";
|
|
1082
|
+
interface CardProps extends ComponentPropsWithoutRef<"div"> {
|
|
1083
|
+
/**
|
|
1084
|
+
* Visual style of the card.
|
|
1085
|
+
*/
|
|
1086
|
+
variant?: CardVariant;
|
|
1087
|
+
/**
|
|
1088
|
+
* Controls each section's padding and overall density. Read by
|
|
1089
|
+
* Card.Header/Card.Body/Card.Footer, not applied by Card itself.
|
|
1090
|
+
*/
|
|
1091
|
+
size?: CardSize;
|
|
1092
|
+
/**
|
|
1093
|
+
* Makes the card span the full available width.
|
|
1094
|
+
*/
|
|
1095
|
+
fullWidth?: boolean;
|
|
1096
|
+
/**
|
|
1097
|
+
* Card content.
|
|
1098
|
+
*/
|
|
1099
|
+
children?: ReactNode;
|
|
1100
|
+
}
|
|
1101
|
+
interface CardHeaderProps extends ComponentPropsWithoutRef<"div"> {
|
|
1102
|
+
/**
|
|
1103
|
+
* Controls this section's padding. Defaults to the nearest Card's
|
|
1104
|
+
* `size`, settable per-section when it needs to differ.
|
|
1105
|
+
*/
|
|
1106
|
+
size?: CardSize;
|
|
1107
|
+
/**
|
|
1108
|
+
* Removes this section's padding — for a section that should bleed,
|
|
1109
|
+
* independent of its siblings.
|
|
1110
|
+
*/
|
|
1111
|
+
noPadding?: boolean;
|
|
1112
|
+
children?: ReactNode;
|
|
1113
|
+
}
|
|
1114
|
+
interface CardBodyProps extends ComponentPropsWithoutRef<"div"> {
|
|
1115
|
+
size?: CardSize;
|
|
1116
|
+
noPadding?: boolean;
|
|
1117
|
+
children?: ReactNode;
|
|
1118
|
+
}
|
|
1119
|
+
interface CardFooterProps extends ComponentPropsWithoutRef<"div"> {
|
|
1120
|
+
size?: CardSize;
|
|
1121
|
+
noPadding?: boolean;
|
|
1122
|
+
children?: ReactNode;
|
|
1123
|
+
}
|
|
1124
|
+
type CardMediaFit = "cover" | "contain" | "fill" | "none";
|
|
1125
|
+
type CardMediaBlend = "normal" | "multiply" | "screen" | "overlay" | "darken" | "lighten";
|
|
1126
|
+
interface CardMediaProps extends ComponentPropsWithoutRef<"div"> {
|
|
1127
|
+
/**
|
|
1128
|
+
* Image source, rendered by Media's internal `<img>`.
|
|
1129
|
+
*/
|
|
1130
|
+
src: string;
|
|
1131
|
+
/**
|
|
1132
|
+
* Alt text for the internal `<img>`.
|
|
1133
|
+
*/
|
|
1134
|
+
alt: string;
|
|
1135
|
+
/**
|
|
1136
|
+
* Controls how the image fills Media's box, mirroring `object-fit`.
|
|
1137
|
+
*/
|
|
1138
|
+
fit?: CardMediaFit;
|
|
1139
|
+
/**
|
|
1140
|
+
* Blend mode applied to the image, mirroring `mix-blend-mode`.
|
|
1141
|
+
*/
|
|
1142
|
+
blend?: CardMediaBlend;
|
|
1143
|
+
/**
|
|
1144
|
+
* Fixed aspect ratio for Media's box (e.g. `16 / 9`). Media is the
|
|
1145
|
+
* sizing context for the card's media area — content stacked inside it
|
|
1146
|
+
* (Card.Overlay, custom children) positions against this box.
|
|
1147
|
+
*/
|
|
1148
|
+
aspectRatio?: number | string;
|
|
1149
|
+
/**
|
|
1150
|
+
* Content stacked on top of the image — Card.Overlay, text, controls.
|
|
1151
|
+
*/
|
|
1152
|
+
children?: ReactNode;
|
|
1153
|
+
}
|
|
1154
|
+
type CardOverlayGradientEdge = "top" | "bottom" | "left" | "right";
|
|
1155
|
+
interface CardOverlayRadialGradient {
|
|
1156
|
+
type: "radial";
|
|
1157
|
+
/**
|
|
1158
|
+
* CSS position for the radial's center (e.g. "center", "top left").
|
|
1159
|
+
* Defaults to "center".
|
|
1160
|
+
*/
|
|
1161
|
+
position?: string;
|
|
1162
|
+
}
|
|
1163
|
+
type CardOverlayGradient = CardOverlayGradientEdge | CardOverlayRadialGradient;
|
|
1164
|
+
interface CardOverlayProps extends ComponentPropsWithoutRef<"div"> {
|
|
1165
|
+
/**
|
|
1166
|
+
* Scrim tint color drawn over the underlying layer. When `gradient` is
|
|
1167
|
+
* set, this is the gradient's solid stop color rather than a flat wash.
|
|
1168
|
+
*/
|
|
1169
|
+
color?: string;
|
|
1170
|
+
/**
|
|
1171
|
+
* Opacity of the scrim tint, 0–1. When `gradient` is set, this is the
|
|
1172
|
+
* gradient's starting-stop opacity rather than a uniform multiply.
|
|
1173
|
+
*/
|
|
1174
|
+
opacity?: number;
|
|
1175
|
+
/**
|
|
1176
|
+
* Blur applied over the composited layer beneath the overlay. Independent
|
|
1177
|
+
* of `gradient` — the two compose freely (a frosted panel that also
|
|
1178
|
+
* fades out).
|
|
1179
|
+
*/
|
|
1180
|
+
blur?: number | string;
|
|
1181
|
+
/**
|
|
1182
|
+
* Fades `color` to transparent instead of painting a uniform flat wash —
|
|
1183
|
+
* either linear from a named edge, or radial from a position (default
|
|
1184
|
+
* "center").
|
|
1185
|
+
*/
|
|
1186
|
+
gradient?: CardOverlayGradient;
|
|
1187
|
+
/**
|
|
1188
|
+
* Content rendered above the overlay (title, actions, etc.). Usable
|
|
1189
|
+
* inside Card.Media (over an image) or inside Card.Header/Body/Footer
|
|
1190
|
+
* (as a decorative background layer behind section content) — any of
|
|
1191
|
+
* these are a positioned ancestor Overlay can fill.
|
|
1192
|
+
*/
|
|
1193
|
+
children?: ReactNode;
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
declare const Card: react.ForwardRefExoticComponent<CardProps & react.RefAttributes<HTMLDivElement>> & {
|
|
1197
|
+
__kui: _splenddev_kreativ_core.KuiMeta<CardProps>;
|
|
1198
|
+
providerRequired?: _splenddev_kreativ_core.KuiProviderRequirement;
|
|
1199
|
+
} & {
|
|
1200
|
+
Header: _splenddev_kreativ_core.KuiComponent<CardHeaderProps, HTMLDivElement>;
|
|
1201
|
+
Body: _splenddev_kreativ_core.KuiComponent<CardBodyProps, HTMLDivElement>;
|
|
1202
|
+
Footer: _splenddev_kreativ_core.KuiComponent<CardFooterProps, HTMLDivElement>;
|
|
1203
|
+
Media: _splenddev_kreativ_core.KuiComponent<CardMediaProps, HTMLDivElement>;
|
|
1204
|
+
Overlay: _splenddev_kreativ_core.KuiComponent<CardOverlayProps, HTMLDivElement>;
|
|
1205
|
+
};
|
|
1206
|
+
|
|
1207
|
+
declare const CardOverlay: _splenddev_kreativ_core.KuiComponent<CardOverlayProps, HTMLDivElement>;
|
|
1208
|
+
|
|
1209
|
+
/** Scroll axis. `"both"` overflows on x and y. */
|
|
1210
|
+
type ScrollDirection = "vertical" | "horizontal" | "both";
|
|
1211
|
+
/**
|
|
1212
|
+
* When the scrollbar is painted.
|
|
1213
|
+
* `"auto"` follows the platform. `"hover"` shows it only while the area is hovered.
|
|
1214
|
+
* `"always"` keeps it visible. `"never"` hides it; scrolling still works.
|
|
1215
|
+
*/
|
|
1216
|
+
type ScrollbarVisibility = "auto" | "always" | "hover" | "never";
|
|
1217
|
+
/** Scrollbar thickness. `"thin"` is the compact track. */
|
|
1218
|
+
type ScrollbarVariant = "thin" | "default";
|
|
1219
|
+
/** An edge of the scrollport. */
|
|
1220
|
+
type ScrollEdge = "top" | "bottom" | "left" | "right";
|
|
1221
|
+
/**
|
|
1222
|
+
* `scroll-snap-type` strictness.
|
|
1223
|
+
* `"proximity"` snaps when close. `"mandatory"` always settles on a snap point.
|
|
1224
|
+
*/
|
|
1225
|
+
type ScrollSnap = "none" | "proximity" | "mandatory";
|
|
1226
|
+
/** `scroll-snap-align` for snap targets. */
|
|
1227
|
+
type ScrollSnapAlign = "start" | "center" | "end";
|
|
1228
|
+
/**
|
|
1229
|
+
* How a Scene measures its own progress.
|
|
1230
|
+
* `"through"` is 0 when the scene enters the scrollport and 1 when it leaves.
|
|
1231
|
+
* `"pinned"` holds at 1 while the scene covers the scrollport.
|
|
1232
|
+
*/
|
|
1233
|
+
type SceneRange = "through" | "pinned";
|
|
1234
|
+
/** Per-edge fade. A missing edge is off. */
|
|
1235
|
+
interface FadeEdgesConfig {
|
|
1236
|
+
top?: boolean;
|
|
1237
|
+
bottom?: boolean;
|
|
1238
|
+
left?: boolean;
|
|
1239
|
+
right?: boolean;
|
|
1240
|
+
}
|
|
1241
|
+
/** `0` → `1` on each axis. `0` when that axis does not overflow. */
|
|
1242
|
+
type ScrollProgress = {
|
|
1243
|
+
x: number;
|
|
1244
|
+
y: number;
|
|
1245
|
+
};
|
|
1246
|
+
/**
|
|
1247
|
+
* External store for a value that changes outside React render.
|
|
1248
|
+
* `get` is a live layout read: use it in effects and handlers, not during render.
|
|
1249
|
+
*/
|
|
1250
|
+
interface ProgressStore<T> {
|
|
1251
|
+
get(): T;
|
|
1252
|
+
subscribe(fn: (value: T) => void): () => void;
|
|
1253
|
+
}
|
|
1254
|
+
interface ScrollAreaProps extends BaseProps {
|
|
1255
|
+
/**
|
|
1256
|
+
* `max-height`. Caps the vertical scrollport.
|
|
1257
|
+
* Token, pixel number, or raw length. Responsive maps are resolved to breakpoint styles.
|
|
1258
|
+
*/
|
|
1259
|
+
maxHeight?: ResponsiveValue<string | number>;
|
|
1260
|
+
/**
|
|
1261
|
+
* `max-width`. Caps the horizontal scrollport.
|
|
1262
|
+
* Token, pixel number, or raw length. Responsive maps are resolved to breakpoint styles.
|
|
1263
|
+
*/
|
|
1264
|
+
maxWidth?: ResponsiveValue<string | number>;
|
|
1265
|
+
/**
|
|
1266
|
+
* Which axis overflows.
|
|
1267
|
+
* @default "vertical"
|
|
1268
|
+
*/
|
|
1269
|
+
direction?: ScrollDirection;
|
|
1270
|
+
/**
|
|
1271
|
+
* When the scrollbar is shown. Scrolling is unaffected.
|
|
1272
|
+
* @default "auto"
|
|
1273
|
+
*/
|
|
1274
|
+
showScrollbar?: ScrollbarVisibility;
|
|
1275
|
+
/**
|
|
1276
|
+
* Scrollbar thickness.
|
|
1277
|
+
* @default "thin"
|
|
1278
|
+
*/
|
|
1279
|
+
scrollbarVariant?: ScrollbarVariant;
|
|
1280
|
+
/**
|
|
1281
|
+
* Edge fade on axes that still have room to scroll.
|
|
1282
|
+
* `true` fades every eligible edge. An object turns on specific edges.
|
|
1283
|
+
* A fade is omitted when that edge is already at the end, or the axis does not overflow.
|
|
1284
|
+
* @default false
|
|
1285
|
+
*/
|
|
1286
|
+
fadeEdges?: boolean | FadeEdgesConfig;
|
|
1287
|
+
/**
|
|
1288
|
+
* Length of the edge fade. Number is pixels.
|
|
1289
|
+
* @default "24px"
|
|
1290
|
+
*/
|
|
1291
|
+
fadeSize?: string | number;
|
|
1292
|
+
/**
|
|
1293
|
+
* `overscroll-behavior`. `"contain"` stops scroll chaining to the parent.
|
|
1294
|
+
* @default "contain"
|
|
1295
|
+
*/
|
|
1296
|
+
overscrollBehavior?: "auto" | "contain" | "none";
|
|
1297
|
+
/**
|
|
1298
|
+
* `scroll-snap-type`. `"none"` disables snapping.
|
|
1299
|
+
* With `"mandatory"`, drag-to-scroll settles on the nearest item on release.
|
|
1300
|
+
* @default "none"
|
|
1301
|
+
*/
|
|
1302
|
+
snap?: ScrollSnap;
|
|
1303
|
+
/**
|
|
1304
|
+
* `scroll-snap-align` used by snap targets and `scrollToIndex`.
|
|
1305
|
+
* @default "start"
|
|
1306
|
+
*/
|
|
1307
|
+
snapAlign?: ScrollSnapAlign;
|
|
1308
|
+
/**
|
|
1309
|
+
* Pointer-drag scrolling. Off by default so text selection still works.
|
|
1310
|
+
* @default false
|
|
1311
|
+
*/
|
|
1312
|
+
dragToScroll?: boolean;
|
|
1313
|
+
/** Native scroll event, after the area has recorded its position. */
|
|
1314
|
+
onScroll?: (e: UIEvent<HTMLElement>) => void;
|
|
1315
|
+
/**
|
|
1316
|
+
* Fires when a scroll gesture settles on an edge, within `endThreshold`.
|
|
1317
|
+
* The edge is the one that was reached (`"bottom"` for a vertical list at the end).
|
|
1318
|
+
*/
|
|
1319
|
+
onScrollEnd?: (edge: ScrollEdge) => void;
|
|
1320
|
+
/**
|
|
1321
|
+
* Distance from an edge, in pixels, that still counts as "at the edge".
|
|
1322
|
+
* @default 0
|
|
1323
|
+
*/
|
|
1324
|
+
endThreshold?: number;
|
|
1325
|
+
/**
|
|
1326
|
+
* Publish scroll progress for Scene and other consumers.
|
|
1327
|
+
* Off by default; progress reads are idle unless something subscribes.
|
|
1328
|
+
* @default false
|
|
1329
|
+
*/
|
|
1330
|
+
trackProgress?: boolean;
|
|
1331
|
+
/**
|
|
1332
|
+
* Makes the scrollport focusable so it can be scrolled by keyboard.
|
|
1333
|
+
* Omit to use `0` while content overflows, and no tab stop when it does not.
|
|
1334
|
+
*/
|
|
1335
|
+
tabIndex?: number;
|
|
1336
|
+
/**
|
|
1337
|
+
* Element to render.
|
|
1338
|
+
* @default "div"
|
|
1339
|
+
*/
|
|
1340
|
+
as?: ElementType;
|
|
1341
|
+
}
|
|
1342
|
+
/** Options for `scrollNext` / `scrollPrev`. */
|
|
1343
|
+
interface ScrollStepOptions {
|
|
1344
|
+
/** Axis to step on. Defaults to the area's main axis (`"y"` unless `direction` is `"horizontal"`). */
|
|
1345
|
+
axis?: "x" | "y";
|
|
1346
|
+
/**
|
|
1347
|
+
* `"page"` moves by one client width/height.
|
|
1348
|
+
* `"item"` moves to the next snap target past the current offset.
|
|
1349
|
+
* @default "page"
|
|
1350
|
+
*/
|
|
1351
|
+
step?: "page" | "item";
|
|
1352
|
+
/** Native scroll behavior. `"auto"` if omitted. */
|
|
1353
|
+
behavior?: ScrollBehavior;
|
|
1354
|
+
}
|
|
1355
|
+
/**
|
|
1356
|
+
* Imperative handle. The ref is this handle, not the DOM node.
|
|
1357
|
+
* Use `getElement()` for the scrollport.
|
|
1358
|
+
*/
|
|
1359
|
+
interface ScrollAreaHandle {
|
|
1360
|
+
/** The scrollport element, or `null` before mount. */
|
|
1361
|
+
getElement: () => HTMLElement | null;
|
|
1362
|
+
/** Re-read overflow and edge state. */
|
|
1363
|
+
measure: () => void;
|
|
1364
|
+
/** Native `scrollTo`. */
|
|
1365
|
+
scrollTo: (opts: ScrollToOptions) => void;
|
|
1366
|
+
scrollToTop: (behavior?: ScrollBehavior) => void;
|
|
1367
|
+
scrollToBottom: (behavior?: ScrollBehavior) => void;
|
|
1368
|
+
/** Scroll so the given edge of the content meets the scrollport. */
|
|
1369
|
+
scrollToEdge: (edge: ScrollEdge, behavior?: ScrollBehavior) => void;
|
|
1370
|
+
/** Step forward by a page or to the next item. */
|
|
1371
|
+
scrollNext: (opts?: ScrollStepOptions) => void;
|
|
1372
|
+
/** Step backward by a page or to the previous item. */
|
|
1373
|
+
scrollPrev: (opts?: ScrollStepOptions) => void;
|
|
1374
|
+
/**
|
|
1375
|
+
* Scroll so the nth direct child aligns to `snapAlign`.
|
|
1376
|
+
* No-op if the index is out of range.
|
|
1377
|
+
*/
|
|
1378
|
+
scrollToIndex: (index: number, opts?: Omit<ScrollStepOptions, "step">) => void;
|
|
1379
|
+
}
|
|
1380
|
+
/**
|
|
1381
|
+
* Publishes its own travel through the scrollport as `--kui-scene-progress` (`0` → `1`),
|
|
1382
|
+
* inherited by every descendant.
|
|
1383
|
+
*/
|
|
1384
|
+
interface ScrollAreaSceneProps extends HTMLAttributes<HTMLElement> {
|
|
1385
|
+
/**
|
|
1386
|
+
* How progress is measured.
|
|
1387
|
+
* `"through"` runs `0` → `1` as the scene crosses the scrollport.
|
|
1388
|
+
* `"pinned"` stays at `1` while the scene covers it.
|
|
1389
|
+
*/
|
|
1390
|
+
range?: SceneRange;
|
|
1391
|
+
/** Axis to measure. Defaults to the ScrollArea's main axis. */
|
|
1392
|
+
axis?: "x" | "y";
|
|
1393
|
+
/**
|
|
1394
|
+
* Element to render.
|
|
1395
|
+
* @default "div"
|
|
1396
|
+
*/
|
|
1397
|
+
as?: ElementType;
|
|
1398
|
+
}
|
|
1399
|
+
/**
|
|
1400
|
+
* `position: sticky` inside the ScrollArea.
|
|
1401
|
+
* With no offset, sticks to the start of the scroll axis: `top` when vertical,
|
|
1402
|
+
* `left` when horizontal, both when `direction` is `"both"`.
|
|
1403
|
+
* An explicit `top` / `right` / `bottom` / `left` wins.
|
|
1404
|
+
* Does nothing if an ancestor between this node and the ScrollArea has `overflow` other than `visible`.
|
|
1405
|
+
*/
|
|
1406
|
+
interface ScrollAreaStickyProps extends HTMLAttributes<HTMLElement> {
|
|
1407
|
+
/** Inset from the top edge while stuck. Number is pixels. */
|
|
1408
|
+
top?: number | string;
|
|
1409
|
+
/** Inset from the bottom edge while stuck. Number is pixels. */
|
|
1410
|
+
bottom?: number | string;
|
|
1411
|
+
/** Inset from the left edge while stuck. Number is pixels. */
|
|
1412
|
+
left?: number | string;
|
|
1413
|
+
/** Inset from the right edge while stuck. Number is pixels. */
|
|
1414
|
+
right?: number | string;
|
|
1415
|
+
/**
|
|
1416
|
+
* `z-index` while in the scrollport.
|
|
1417
|
+
* @default 1
|
|
1418
|
+
*/
|
|
1419
|
+
zIndex?: number;
|
|
1420
|
+
/** Called when the sticky node starts or stops being stuck. */
|
|
1421
|
+
onStuckChange?: (stuck: boolean) => void;
|
|
1422
|
+
/**
|
|
1423
|
+
* Element to render.
|
|
1424
|
+
* @default "div"
|
|
1425
|
+
*/
|
|
1426
|
+
as?: ElementType;
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
declare const ScrollArea: react.ForwardRefExoticComponent<ScrollAreaProps & MotionGatedProps & react.RefAttributes<ScrollAreaHandle>> & {
|
|
1430
|
+
__kui: _splenddev_kreativ_core.KuiMeta<ScrollAreaProps & MotionGatedProps>;
|
|
1431
|
+
providerRequired?: _splenddev_kreativ_core.KuiProviderRequirement;
|
|
1432
|
+
} & {
|
|
1433
|
+
Scene: _splenddev_kreativ_core.KuiComponent<ScrollAreaSceneProps & MotionGatedProps, HTMLElement>;
|
|
1434
|
+
Sticky: _splenddev_kreativ_core.KuiComponent<ScrollAreaStickyProps, HTMLElement>;
|
|
1435
|
+
};
|
|
1436
|
+
|
|
1437
|
+
/** Container progress. Subscribe-based, so it never re-renders anything by itself. */
|
|
1438
|
+
declare function useScrollProgress(): ProgressStore<ScrollProgress>;
|
|
1439
|
+
interface ScrollSceneOptions {
|
|
1440
|
+
range?: SceneRange;
|
|
1441
|
+
axis?: "x" | "y";
|
|
1442
|
+
}
|
|
1443
|
+
/** Progress of an element through the surrounding ScrollArea's viewport. */
|
|
1444
|
+
declare function useElementScrollProgress(ref: RefObject<HTMLElement | null>, { range, axis }?: ScrollSceneOptions): ProgressStore<number>;
|
|
1445
|
+
|
|
1446
|
+
interface BoxProps extends BaseProps {
|
|
1447
|
+
/**
|
|
1448
|
+
* Element to render.
|
|
1449
|
+
* @default "div"
|
|
1450
|
+
*/
|
|
1451
|
+
as?: ElementType;
|
|
1452
|
+
/** Padding. Token, pixel number, or raw length. */
|
|
1453
|
+
p?: ResponsiveValue<SpaceValue>;
|
|
1454
|
+
/** Padding on the inline axis. Overrides `p`. */
|
|
1455
|
+
px?: ResponsiveValue<SpaceValue>;
|
|
1456
|
+
/** Padding on the block axis. Overrides `p`. */
|
|
1457
|
+
py?: ResponsiveValue<SpaceValue>;
|
|
1458
|
+
/** Margin. `"auto"` centers on that axis. */
|
|
1459
|
+
m?: ResponsiveValue<SpaceValue | "auto">;
|
|
1460
|
+
/** Margin on the inline axis. Overrides `m`. */
|
|
1461
|
+
mx?: ResponsiveValue<SpaceValue | "auto">;
|
|
1462
|
+
/** Margin on the block axis. Overrides `m`. */
|
|
1463
|
+
my?: ResponsiveValue<SpaceValue | "auto">;
|
|
1464
|
+
/** Background. Token or raw CSS color. */
|
|
1465
|
+
bg?: ResponsiveValue<ColorProps<BaseColor> | string>;
|
|
1466
|
+
/** Foreground. Token or raw CSS color. */
|
|
1467
|
+
color?: ResponsiveValue<ColorProps<BaseColor> | string>;
|
|
1468
|
+
/**
|
|
1469
|
+
* Border. `true` is a 1px solid line in the default border color.
|
|
1470
|
+
* A color paints that line in the given color.
|
|
1471
|
+
* @default false
|
|
1472
|
+
*/
|
|
1473
|
+
border?: boolean | ResponsiveValue<ColorProps<BaseColor> | string>;
|
|
1474
|
+
/** Corner radius. */
|
|
1475
|
+
rounded?: ResponsiveValue<RadiusValue>;
|
|
1476
|
+
/** Width. `"full"` is 100%, `"fit"` is max-content. */
|
|
1477
|
+
w?: ResponsiveValue<SpaceValue | "auto" | "full" | "fit">;
|
|
1478
|
+
/** Height. `"full"` is 100%, `"fit"` is max-content. */
|
|
1479
|
+
h?: ResponsiveValue<SpaceValue | "auto" | "full" | "fit">;
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
declare const Box: _splenddev_kreativ_core.KuiComponent<BoxProps, HTMLDivElement>;
|
|
1483
|
+
|
|
1484
|
+
/**
|
|
1485
|
+
* Represents the visual state of the field for feedback and styling.
|
|
1486
|
+
*/
|
|
1487
|
+
interface InputFieldProps extends InputProps {
|
|
1488
|
+
/**
|
|
1489
|
+
* The primary label for the input. Supports React nodes for rich formatting
|
|
1490
|
+
* (e.g., icons, badges, or custom typography).
|
|
1491
|
+
*/
|
|
1492
|
+
label?: ReactNode;
|
|
1493
|
+
/**
|
|
1494
|
+
* Helper text displayed near the input (usually below the label or the input itself).
|
|
1495
|
+
* Use this for permanent instructions or contextual guidance.
|
|
1496
|
+
*/
|
|
1497
|
+
description?: ReactNode;
|
|
1498
|
+
/**
|
|
1499
|
+
* Content (e.g., an icon, badge, or avatar) rendered inline at the start of the label.
|
|
1500
|
+
*/
|
|
1501
|
+
labelStart?: ReactNode;
|
|
1502
|
+
/**
|
|
1503
|
+
* Content (e.g., a badge, status indicator, or small action button)
|
|
1504
|
+
* rendered inline at the end of the label.
|
|
1505
|
+
*/
|
|
1506
|
+
labelEnd?: ReactNode;
|
|
1507
|
+
/**
|
|
1508
|
+
* An optional tooltip, info icon, or popover trigger rendered next to the label.
|
|
1509
|
+
* Ideal for providing supplementary explanations without cluttering the UI.
|
|
1510
|
+
*/
|
|
1511
|
+
tooltip?: ReactNode;
|
|
1512
|
+
/**
|
|
1513
|
+
* The current validation or status state of the field.
|
|
1514
|
+
* Drives the visual appearance (border color, label color, message styling).
|
|
1515
|
+
*
|
|
1516
|
+
* @default 'none'
|
|
1517
|
+
*/
|
|
1518
|
+
status?: FormFieldStatus$1;
|
|
1519
|
+
/**
|
|
1520
|
+
* Feedback message displayed below the input.
|
|
1521
|
+
* Typically paired with `status` to show success confirmations or error details.
|
|
1522
|
+
*
|
|
1523
|
+
* @example "Please enter a valid email address."
|
|
1524
|
+
*/
|
|
1525
|
+
message?: string;
|
|
1526
|
+
/**
|
|
1527
|
+
* A subtle, temporary hint displayed below the input, distinct from `description`.
|
|
1528
|
+
* Great for showing formatting rules, password requirements, or dynamic suggestions.
|
|
1529
|
+
*/
|
|
1530
|
+
hint?: ReactNode;
|
|
1531
|
+
/**
|
|
1532
|
+
* Marks the field as required. Automatically appends a required indicator
|
|
1533
|
+
* (e.g., an asterisk `*`) to the label.
|
|
1534
|
+
*
|
|
1535
|
+
* @default false
|
|
1536
|
+
*/
|
|
1537
|
+
required?: boolean;
|
|
1538
|
+
/**
|
|
1539
|
+
* Controls whether the field displays an optional indicator
|
|
1540
|
+
* (e.g., "(optional)") next to the label.
|
|
1541
|
+
* This is typically ignored if `required` is `true`.
|
|
1542
|
+
*
|
|
1543
|
+
* @default false
|
|
1544
|
+
*/
|
|
1545
|
+
optional?: boolean;
|
|
1546
|
+
/**
|
|
1547
|
+
* Visually hides the label while keeping it accessible to screen readers.
|
|
1548
|
+
* Useful for search bars or compact forms where layout space is limited.
|
|
1549
|
+
*
|
|
1550
|
+
* @default false
|
|
1551
|
+
*/
|
|
1552
|
+
labelHidden?: boolean;
|
|
1553
|
+
/**
|
|
1554
|
+
* Defines the layout relationship between the label and the input.
|
|
1555
|
+
* - `'vertical'`: Label sits above the input (default for most forms).
|
|
1556
|
+
* - `'horizontal'`: Label and input sit side-by-side (common in admin panels).
|
|
1557
|
+
*
|
|
1558
|
+
* @default 'vertical'
|
|
1559
|
+
*/
|
|
1560
|
+
orientation?: "vertical" | "horizontal";
|
|
1561
|
+
/**
|
|
1562
|
+
* Enables a character counter (e.g., "0 / 100") displayed near the input.
|
|
1563
|
+
* Automatically uses the `maxLength` prop from the underlying `InputProps`.
|
|
1564
|
+
*
|
|
1565
|
+
* @default false
|
|
1566
|
+
*/
|
|
1567
|
+
showCounter?: boolean;
|
|
1568
|
+
/**
|
|
1569
|
+
* The unique ID for the underlying input element.
|
|
1570
|
+
* Used to link the `<label>` (via `htmlFor`) and description/error messages
|
|
1571
|
+
* (via `aria-describedby`) for improved screen-reader support.
|
|
1572
|
+
*/
|
|
1573
|
+
id?: string;
|
|
1574
|
+
/**
|
|
1575
|
+
* Props forwarded directly to the underlying `<label>` element,
|
|
1576
|
+
* allowing fine-grained control over attributes like `className` or `onClick`.
|
|
1577
|
+
*/
|
|
1578
|
+
labelProps?: LabelHTMLAttributes<HTMLLabelElement>;
|
|
1579
|
+
/**
|
|
1580
|
+
* Custom class name applied to the root wrapper container of the entire field.
|
|
1581
|
+
*/
|
|
1582
|
+
wrapperClassName?: string;
|
|
1583
|
+
/**
|
|
1584
|
+
* Custom class name applied specifically to the label element.
|
|
1585
|
+
*/
|
|
1586
|
+
labelClassName?: string;
|
|
1587
|
+
/**
|
|
1588
|
+
* Custom class name applied to the container holding the description,
|
|
1589
|
+
* feedback message, and hint.
|
|
1590
|
+
*/
|
|
1591
|
+
messageClassName?: string;
|
|
1592
|
+
/**
|
|
1593
|
+
* Custom class name applied to the wrapper around the input element itself.
|
|
1594
|
+
* Useful for adding padding, backgrounds, or borders to the input's parent.
|
|
1595
|
+
*/
|
|
1596
|
+
inputWrapperClassName?: string;
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
declare const InputField: react.ForwardRefExoticComponent<InputFieldProps & react.RefAttributes<HTMLInputElement>>;
|
|
1600
|
+
|
|
1601
|
+
interface TextProps extends TypographyProps {
|
|
1602
|
+
as?: ElementType;
|
|
1603
|
+
color?: BaseColor | string;
|
|
1604
|
+
align?: "left" | "center" | "right" | "justify";
|
|
1605
|
+
truncate?: boolean;
|
|
1606
|
+
clampLines?: number;
|
|
1607
|
+
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
1608
|
+
italic?: boolean;
|
|
1609
|
+
className?: string;
|
|
1610
|
+
style?: CSSProperties;
|
|
1611
|
+
children?: ReactNode;
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
1615
|
+
interface HeadingProps extends Omit<TextProps, "as" | "typography"> {
|
|
1616
|
+
level?: HeadingLevel;
|
|
1617
|
+
typography?: "heading" | "headingSmall";
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
declare const Heading: react.ForwardRefExoticComponent<HeadingProps & react.RefAttributes<HTMLElement>>;
|
|
1621
|
+
|
|
1622
|
+
export { Adornment, type AdornmentProps, type BaseInputExtraAdornmentContext, type BaseInputProps, Box, type BoxProps, 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 CardMediaBlend, type CardMediaFit, type CardMediaProps, CardOverlay, type CardOverlayGradient, type CardOverlayGradientEdge, type CardOverlayProps, type CardOverlayRadialGradient, 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, type FadeEdgesConfig, 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, Heading, type HeadingLevel, type HeadingProps, Input, InputField, type InputFieldProps, type InputKind, type InputKindDefaults, type InputProps, type InputSize, type InputVariant, type KuiFormControlComponent, type ManualValidator, MarkdownEditor, type MarkdownEditorProps, type MarkdownEditorTabs, MultiSelect, MultiSelectContent, MultiSelectItem, type MultiSelectItemProps, type MultiSelectProps, MultiSelectTrigger, type PasswordInputKindDefaults, type PasswordInputProps, type PasswordKind, type ProgressStore, Radio, RadioGroup, type RadioGroupProps, type RadioProps, type RadioSize, type SceneRange, type SchemaLike, ScrollArea, type ScrollAreaHandle, type ScrollAreaProps, type ScrollAreaSceneProps, type ScrollAreaStickyProps, type ScrollDirection, type ScrollEdge, type ScrollProgress, type ScrollSnap, type ScrollSnapAlign, type ScrollStepOptions, type ScrollbarVariant, type ScrollbarVisibility, Select, SelectContent, type SelectContentProps, SelectGroup, type SelectGroupProps, SelectItem, type SelectItemProps, SelectLabel, type SelectLabelProps, type SelectProps, SelectRoot, type SelectRootProps, 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, type UIArraySchema, type UIArraySchemaFor, type UIFieldSchema, type UIFieldSchemaFor, type UIFieldSchemaRender, type UIObjectSchema, type UIObjectSchemaFor, type UIObjectSchemaForShape, type UISchema, defineUIField, useButtonGroupContext, useButtonGroupItemContext, useElementScrollProgress, useFormContext, useOptionalButtonGroupContext, useOptionalButtonGroupItemContext, useScrollProgress };
|