@marwes-ui/react 0.0.3 → 1.0.0
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/LICENSE +1 -1
- package/README.md +417 -62
- package/dist/index.d.ts +1591 -263
- package/dist/index.js +4009 -204
- package/dist/index.js.map +1 -1
- package/package.json +16 -12
package/dist/index.d.ts
CHANGED
|
@@ -1,42 +1,17 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
2
|
+
import { ThemeInput, FontLoadingConfig, ThemeMode, ResolvedTheme, ButtonOptions, InputOptions, SelectOptions, SelectAppearance as SelectAppearance$1, SelectOption as SelectOption$1, TextareaOptions, RichTextOptions, InputOtpOptions, CurrencyCode, iconRegistry, IconSize, IconStrokeWidth, AvatarOptions, CheckboxProps as CheckboxProps$1, DividerOptions, DividerSize, DividerOrientation, SpinnerOptions, SpacingOptions, SpacingSize, HeadingOptions, HeadingSize, ParagraphOptions, ParagraphSize, ToastOptions, ToastVariant, ToastIntent, ToastPlacement, TooltipOptions, IconNameType, RadioOptions, BadgeOptions, SwitchOptions, SliderOptions, TabOptions, DialogOptions } from '@marwes-ui/core';
|
|
3
|
+
export { AvatarSize, AvatarType, BadgeVariant, ButtonAction, ButtonSize, ButtonVariant, Density, FontLoadingConfig, FontLoadingMode, FontLoadingOptions, IconName, MwAvailableFont, MwFontFallback, MwGoogleFontFamily, MwStyledTheme, MwThemeVarName, MwThemeVarNames, MwThemeVarReference, MwThemeVars, ResolvedTheme, SpacingSize, Spacings, SwitchSize, Theme, ThemeInput, ThemeMode, ToneName, createFontStack, mwAvailableFonts, mwFontFallbacks, mwGoogleFontFamilies, mwStyledTheme, mwThemeVarNames, mwThemeVars, mwVar } from '@marwes-ui/core';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
|
|
6
6
|
type MarwesProviderProps = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Current theme mode. Determines light or dark color palette.
|
|
11
|
-
* When changed, efficiently switches theme colors without recreating the entire system.
|
|
12
|
-
*/
|
|
13
|
-
mode?: ThemeMode;
|
|
14
|
-
/**
|
|
15
|
-
* Callback fired when mode should change.
|
|
16
|
-
* Users are responsible for managing mode state and persistence (e.g., localStorage).
|
|
17
|
-
*
|
|
18
|
-
* Example with persistence:
|
|
19
|
-
* ```tsx
|
|
20
|
-
* const [mode, setMode] = useState<ThemeMode>(
|
|
21
|
-
* () => (localStorage.getItem('theme-mode') as ThemeMode) ?? 'light'
|
|
22
|
-
* );
|
|
23
|
-
*
|
|
24
|
-
* const handleModeChange = (newMode: ThemeMode) => {
|
|
25
|
-
* setMode(newMode);
|
|
26
|
-
* localStorage.setItem('theme-mode', newMode);
|
|
27
|
-
* };
|
|
28
|
-
*
|
|
29
|
-
* <MarwesProvider mode={mode} onModeChange={handleModeChange}>
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
7
|
+
theme?: ThemeInput;
|
|
8
|
+
fontLoading?: FontLoadingConfig;
|
|
32
9
|
onModeChange?: (mode: ThemeMode) => void;
|
|
33
10
|
children: React.ReactNode;
|
|
34
11
|
};
|
|
35
|
-
declare function MarwesProvider({
|
|
36
|
-
|
|
37
|
-
declare function useSystem(): System;
|
|
12
|
+
declare function MarwesProvider({ theme, fontLoading, onModeChange, children, }: MarwesProviderProps): react_jsx_runtime.JSX.Element;
|
|
38
13
|
|
|
39
|
-
declare function useTheme():
|
|
14
|
+
declare function useTheme(): ResolvedTheme;
|
|
40
15
|
|
|
41
16
|
type ButtonProps = ButtonOptions & {
|
|
42
17
|
children?: React.ReactNode;
|
|
@@ -46,162 +21,568 @@ type ButtonProps = ButtonOptions & {
|
|
|
46
21
|
declare function Button(props: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
47
22
|
|
|
48
23
|
/**
|
|
49
|
-
*
|
|
24
|
+
* Purpose Components — Button
|
|
50
25
|
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* the purpose and behavior of each button.
|
|
26
|
+
* Pre-configured button compositions that encode a specific semantic purpose.
|
|
27
|
+
* Purpose buttons lock semantic intent and canonical visual treatment.
|
|
54
28
|
*/
|
|
55
|
-
type
|
|
29
|
+
type DestructiveButtonProps = Omit<ButtonProps, "variant" | "action" | "as" | "href"> & {
|
|
56
30
|
/**
|
|
57
31
|
* Override automatic confirmation requirement.
|
|
58
32
|
* Defaults to `true` for destructive actions.
|
|
59
33
|
*/
|
|
60
34
|
confirmation?: boolean;
|
|
61
35
|
};
|
|
36
|
+
declare function DestructiveButton(props: DestructiveButtonProps): react_jsx_runtime.JSX.Element;
|
|
37
|
+
type CreateButtonProps = Omit<ButtonProps, "variant" | "action">;
|
|
38
|
+
declare function CreateButton(props: CreateButtonProps): react_jsx_runtime.JSX.Element;
|
|
39
|
+
type SubmitButtonProps = Omit<ButtonProps, "variant" | "action" | "as" | "href">;
|
|
40
|
+
declare function SubmitButton(props: SubmitButtonProps): react_jsx_runtime.JSX.Element;
|
|
41
|
+
type CancelButtonProps = Omit<ButtonProps, "variant" | "action">;
|
|
42
|
+
declare function CancelButton(props: CancelButtonProps): react_jsx_runtime.JSX.Element;
|
|
43
|
+
type LinkButtonProps = Omit<ButtonProps, "variant" | "action" | "as"> & {
|
|
44
|
+
href: string;
|
|
45
|
+
};
|
|
46
|
+
declare function LinkButton(props: LinkButtonProps): react_jsx_runtime.JSX.Element;
|
|
47
|
+
type SaveButtonProps = Omit<ButtonProps, "variant" | "action">;
|
|
48
|
+
declare function SaveButton(props: SaveButtonProps): react_jsx_runtime.JSX.Element;
|
|
49
|
+
type ConfirmButtonProps = Omit<ButtonProps, "variant" | "action" | "as" | "href">;
|
|
50
|
+
declare function ConfirmButton(props: ConfirmButtonProps): react_jsx_runtime.JSX.Element;
|
|
51
|
+
type VerifyButtonProps = Omit<ButtonProps, "variant" | "action" | "as" | "href">;
|
|
52
|
+
declare function VerifyButton(props: VerifyButtonProps): react_jsx_runtime.JSX.Element;
|
|
53
|
+
type EditButtonProps = Omit<ButtonProps, "variant" | "action">;
|
|
54
|
+
declare function EditButton(props: EditButtonProps): react_jsx_runtime.JSX.Element;
|
|
55
|
+
type CloseButtonProps = Omit<ButtonProps, "variant" | "action">;
|
|
56
|
+
declare function CloseButton(props: CloseButtonProps): react_jsx_runtime.JSX.Element;
|
|
57
|
+
type RefreshButtonProps = Omit<ButtonProps, "variant" | "action">;
|
|
58
|
+
declare function RefreshButton(props: RefreshButtonProps): react_jsx_runtime.JSX.Element;
|
|
59
|
+
type UploadButtonProps = Omit<ButtonProps, "variant" | "action">;
|
|
60
|
+
declare function UploadButton(props: UploadButtonProps): react_jsx_runtime.JSX.Element;
|
|
61
|
+
type DownloadButtonProps = Omit<ButtonProps, "variant" | "action">;
|
|
62
|
+
declare function DownloadButton(props: DownloadButtonProps): react_jsx_runtime.JSX.Element;
|
|
63
|
+
type CopyButtonProps = Omit<ButtonProps, "variant" | "action">;
|
|
64
|
+
declare function CopyButton(props: CopyButtonProps): react_jsx_runtime.JSX.Element;
|
|
65
|
+
type SearchButtonProps = Omit<ButtonProps, "variant" | "action">;
|
|
66
|
+
declare function SearchButton(props: SearchButtonProps): react_jsx_runtime.JSX.Element;
|
|
67
|
+
type FilterButtonProps = Omit<ButtonProps, "variant" | "action">;
|
|
68
|
+
declare function FilterButton(props: FilterButtonProps): react_jsx_runtime.JSX.Element;
|
|
69
|
+
type SortButtonProps = Omit<ButtonProps, "variant" | "action">;
|
|
70
|
+
declare function SortButton(props: SortButtonProps): react_jsx_runtime.JSX.Element;
|
|
71
|
+
type DropdownButtonProps = Omit<ButtonProps, "variant" | "action">;
|
|
72
|
+
declare function DropdownButton(props: DropdownButtonProps): react_jsx_runtime.JSX.Element;
|
|
73
|
+
type PrimaryButtonProps = Omit<ButtonProps, "variant" | "as"> & {};
|
|
74
|
+
declare function PrimaryButton(props: PrimaryButtonProps): react_jsx_runtime.JSX.Element;
|
|
75
|
+
type SecondaryButtonProps = Omit<ButtonProps, "variant" | "as"> & {};
|
|
76
|
+
declare function SecondaryButton(props: SecondaryButtonProps): react_jsx_runtime.JSX.Element;
|
|
77
|
+
type TextButtonProps = Omit<ButtonProps, "variant" | "as"> & {};
|
|
78
|
+
declare function TextButton(props: TextButtonProps): react_jsx_runtime.JSX.Element;
|
|
79
|
+
type SuccessButtonProps = Omit<ButtonProps, "variant" | "as"> & {};
|
|
80
|
+
declare function SuccessButton(props: SuccessButtonProps): react_jsx_runtime.JSX.Element;
|
|
81
|
+
|
|
82
|
+
type InputProps = InputOptions & {
|
|
83
|
+
onValueChange?: (value: string) => void;
|
|
84
|
+
className?: string;
|
|
85
|
+
};
|
|
86
|
+
declare function Input(props: InputProps): react_jsx_runtime.JSX.Element;
|
|
87
|
+
|
|
88
|
+
type SelectAppearance = SelectAppearance$1;
|
|
89
|
+
type SelectOption = SelectOption$1;
|
|
90
|
+
type SelectProps = SelectOptions & {
|
|
91
|
+
onValueChange?: (value: string) => void;
|
|
92
|
+
className?: string;
|
|
93
|
+
};
|
|
94
|
+
declare function Select(props: SelectProps): react_jsx_runtime.JSX.Element;
|
|
95
|
+
|
|
96
|
+
type TextareaProps = TextareaOptions & {
|
|
97
|
+
onValueChange?: (value: string) => void;
|
|
98
|
+
className?: string;
|
|
99
|
+
};
|
|
100
|
+
declare function Textarea(props: TextareaProps): react_jsx_runtime.JSX.Element;
|
|
101
|
+
|
|
102
|
+
type RichTextProps = RichTextOptions & {
|
|
103
|
+
onValueChange?: (value: string) => void;
|
|
104
|
+
className?: string;
|
|
105
|
+
};
|
|
106
|
+
declare const RichText: React.ForwardRefExoticComponent<RichTextOptions & {
|
|
107
|
+
onValueChange?: (value: string) => void;
|
|
108
|
+
className?: string;
|
|
109
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
110
|
+
|
|
111
|
+
type InputFieldProps = {
|
|
112
|
+
/** Optional: if omitted, we generate one via useId(). */
|
|
113
|
+
id?: string;
|
|
114
|
+
/** Field label (required for accessibility). */
|
|
115
|
+
label: string;
|
|
116
|
+
/** Optional helper text shown below the input. */
|
|
117
|
+
helperText?: string;
|
|
118
|
+
/** Optional error message. When present, input is marked invalid. */
|
|
119
|
+
error?: string;
|
|
120
|
+
/** Props forwarded to the Input atom. */
|
|
121
|
+
input: InputProps;
|
|
122
|
+
/** Additional aria-describedby IDs to merge with internal helper/error IDs. */
|
|
123
|
+
ariaDescribedBy?: string;
|
|
124
|
+
/** Optional leading text symbol displayed inside the input on the left (e.g. "$", "€", "kr"). */
|
|
125
|
+
leadingSymbol?: string;
|
|
126
|
+
};
|
|
62
127
|
/**
|
|
63
|
-
*
|
|
128
|
+
* InputField (Molecule) — Recommended
|
|
64
129
|
*
|
|
65
|
-
*
|
|
66
|
-
* -
|
|
67
|
-
* -
|
|
68
|
-
* -
|
|
69
|
-
* -
|
|
130
|
+
* A convenient, accessible wrapper around `Input` that provides:
|
|
131
|
+
* - a visible `<label>` wired via `htmlFor`/`id`
|
|
132
|
+
* - optional `helperText` and `error` regions
|
|
133
|
+
* - automatic `aria-describedby` wiring (helperText + error + any external ids)
|
|
134
|
+
* - automatic invalid state when `error` is present
|
|
70
135
|
*
|
|
71
|
-
*
|
|
136
|
+
* Use `InputField` for most forms. Use `Input` directly only when you need
|
|
137
|
+
* a highly custom layout or composite inputs.
|
|
138
|
+
*
|
|
139
|
+
* Accessibility
|
|
140
|
+
* - Generates a stable `id` via `useId()` when `id` is not provided.
|
|
141
|
+
* - Always renders a visible `<label>` element connected to the input control.
|
|
142
|
+
* - When `helperText` and/or `error` are present, it sets `aria-describedby`
|
|
143
|
+
* on the input to reference their ids.
|
|
144
|
+
* - When `error` is present, the input is marked invalid (aria-invalid).
|
|
145
|
+
* - Error region has `aria-live="polite"` for screen reader announcements.
|
|
146
|
+
*
|
|
147
|
+
* @example Minimal (recommended)
|
|
72
148
|
* ```tsx
|
|
73
|
-
*
|
|
149
|
+
* <InputField
|
|
150
|
+
* label="Email address"
|
|
151
|
+
* input={{ type: "email", placeholder: "you@example.com" }}
|
|
152
|
+
* />
|
|
153
|
+
* ```
|
|
74
154
|
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
155
|
+
* @example With helper text
|
|
156
|
+
* ```tsx
|
|
157
|
+
* <InputField
|
|
158
|
+
* label="Username"
|
|
159
|
+
* helperText="Choose a unique username between 3-20 characters."
|
|
160
|
+
* input={{ type: "text", placeholder: "johnsmith" }}
|
|
161
|
+
* />
|
|
162
|
+
* ```
|
|
163
|
+
*
|
|
164
|
+
* @example With error (invalid state)
|
|
165
|
+
* ```tsx
|
|
166
|
+
* <InputField
|
|
167
|
+
* label="Password"
|
|
168
|
+
* error="Password must be at least 8 characters."
|
|
169
|
+
* input={{ type: "password", required: true }}
|
|
170
|
+
* />
|
|
171
|
+
* ```
|
|
172
|
+
*
|
|
173
|
+
* @example Controlled
|
|
174
|
+
* ```tsx
|
|
175
|
+
* const [email, setEmail] = React.useState("");
|
|
176
|
+
*
|
|
177
|
+
* <InputField
|
|
178
|
+
* label="Email"
|
|
179
|
+
* input={{
|
|
180
|
+
* type: "email",
|
|
181
|
+
* value: email,
|
|
182
|
+
* onValueChange: setEmail,
|
|
183
|
+
* }}
|
|
184
|
+
* />
|
|
185
|
+
* ```
|
|
186
|
+
*
|
|
187
|
+
* @example Disabled
|
|
188
|
+
* ```tsx
|
|
189
|
+
* <InputField
|
|
190
|
+
* label="Account ID"
|
|
191
|
+
* helperText="This value cannot be changed."
|
|
192
|
+
* input={{ value: "ACC-12345", disabled: true }}
|
|
193
|
+
* />
|
|
194
|
+
* ```
|
|
195
|
+
*
|
|
196
|
+
* @example Read-only
|
|
197
|
+
* ```tsx
|
|
198
|
+
* <InputField
|
|
199
|
+
* label="Account created"
|
|
200
|
+
* input={{ value: "January 15, 2026", readOnly: true }}
|
|
201
|
+
* />
|
|
202
|
+
* ```
|
|
203
|
+
*
|
|
204
|
+
* @example Custom describedBy (merge with internal helper/error)
|
|
205
|
+
* ```tsx
|
|
206
|
+
* <InputField
|
|
207
|
+
* ariaDescribedBy="my-extra-help"
|
|
208
|
+
* label="API Key"
|
|
209
|
+
* helperText="Your key is stored securely."
|
|
210
|
+
* input={{ type: "password" }}
|
|
211
|
+
* />
|
|
212
|
+
*
|
|
213
|
+
* <div id="my-extra-help">This can be regenerated from your settings.</div>
|
|
78
214
|
* ```
|
|
79
215
|
*/
|
|
80
|
-
declare function
|
|
81
|
-
|
|
216
|
+
declare function InputField(props: InputFieldProps): React.ReactElement;
|
|
217
|
+
|
|
218
|
+
type InputOtpProps = Omit<InputOtpOptions, "describedBy"> & {
|
|
219
|
+
label: string;
|
|
220
|
+
helperText?: string;
|
|
221
|
+
error?: string;
|
|
222
|
+
ariaDescribedBy?: string;
|
|
223
|
+
onValueChange?: (value: string) => void;
|
|
224
|
+
className?: string;
|
|
225
|
+
};
|
|
226
|
+
declare function InputOtp(props: InputOtpProps): React.ReactElement;
|
|
227
|
+
|
|
228
|
+
type SelectFieldProps = {
|
|
229
|
+
id?: string;
|
|
230
|
+
label: string;
|
|
231
|
+
helperText?: string;
|
|
232
|
+
error?: string;
|
|
233
|
+
select: SelectProps;
|
|
234
|
+
ariaDescribedBy?: string;
|
|
235
|
+
};
|
|
236
|
+
declare function SelectField(props: SelectFieldProps): React.ReactElement;
|
|
237
|
+
|
|
238
|
+
type TextareaFieldProps = {
|
|
239
|
+
id?: string;
|
|
240
|
+
label: string;
|
|
241
|
+
helperText?: string;
|
|
242
|
+
error?: string;
|
|
243
|
+
textarea: TextareaProps;
|
|
244
|
+
ariaDescribedBy?: string;
|
|
245
|
+
};
|
|
246
|
+
declare function TextareaField(props: TextareaFieldProps): React.ReactElement;
|
|
247
|
+
|
|
248
|
+
type RichTextFieldProps = {
|
|
249
|
+
id?: string;
|
|
250
|
+
label: string;
|
|
251
|
+
helperText?: string;
|
|
252
|
+
error?: string;
|
|
253
|
+
editor: RichTextProps;
|
|
254
|
+
ariaDescribedBy?: string;
|
|
255
|
+
};
|
|
256
|
+
declare function RichTextField(props: RichTextFieldProps): React.ReactElement;
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Field Variants - AI-Friendly Components
|
|
260
|
+
*
|
|
261
|
+
* These variants encode best practices and automatically set AI-friendly
|
|
262
|
+
* metadata, making it easier for both developers and AI tools to understand
|
|
263
|
+
* the purpose and behavior of each field.
|
|
264
|
+
*
|
|
265
|
+
* Each variant manages its own purpose-specific logic (password toggle,
|
|
266
|
+
* search clear, etc.) and sets appropriate semantic attributes.
|
|
267
|
+
*/
|
|
268
|
+
type DropdownFieldProps = Omit<SelectFieldProps, "select"> & {
|
|
269
|
+
/**
|
|
270
|
+
* Select-specific props. Use `native` to opt back into the browser dropdown.
|
|
271
|
+
*/
|
|
272
|
+
select: Omit<SelectProps, "appearance"> & {
|
|
273
|
+
native?: boolean;
|
|
274
|
+
};
|
|
275
|
+
};
|
|
82
276
|
/**
|
|
83
|
-
*
|
|
277
|
+
* DropdownField - For the Figma-aligned dropdown presentation.
|
|
84
278
|
*
|
|
85
279
|
* **AI Context:**
|
|
86
|
-
* -
|
|
87
|
-
* -
|
|
88
|
-
* -
|
|
280
|
+
* - Reuses `SelectField` accessibility and state wiring
|
|
281
|
+
* - Defaults to the Marwes dropdown presentation
|
|
282
|
+
* - Allows `native={true}` to fall back to the browser dropdown
|
|
283
|
+
* - Adds `data-purpose="dropdown"` for semantic parsing
|
|
284
|
+
*
|
|
285
|
+
* **Features:**
|
|
286
|
+
* - Same label/helper/error contract as `SelectField`
|
|
287
|
+
* - Controlled and uncontrolled modes supported
|
|
288
|
+
* - Prevents API drift between generic select and dropdown styling
|
|
89
289
|
*
|
|
90
290
|
* @example
|
|
91
291
|
* ```tsx
|
|
92
|
-
* <
|
|
93
|
-
*
|
|
94
|
-
*
|
|
292
|
+
* <DropdownField
|
|
293
|
+
* label="Country"
|
|
294
|
+
* select={{
|
|
295
|
+
* placeholder: "Choose a country",
|
|
296
|
+
* options: [
|
|
297
|
+
* { value: "se", label: "Sweden" },
|
|
298
|
+
* { value: "us", label: "United States" },
|
|
299
|
+
* ],
|
|
300
|
+
* }}
|
|
301
|
+
* />
|
|
95
302
|
* ```
|
|
96
303
|
*/
|
|
97
|
-
declare function
|
|
98
|
-
type
|
|
304
|
+
declare function DropdownField(props: DropdownFieldProps): React.ReactElement;
|
|
305
|
+
type SearchFieldProps = Omit<InputFieldProps, "input"> & {
|
|
306
|
+
/**
|
|
307
|
+
* Input-specific props (type is auto-set to "search")
|
|
308
|
+
*/
|
|
309
|
+
input?: Omit<InputProps, "type">;
|
|
310
|
+
};
|
|
99
311
|
/**
|
|
100
|
-
*
|
|
312
|
+
* SearchField - For search inputs with an automatic search affordance and clear button.
|
|
101
313
|
*
|
|
102
314
|
* **AI Context:**
|
|
103
|
-
* - Sets `
|
|
104
|
-
* -
|
|
105
|
-
* -
|
|
315
|
+
* - Sets `type="search"` automatically
|
|
316
|
+
* - Sets `inputMode="search"` for mobile keyboards
|
|
317
|
+
* - Shows a search icon by default and a clear button (X icon) when field has content
|
|
318
|
+
* - Adds `data-purpose="search"` for AI parsing
|
|
106
319
|
*
|
|
107
|
-
*
|
|
320
|
+
* **Features:**
|
|
321
|
+
* - Automatic clear button that appears when typing
|
|
322
|
+
* - Native search input behavior
|
|
323
|
+
* - Optimized mobile keyboard
|
|
324
|
+
* - Controlled and uncontrolled modes supported
|
|
325
|
+
*
|
|
326
|
+
* @example Basic usage
|
|
108
327
|
* ```tsx
|
|
109
|
-
*
|
|
328
|
+
* import { SearchField } from "@marwes-ui/react";
|
|
329
|
+
*
|
|
330
|
+
* export function Example() {
|
|
331
|
+
* const [query, setQuery] = React.useState("");
|
|
332
|
+
* return (
|
|
333
|
+
* <SearchField
|
|
334
|
+
* label="Search products"
|
|
335
|
+
* input={{ value: query, onValueChange: setQuery }}
|
|
336
|
+
* />
|
|
337
|
+
* );
|
|
338
|
+
* }
|
|
110
339
|
* ```
|
|
111
340
|
*/
|
|
112
|
-
declare function
|
|
113
|
-
type
|
|
341
|
+
declare function SearchField(props: SearchFieldProps): React.ReactElement;
|
|
342
|
+
type PasswordFieldProps = Omit<InputFieldProps, "input"> & {
|
|
343
|
+
/**
|
|
344
|
+
* Input-specific props (type is auto-set to "password")
|
|
345
|
+
*/
|
|
346
|
+
input?: Omit<InputProps, "type">;
|
|
347
|
+
/**
|
|
348
|
+
* Autocomplete hint: "current-password" or "new-password"
|
|
349
|
+
* Defaults to "current-password"
|
|
350
|
+
*/
|
|
351
|
+
autoComplete?: "current-password" | "new-password";
|
|
352
|
+
};
|
|
114
353
|
/**
|
|
115
|
-
*
|
|
354
|
+
* PasswordField - For password inputs with automatic show/hide toggle.
|
|
116
355
|
*
|
|
117
356
|
* **AI Context:**
|
|
118
|
-
* - Sets `
|
|
119
|
-
* -
|
|
120
|
-
* -
|
|
357
|
+
* - Sets `type="password"` automatically (toggles to "text" when shown)
|
|
358
|
+
* - Shows eye/eyeOff icon toggle button
|
|
359
|
+
* - Sets appropriate `autoComplete` attribute
|
|
360
|
+
* - Adds `data-purpose="password"` for AI parsing
|
|
121
361
|
*
|
|
122
|
-
*
|
|
362
|
+
* **Features:**
|
|
363
|
+
* - Automatic show/hide toggle with eye icon
|
|
364
|
+
* - Proper autocomplete for password managers
|
|
365
|
+
* - Accessible toggle button with clear labels
|
|
366
|
+
* - Controlled and uncontrolled modes supported
|
|
367
|
+
*
|
|
368
|
+
* @example Basic usage
|
|
369
|
+
* ```tsx
|
|
370
|
+
* import { PasswordField } from "@marwes-ui/react";
|
|
371
|
+
*
|
|
372
|
+
* export function Example() {
|
|
373
|
+
* const [password, setPassword] = React.useState("");
|
|
374
|
+
* return (
|
|
375
|
+
* <PasswordField
|
|
376
|
+
* label="Password"
|
|
377
|
+
* input={{ value: password, onValueChange: setPassword }}
|
|
378
|
+
* />
|
|
379
|
+
* );
|
|
380
|
+
* }
|
|
381
|
+
* ```
|
|
382
|
+
*
|
|
383
|
+
* @example New password (signup/reset)
|
|
123
384
|
* ```tsx
|
|
124
|
-
* <
|
|
125
|
-
*
|
|
126
|
-
*
|
|
385
|
+
* <PasswordField
|
|
386
|
+
* label="New Password"
|
|
387
|
+
* autoComplete="new-password"
|
|
388
|
+
* helperText="Must be at least 8 characters"
|
|
389
|
+
* />
|
|
127
390
|
* ```
|
|
128
391
|
*/
|
|
129
|
-
declare function
|
|
130
|
-
type
|
|
392
|
+
declare function PasswordField(props: PasswordFieldProps): React.ReactElement;
|
|
393
|
+
type EmailFieldProps = Omit<InputFieldProps, "input"> & {
|
|
131
394
|
/**
|
|
132
|
-
*
|
|
395
|
+
* Input-specific props (type, inputMode, autoComplete auto-set)
|
|
133
396
|
*/
|
|
134
|
-
|
|
397
|
+
input?: Omit<InputProps, "type" | "inputMode" | "autoComplete">;
|
|
135
398
|
};
|
|
136
399
|
/**
|
|
137
|
-
*
|
|
400
|
+
* EmailField - For email address inputs with proper semantic attributes.
|
|
138
401
|
*
|
|
139
402
|
* **AI Context:**
|
|
140
|
-
* - Sets `
|
|
141
|
-
* -
|
|
142
|
-
* -
|
|
403
|
+
* - Sets `type="email"` for validation
|
|
404
|
+
* - Sets `inputMode="email"` for optimized mobile keyboard
|
|
405
|
+
* - Sets `autoComplete="email"` for autofill
|
|
406
|
+
* - Adds `data-purpose="email"` for AI parsing
|
|
407
|
+
*
|
|
408
|
+
* **Features:**
|
|
409
|
+
* - Browser email validation
|
|
410
|
+
* - Email-optimized mobile keyboard
|
|
411
|
+
* - Autofill support for email addresses
|
|
143
412
|
*
|
|
144
413
|
* @example
|
|
145
414
|
* ```tsx
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
415
|
+
* import { EmailField } from "@marwes-ui/react";
|
|
416
|
+
*
|
|
417
|
+
* <EmailField
|
|
418
|
+
* label="Email address"
|
|
419
|
+
* input={{ placeholder: "you@example.com" }}
|
|
420
|
+
* />
|
|
149
421
|
* ```
|
|
150
422
|
*/
|
|
151
|
-
declare function
|
|
152
|
-
type
|
|
423
|
+
declare function EmailField(props: EmailFieldProps): React.ReactElement;
|
|
424
|
+
type DateOfBirthFieldProps = Omit<InputFieldProps, "input"> & {
|
|
425
|
+
/**
|
|
426
|
+
* Input-specific props (type, inputMode, autoComplete auto-set)
|
|
427
|
+
*/
|
|
428
|
+
input?: Omit<InputProps, "type" | "inputMode" | "autoComplete">;
|
|
429
|
+
};
|
|
430
|
+
/**
|
|
431
|
+
* DateOfBirthField - For birthday inputs with native date semantics.
|
|
432
|
+
*
|
|
433
|
+
* **AI Context:**
|
|
434
|
+
* - Sets `type="date"` for native browser date controls
|
|
435
|
+
* - Sets `autoComplete="bday"` for profile/password-manager autofill
|
|
436
|
+
* - Adds `data-purpose="date-of-birth"` for AI parsing
|
|
437
|
+
*
|
|
438
|
+
* **Features:**
|
|
439
|
+
* - Native date picker where the platform supports it
|
|
440
|
+
* - ISO value handling (`YYYY-MM-DD`) for predictable form state
|
|
441
|
+
* - Keeps the same label/helper/error contract as `InputField`
|
|
442
|
+
*/
|
|
443
|
+
declare function DateOfBirthField(props: DateOfBirthFieldProps): React.ReactElement;
|
|
444
|
+
type ZipCodeFieldProps = Omit<InputFieldProps, "input"> & {
|
|
445
|
+
/**
|
|
446
|
+
* Input-specific props (type, inputMode, autoComplete auto-set)
|
|
447
|
+
*/
|
|
448
|
+
input?: Omit<InputProps, "type" | "inputMode" | "autoComplete">;
|
|
449
|
+
};
|
|
450
|
+
/**
|
|
451
|
+
* ZipCodeField - For postal/ZIP code inputs that should keep text semantics.
|
|
452
|
+
*
|
|
453
|
+
* **AI Context:**
|
|
454
|
+
* - Sets `type="text"` to preserve leading zeros
|
|
455
|
+
* - Sets `inputMode="numeric"` for the mobile number keypad
|
|
456
|
+
* - Sets `autoComplete="postal-code"` for address autofill
|
|
457
|
+
* - Adds `data-purpose="zip-code"` for AI parsing
|
|
458
|
+
*
|
|
459
|
+
* **Features:**
|
|
460
|
+
* - Low-regret default for US ZIP and broader postal-code entry
|
|
461
|
+
* - Avoids number-input quirks like spinner UI and lost leading zeroes
|
|
462
|
+
* - Keeps the same label/helper/error contract as `InputField`
|
|
463
|
+
*/
|
|
464
|
+
declare function ZipCodeField(props: ZipCodeFieldProps): React.ReactElement;
|
|
465
|
+
type PhoneFieldProps = Omit<InputFieldProps, "input"> & {
|
|
466
|
+
/**
|
|
467
|
+
* Input-specific props (type, inputMode, autoComplete auto-set)
|
|
468
|
+
*/
|
|
469
|
+
input?: Omit<InputProps, "type" | "inputMode" | "autoComplete">;
|
|
470
|
+
};
|
|
153
471
|
/**
|
|
154
|
-
*
|
|
472
|
+
* PhoneField - For phone number inputs with proper semantic attributes.
|
|
473
|
+
*
|
|
474
|
+
* **AI Context:**
|
|
475
|
+
* - Sets `type="tel"` for telephone input
|
|
476
|
+
* - Sets `inputMode="tel"` for phone keyboard
|
|
477
|
+
* - Sets `autoComplete="tel"` for autofill
|
|
478
|
+
* - Adds `data-purpose="phone"` for AI parsing
|
|
479
|
+
*
|
|
480
|
+
* **Features:**
|
|
481
|
+
* - Phone-optimized mobile keyboard
|
|
482
|
+
* - Autofill support for phone numbers
|
|
483
|
+
* - Accepts any phone format (formatting should be done externally)
|
|
155
484
|
*
|
|
156
485
|
* @example
|
|
157
486
|
* ```tsx
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
487
|
+
* import { PhoneField } from "@marwes-ui/react";
|
|
488
|
+
*
|
|
489
|
+
* <PhoneField
|
|
490
|
+
* label="Phone number"
|
|
491
|
+
* input={{ placeholder: "+1 (555) 000-0000" }}
|
|
492
|
+
* />
|
|
161
493
|
* ```
|
|
162
494
|
*/
|
|
163
|
-
declare function
|
|
164
|
-
type
|
|
495
|
+
declare function PhoneField(props: PhoneFieldProps): React.ReactElement;
|
|
496
|
+
type URLFieldProps = Omit<InputFieldProps, "input"> & {
|
|
497
|
+
/**
|
|
498
|
+
* Input-specific props (type, inputMode, autoComplete auto-set)
|
|
499
|
+
*/
|
|
500
|
+
input?: Omit<InputProps, "type" | "inputMode" | "autoComplete">;
|
|
501
|
+
};
|
|
165
502
|
/**
|
|
166
|
-
*
|
|
503
|
+
* URLField - For URL inputs with proper semantic attributes.
|
|
504
|
+
*
|
|
505
|
+
* **AI Context:**
|
|
506
|
+
* - Sets `type="url"` for URL validation
|
|
507
|
+
* - Sets `inputMode="url"` for URL keyboard
|
|
508
|
+
* - Sets `autoComplete="url"` for autofill
|
|
509
|
+
* - Adds `data-purpose="url"` for AI parsing
|
|
510
|
+
*
|
|
511
|
+
* **Features:**
|
|
512
|
+
* - Browser URL validation
|
|
513
|
+
* - URL-optimized mobile keyboard
|
|
514
|
+
* - Autofill support for URLs
|
|
167
515
|
*
|
|
168
516
|
* @example
|
|
169
517
|
* ```tsx
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
518
|
+
* import { URLField } from "@marwes-ui/react";
|
|
519
|
+
*
|
|
520
|
+
* <URLField
|
|
521
|
+
* label="Website"
|
|
522
|
+
* input={{ placeholder: "https://example.com" }}
|
|
523
|
+
* />
|
|
173
524
|
* ```
|
|
174
525
|
*/
|
|
175
|
-
declare function
|
|
176
|
-
type
|
|
526
|
+
declare function URLField(props: URLFieldProps): React.ReactElement;
|
|
527
|
+
type CurrencyFieldProps = Omit<InputFieldProps, "input"> & {
|
|
528
|
+
/**
|
|
529
|
+
* Input-specific props (type, inputMode auto-set)
|
|
530
|
+
*/
|
|
531
|
+
input?: Omit<InputProps, "type" | "inputMode">;
|
|
532
|
+
/**
|
|
533
|
+
* Currency code (e.g., "USD", "EUR", "GBP").
|
|
534
|
+
* Prefer `CurrencyCode` for autocomplete and Storybook controls.
|
|
535
|
+
* Unknown strings are tolerated and simply render without a leading symbol.
|
|
536
|
+
*/
|
|
537
|
+
currency?: CurrencyCode | string;
|
|
538
|
+
};
|
|
177
539
|
/**
|
|
178
|
-
*
|
|
540
|
+
* CurrencyField - For monetary amount inputs with currency context.
|
|
541
|
+
*
|
|
542
|
+
* **AI Context:**
|
|
543
|
+
* - Sets `type="text"` (better browser support than "number")
|
|
544
|
+
* - Sets `inputMode="decimal"` for numeric keyboard with decimal
|
|
545
|
+
* - Adds currency code to helper text if provided
|
|
546
|
+
* - Adds `data-purpose="currency"` and `data-currency` for AI parsing
|
|
547
|
+
*
|
|
548
|
+
* **Features:**
|
|
549
|
+
* - Decimal keyboard on mobile
|
|
550
|
+
* - Currency code display in helper text
|
|
551
|
+
* - Better input control than type="number"
|
|
552
|
+
* - Sanitizes values passed through `input.onValueChange`
|
|
553
|
+
* - Note: Formatting should be handled by parent component
|
|
554
|
+
*
|
|
555
|
+
* **Controlled usage recommended:**
|
|
556
|
+
* - Use `input.value` + `input.onValueChange` when you need guaranteed sanitized state
|
|
557
|
+
* - In uncontrolled usage, the callback still receives sanitized values, but the DOM input may temporarily display unsanitized text
|
|
179
558
|
*
|
|
180
559
|
* @example
|
|
181
560
|
* ```tsx
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
*
|
|
561
|
+
* import { CurrencyField } from "@marwes-ui/react";
|
|
562
|
+
*
|
|
563
|
+
* <CurrencyField
|
|
564
|
+
* label="Amount"
|
|
565
|
+
* currency="USD"
|
|
566
|
+
* input={{
|
|
567
|
+
* value: amount,
|
|
568
|
+
* onValueChange: setAmount,
|
|
569
|
+
* placeholder: "0.00",
|
|
570
|
+
* }}
|
|
571
|
+
* />
|
|
185
572
|
* ```
|
|
186
573
|
*/
|
|
187
|
-
declare function
|
|
188
|
-
|
|
189
|
-
type InputProps = InputOptions & {
|
|
190
|
-
onValueChange?: (value: string) => void;
|
|
191
|
-
className?: string;
|
|
192
|
-
};
|
|
193
|
-
declare function Input(props: InputProps): react_jsx_runtime.JSX.Element;
|
|
574
|
+
declare function CurrencyField(props: CurrencyFieldProps): React.ReactElement;
|
|
194
575
|
|
|
195
576
|
type IconName = keyof typeof iconRegistry;
|
|
196
577
|
type IconProps = {
|
|
197
578
|
name: IconName;
|
|
198
579
|
/**
|
|
199
|
-
*
|
|
580
|
+
* Icon scale token ("xs"|"sm"|"md"|"lg") or an explicit pixel size.
|
|
200
581
|
* Defaults to system.theme.icon.size
|
|
201
582
|
*/
|
|
202
583
|
size?: IconSize | number;
|
|
203
584
|
/**
|
|
204
|
-
*
|
|
585
|
+
* Stroke-width token ("xs"|"sm"|"md"|"lg") or an explicit numeric stroke width.
|
|
205
586
|
* Defaults to system.theme.icon.strokeWidth
|
|
206
587
|
*/
|
|
207
588
|
strokeWidth?: IconStrokeWidth | number;
|
|
@@ -214,7 +595,34 @@ type IconProps = {
|
|
|
214
595
|
};
|
|
215
596
|
declare function Icon({ name, size, strokeWidth, className, "aria-label": ariaLabel, decorative, }: IconProps): react_jsx_runtime.JSX.Element;
|
|
216
597
|
|
|
217
|
-
|
|
598
|
+
interface AvatarProps extends AvatarOptions, Omit<React.HTMLAttributes<HTMLSpanElement>, "children"> {
|
|
599
|
+
dataAttributes?: Record<string, string>;
|
|
600
|
+
}
|
|
601
|
+
declare function Avatar(props: AvatarProps): React.ReactElement;
|
|
602
|
+
|
|
603
|
+
interface AvatarBadgeProps extends AvatarProps {
|
|
604
|
+
statusLabel?: string;
|
|
605
|
+
}
|
|
606
|
+
declare function AvatarBadge(props: AvatarBadgeProps): React.ReactElement;
|
|
607
|
+
|
|
608
|
+
interface AvatarGroupItem extends Omit<AvatarProps, "size" | "className" | "style"> {
|
|
609
|
+
id?: string;
|
|
610
|
+
}
|
|
611
|
+
interface AvatarGroupProps extends Omit<React.HTMLAttributes<HTMLFieldSetElement>, "children"> {
|
|
612
|
+
items: AvatarGroupItem[];
|
|
613
|
+
overflowCount?: number;
|
|
614
|
+
overflowLabel?: string;
|
|
615
|
+
ariaLabel?: string;
|
|
616
|
+
dataAttributes?: Record<string, string>;
|
|
617
|
+
}
|
|
618
|
+
declare function AvatarGroup(props: AvatarGroupProps): React.ReactElement;
|
|
619
|
+
|
|
620
|
+
type ProfileAvatarProps = AvatarProps;
|
|
621
|
+
declare function ProfileAvatar(props: ProfileAvatarProps): React.ReactElement;
|
|
622
|
+
type PresenceAvatarProps = AvatarBadgeProps;
|
|
623
|
+
declare function PresenceAvatar(props: PresenceAvatarProps): React.ReactElement;
|
|
624
|
+
type TeamAvatarGroupProps = AvatarGroupProps;
|
|
625
|
+
declare function TeamAvatarGroup(props: TeamAvatarGroupProps): React.ReactElement;
|
|
218
626
|
|
|
219
627
|
/**
|
|
220
628
|
* React adapter for Marwes Checkbox.
|
|
@@ -299,14 +707,142 @@ type CheckboxProps = CheckboxProps$1 & {
|
|
|
299
707
|
*/
|
|
300
708
|
declare function Checkbox(props: CheckboxProps): React.ReactElement;
|
|
301
709
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
710
|
+
type CheckboxFieldProps = {
|
|
711
|
+
/** Optional: if omitted, we generate one via useId(). */
|
|
712
|
+
id?: string;
|
|
713
|
+
/** Field content (rendered by adapter). */
|
|
714
|
+
label: React.ReactNode;
|
|
715
|
+
description?: React.ReactNode;
|
|
716
|
+
error?: React.ReactNode;
|
|
717
|
+
/** Props forwarded to the Checkbox atom. */
|
|
718
|
+
checkbox: CheckboxProps;
|
|
719
|
+
/** Additional aria-describedby IDs to merge with internal description/error IDs. */
|
|
720
|
+
ariaDescribedBy?: string;
|
|
721
|
+
};
|
|
722
|
+
/**
|
|
723
|
+
* CheckboxField (Molecule) — Recommended
|
|
724
|
+
*
|
|
725
|
+
* A convenient, accessible wrapper around `Checkbox` that provides:
|
|
726
|
+
* - a clickable `<label>` wired via `htmlFor`/`id`
|
|
727
|
+
* - optional `description` and `error` regions
|
|
728
|
+
* - automatic `aria-describedby` wiring (description + error + any external ids)
|
|
729
|
+
* - automatic invalid state when `error` is present
|
|
730
|
+
*
|
|
731
|
+
* Use `CheckboxField` for most forms. Use `Checkbox` directly only when you need
|
|
732
|
+
* a highly custom layout (tables, list rows, compound list items, etc.).
|
|
733
|
+
*
|
|
734
|
+
* Accessibility
|
|
735
|
+
* - Generates a stable `id` via `useId()` when `id` is not provided.
|
|
736
|
+
* - Always renders a real `<label>` element connected to the checkbox control.
|
|
737
|
+
* - When `description` and/or `error` are present, it sets `aria-describedby`
|
|
738
|
+
* on the checkbox to reference their ids.
|
|
739
|
+
* - When `error` is present, the checkbox is marked invalid (aria-invalid via core).
|
|
740
|
+
*
|
|
741
|
+
* @example Minimal (recommended)
|
|
742
|
+
* ```tsx
|
|
743
|
+
* <CheckboxField
|
|
744
|
+
* label="Subscribe to updates"
|
|
745
|
+
* checkbox={{ defaultChecked: true }}
|
|
746
|
+
* />
|
|
747
|
+
* ```
|
|
748
|
+
*
|
|
749
|
+
* @example With description
|
|
750
|
+
* ```tsx
|
|
751
|
+
* <CheckboxField
|
|
752
|
+
* label="Subscribe to updates"
|
|
753
|
+
* description="We'll only email you about important product changes."
|
|
754
|
+
* checkbox={{}}
|
|
755
|
+
* />
|
|
756
|
+
* ```
|
|
757
|
+
*
|
|
758
|
+
* @example With error (invalid state)
|
|
759
|
+
* ```tsx
|
|
760
|
+
* <CheckboxField
|
|
761
|
+
* label="Accept terms"
|
|
762
|
+
* error="You must accept the terms to continue."
|
|
763
|
+
* checkbox={{ required: true }}
|
|
764
|
+
* />
|
|
765
|
+
* ```
|
|
766
|
+
*
|
|
767
|
+
* @example Controlled
|
|
768
|
+
* ```tsx
|
|
769
|
+
* const [checked, setChecked] = React.useState(false);
|
|
770
|
+
*
|
|
771
|
+
* <CheckboxField
|
|
772
|
+
* label="Accept terms"
|
|
773
|
+
* checkbox={{
|
|
774
|
+
* checked,
|
|
775
|
+
* onCheckedChange: setChecked,
|
|
776
|
+
* }}
|
|
777
|
+
* />
|
|
778
|
+
* ```
|
|
779
|
+
*
|
|
780
|
+
* @example Indeterminate (mixed)
|
|
781
|
+
* ```tsx
|
|
782
|
+
* const [checked, setChecked] = React.useState(false);
|
|
783
|
+
* const [mixed, setMixed] = React.useState(true);
|
|
784
|
+
*
|
|
785
|
+
* <CheckboxField
|
|
786
|
+
* label="Select all"
|
|
787
|
+
* description="Applies to all items in the current view."
|
|
788
|
+
* checkbox={{
|
|
789
|
+
* checked,
|
|
790
|
+
* indeterminate: mixed,
|
|
791
|
+
* onCheckedChange: (next) => {
|
|
792
|
+
* setMixed(false);
|
|
793
|
+
* setChecked(next);
|
|
794
|
+
* },
|
|
795
|
+
* }}
|
|
796
|
+
* />
|
|
797
|
+
* ```
|
|
798
|
+
*
|
|
799
|
+
* @example Custom describedBy (merge with internal description/error)
|
|
800
|
+
* ```tsx
|
|
801
|
+
* <CheckboxField
|
|
802
|
+
* ariaDescribedBy="my-extra-help"
|
|
803
|
+
* label="Enable telemetry"
|
|
804
|
+
* description="Helps us improve the product."
|
|
805
|
+
* checkbox={{}}
|
|
806
|
+
* />
|
|
807
|
+
*
|
|
808
|
+
* <div id="my-extra-help">This setting can be changed later.</div>
|
|
809
|
+
* ```
|
|
810
|
+
*/
|
|
811
|
+
declare function CheckboxField(props: CheckboxFieldProps): React.ReactElement;
|
|
812
|
+
|
|
813
|
+
interface CheckboxGroupFieldOption {
|
|
814
|
+
value: string;
|
|
815
|
+
label: React.ReactNode;
|
|
816
|
+
disabled?: boolean;
|
|
817
|
+
indeterminate?: boolean;
|
|
818
|
+
}
|
|
819
|
+
type CheckboxGroupFieldCheckboxProps = Omit<CheckboxProps, "ariaDescribedBy" | "ariaLabel" | "ariaLabelledBy" | "checked" | "defaultChecked" | "disabled" | "id" | "indeterminate" | "invalid" | "name" | "onChange" | "onCheckedChange" | "required" | "value">;
|
|
820
|
+
interface CheckboxGroupFieldProps {
|
|
821
|
+
label: React.ReactNode;
|
|
822
|
+
options: CheckboxGroupFieldOption[];
|
|
823
|
+
description?: React.ReactNode;
|
|
824
|
+
error?: React.ReactNode;
|
|
825
|
+
value?: string[];
|
|
826
|
+
onChange?: (value: string[]) => void;
|
|
827
|
+
defaultValue?: string[];
|
|
828
|
+
checkbox?: CheckboxGroupFieldCheckboxProps;
|
|
829
|
+
disabled?: boolean;
|
|
830
|
+
required?: boolean;
|
|
831
|
+
name?: string;
|
|
832
|
+
id?: string;
|
|
833
|
+
ariaDescribedBy?: string;
|
|
834
|
+
dataAttributes?: Record<string, string>;
|
|
835
|
+
}
|
|
836
|
+
declare function CheckboxGroupField(props: CheckboxGroupFieldProps): React.ReactElement;
|
|
837
|
+
|
|
838
|
+
/**
|
|
839
|
+
* React adapter for Marwes Divider component.
|
|
840
|
+
* - Renders semantic <hr> using the core divider recipe.
|
|
841
|
+
* - Supports 7 size variants: xxs/xs/sm/md/lg/xl/xxl.
|
|
842
|
+
* - Supports horizontal and vertical orientation.
|
|
843
|
+
* - Figma reference: component 1574:21053
|
|
844
|
+
*/
|
|
845
|
+
|
|
310
846
|
type DividerProps = DividerOptions & Omit<React.HTMLAttributes<HTMLHRElement>, "children"> & {
|
|
311
847
|
/**
|
|
312
848
|
* Size variant for the divider.
|
|
@@ -382,6 +918,127 @@ declare const Divider: React.ForwardRefExoticComponent<DividerOptions & Omit<Rea
|
|
|
382
918
|
style?: React.CSSProperties;
|
|
383
919
|
} & React.RefAttributes<HTMLHRElement>>;
|
|
384
920
|
|
|
921
|
+
interface SpinnerProps extends SpinnerOptions, Omit<React.HTMLAttributes<HTMLSpanElement>, "children"> {
|
|
922
|
+
dataAttributes?: Record<string, string>;
|
|
923
|
+
}
|
|
924
|
+
declare function Spinner(props: SpinnerProps): React.ReactElement;
|
|
925
|
+
|
|
926
|
+
type ButtonSpinnerProps = SpinnerProps & {
|
|
927
|
+
inverted?: boolean;
|
|
928
|
+
};
|
|
929
|
+
declare function ButtonSpinner(props: ButtonSpinnerProps): React.ReactElement;
|
|
930
|
+
type EmptyStateSpinnerProps = SpinnerProps;
|
|
931
|
+
declare function EmptyStateSpinner(props: EmptyStateSpinnerProps): React.ReactElement;
|
|
932
|
+
|
|
933
|
+
/**
|
|
934
|
+
* React adapter for Marwes Spacing component.
|
|
935
|
+
* - Renders a decorative, aria-hidden div using the core spacing recipe.
|
|
936
|
+
* - Inserts a fixed vertical gap driven by the --mw-spacing-* token scale.
|
|
937
|
+
*/
|
|
938
|
+
|
|
939
|
+
type SpacingProps = SpacingOptions & Omit<React.HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
940
|
+
/**
|
|
941
|
+
* Size variant for the spacing.
|
|
942
|
+
* Maps to token values: sp-0=0px, sp-2=2px, sp-4=4px, sp-8=8px,
|
|
943
|
+
* sp-16=16px, sp-24=24px, sp-32=32px, up to sp-120=120px.
|
|
944
|
+
* @default "sp-24"
|
|
945
|
+
*/
|
|
946
|
+
size?: SpacingSize;
|
|
947
|
+
/**
|
|
948
|
+
* Ergonomic alias for `size`.
|
|
949
|
+
* Prefer this on `Spacer` for readable layout code.
|
|
950
|
+
*/
|
|
951
|
+
spacing?: SpacingSize;
|
|
952
|
+
/**
|
|
953
|
+
* Additional CSS class names.
|
|
954
|
+
*/
|
|
955
|
+
className?: string;
|
|
956
|
+
/**
|
|
957
|
+
* Inline styles.
|
|
958
|
+
*/
|
|
959
|
+
style?: React.CSSProperties;
|
|
960
|
+
};
|
|
961
|
+
type SpacerProps = SpacingProps;
|
|
962
|
+
/**
|
|
963
|
+
* Spacing
|
|
964
|
+
*
|
|
965
|
+
* Pure layout primitive that inserts a fixed vertical gap between elements.
|
|
966
|
+
* Driven by the design token scale — no magic numbers required.
|
|
967
|
+
*
|
|
968
|
+
* @example Basic usage (24px gap)
|
|
969
|
+
* ```tsx
|
|
970
|
+
* <Spacing />
|
|
971
|
+
* ```
|
|
972
|
+
*
|
|
973
|
+
* @example Semantic size
|
|
974
|
+
* ```tsx
|
|
975
|
+
* <H1>Hello</H1>
|
|
976
|
+
* <Spacing size={Spacings.sp24} />
|
|
977
|
+
* <Paragraph>World</Paragraph>
|
|
978
|
+
* ```
|
|
979
|
+
*
|
|
980
|
+
* @example All sizes
|
|
981
|
+
* ```tsx
|
|
982
|
+
* <Spacing size="sp-2" /> // 2px
|
|
983
|
+
* <Spacing size="sp-8" /> // 8px
|
|
984
|
+
* <Spacing size="sp-32" /> // 32px
|
|
985
|
+
* ```
|
|
986
|
+
*/
|
|
987
|
+
declare const Spacing: React.ForwardRefExoticComponent<SpacingOptions & Omit<React.HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
988
|
+
/**
|
|
989
|
+
* Size variant for the spacing.
|
|
990
|
+
* Maps to token values: sp-0=0px, sp-2=2px, sp-4=4px, sp-8=8px,
|
|
991
|
+
* sp-16=16px, sp-24=24px, sp-32=32px, up to sp-120=120px.
|
|
992
|
+
* @default "sp-24"
|
|
993
|
+
*/
|
|
994
|
+
size?: SpacingSize;
|
|
995
|
+
/**
|
|
996
|
+
* Ergonomic alias for `size`.
|
|
997
|
+
* Prefer this on `Spacer` for readable layout code.
|
|
998
|
+
*/
|
|
999
|
+
spacing?: SpacingSize;
|
|
1000
|
+
/**
|
|
1001
|
+
* Additional CSS class names.
|
|
1002
|
+
*/
|
|
1003
|
+
className?: string;
|
|
1004
|
+
/**
|
|
1005
|
+
* Inline styles.
|
|
1006
|
+
*/
|
|
1007
|
+
style?: React.CSSProperties;
|
|
1008
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
1009
|
+
/**
|
|
1010
|
+
* Spacer
|
|
1011
|
+
*
|
|
1012
|
+
* Alias for `Spacing` with a layout-oriented prop name.
|
|
1013
|
+
*
|
|
1014
|
+
* @example
|
|
1015
|
+
* ```tsx
|
|
1016
|
+
* <Spacer spacing={Spacings.sp24} />
|
|
1017
|
+
* ```
|
|
1018
|
+
*/
|
|
1019
|
+
declare const Spacer: React.ForwardRefExoticComponent<SpacingOptions & Omit<React.HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
1020
|
+
/**
|
|
1021
|
+
* Size variant for the spacing.
|
|
1022
|
+
* Maps to token values: sp-0=0px, sp-2=2px, sp-4=4px, sp-8=8px,
|
|
1023
|
+
* sp-16=16px, sp-24=24px, sp-32=32px, up to sp-120=120px.
|
|
1024
|
+
* @default "sp-24"
|
|
1025
|
+
*/
|
|
1026
|
+
size?: SpacingSize;
|
|
1027
|
+
/**
|
|
1028
|
+
* Ergonomic alias for `size`.
|
|
1029
|
+
* Prefer this on `Spacer` for readable layout code.
|
|
1030
|
+
*/
|
|
1031
|
+
spacing?: SpacingSize;
|
|
1032
|
+
/**
|
|
1033
|
+
* Additional CSS class names.
|
|
1034
|
+
*/
|
|
1035
|
+
className?: string;
|
|
1036
|
+
/**
|
|
1037
|
+
* Inline styles.
|
|
1038
|
+
*/
|
|
1039
|
+
style?: React.CSSProperties;
|
|
1040
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
1041
|
+
|
|
385
1042
|
/**
|
|
386
1043
|
* React adapter for Marwes H1 component.
|
|
387
1044
|
* - Renders semantic <h1> using the core heading recipe.
|
|
@@ -568,212 +1225,883 @@ type ParagraphProps = ParagraphOptions & {
|
|
|
568
1225
|
*/
|
|
569
1226
|
declare function Paragraph(props: ParagraphProps): React.ReactElement;
|
|
570
1227
|
|
|
571
|
-
|
|
572
|
-
/** Optional
|
|
1228
|
+
interface CardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
1229
|
+
/** Optional title rendered above the body content */
|
|
1230
|
+
title?: React.ReactNode;
|
|
1231
|
+
/** Card body content */
|
|
1232
|
+
children?: React.ReactNode;
|
|
1233
|
+
/** Data attributes for AI-friendly metadata (used by purpose variants). */
|
|
1234
|
+
dataAttributes?: Record<string, string>;
|
|
1235
|
+
}
|
|
1236
|
+
declare function Card(props: CardProps): React.ReactElement;
|
|
1237
|
+
|
|
1238
|
+
type ProductCardProps = CardProps;
|
|
1239
|
+
declare function ProductCard(props: ProductCardProps): React.ReactElement;
|
|
1240
|
+
type ProfileCardProps = CardProps;
|
|
1241
|
+
declare function ProfileCard(props: ProfileCardProps): React.ReactElement;
|
|
1242
|
+
type StatCardProps = CardProps;
|
|
1243
|
+
declare function StatCard(props: StatCardProps): React.ReactElement;
|
|
1244
|
+
|
|
1245
|
+
interface ToastProps extends ToastOptions {
|
|
1246
|
+
/** Main notification message */
|
|
1247
|
+
children: React.ReactNode;
|
|
1248
|
+
/** Icon element shown on the left (e.g. an <Icon> component) */
|
|
1249
|
+
icon?: React.ReactNode;
|
|
1250
|
+
/** Action element shown inline after the message (e.g. a text action or <a>) */
|
|
1251
|
+
action?: React.ReactNode;
|
|
1252
|
+
/** When provided, renders a dismiss (×) button and calls this on click */
|
|
1253
|
+
onDismiss?: () => void;
|
|
1254
|
+
className?: string;
|
|
573
1255
|
id?: string;
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
1256
|
+
dataAttributes?: Record<string, string>;
|
|
1257
|
+
}
|
|
1258
|
+
declare function Toast(props: ToastProps): React.ReactElement;
|
|
1259
|
+
|
|
1260
|
+
interface ManagedToast {
|
|
1261
|
+
id: string;
|
|
1262
|
+
children: React.ReactNode;
|
|
1263
|
+
icon?: React.ReactNode;
|
|
1264
|
+
action?: React.ReactNode;
|
|
1265
|
+
onDismiss?: () => void;
|
|
1266
|
+
className?: string;
|
|
1267
|
+
variant?: ToastVariant;
|
|
1268
|
+
ariaLive?: "polite" | "assertive";
|
|
1269
|
+
intent?: ToastIntent;
|
|
1270
|
+
duration?: number | null;
|
|
1271
|
+
dataAttributes?: Record<string, string>;
|
|
1272
|
+
}
|
|
1273
|
+
type ShowToastOptions = Omit<ManagedToast, "id">;
|
|
1274
|
+
interface ToastContainerProps {
|
|
1275
|
+
toasts: ManagedToast[];
|
|
1276
|
+
placement?: ToastPlacement;
|
|
1277
|
+
maxVisible?: number;
|
|
1278
|
+
className?: string;
|
|
1279
|
+
onDismiss?: (id: string) => void;
|
|
1280
|
+
}
|
|
1281
|
+
interface ToastProviderProps {
|
|
1282
|
+
children: React.ReactNode;
|
|
1283
|
+
placement?: ToastPlacement;
|
|
1284
|
+
maxVisible?: number;
|
|
1285
|
+
defaultDuration?: number | null;
|
|
1286
|
+
className?: string;
|
|
1287
|
+
}
|
|
1288
|
+
interface ToastController {
|
|
1289
|
+
show: (toast: ShowToastOptions) => string;
|
|
1290
|
+
dismiss: (id: string) => void;
|
|
1291
|
+
clear: () => void;
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
declare function ToastContainer(props: ToastContainerProps): React.ReactElement;
|
|
1295
|
+
|
|
1296
|
+
declare function ToastProvider(props: ToastProviderProps): React.ReactElement;
|
|
1297
|
+
declare function useToast(): ToastController;
|
|
1298
|
+
|
|
1299
|
+
type SuccessToastProps = ToastProps;
|
|
1300
|
+
declare function SuccessToast(props: SuccessToastProps): React.ReactElement;
|
|
1301
|
+
type ErrorToastProps = ToastProps;
|
|
1302
|
+
declare function ErrorToast(props: ErrorToastProps): React.ReactElement;
|
|
1303
|
+
type WarningToastProps = ToastProps;
|
|
1304
|
+
declare function WarningToast(props: WarningToastProps): React.ReactElement;
|
|
1305
|
+
type InfoToastProps = ToastProps;
|
|
1306
|
+
declare function InfoToast(props: InfoToastProps): React.ReactElement;
|
|
1307
|
+
|
|
1308
|
+
interface TooltipProps extends TooltipOptions, Omit<React.HTMLAttributes<HTMLSpanElement>, "children"> {
|
|
1309
|
+
children: React.ReactNode;
|
|
1310
|
+
dataAttributes?: Record<string, string>;
|
|
1311
|
+
}
|
|
1312
|
+
declare function Tooltip(props: TooltipProps): React.ReactElement;
|
|
1313
|
+
|
|
1314
|
+
interface TooltipGroupProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, "content"> {
|
|
1315
|
+
content: React.ReactNode;
|
|
1316
|
+
icon?: IconNameType;
|
|
1317
|
+
triggerLabel?: string;
|
|
1318
|
+
open?: boolean;
|
|
1319
|
+
defaultOpen?: boolean;
|
|
1320
|
+
onOpenChange?: (open: boolean) => void;
|
|
1321
|
+
tooltipId?: string;
|
|
1322
|
+
tooltipClassName?: string;
|
|
1323
|
+
triggerClassName?: string;
|
|
1324
|
+
dataAttributes?: Record<string, string>;
|
|
1325
|
+
}
|
|
1326
|
+
declare function TooltipGroup(props: TooltipGroupProps): React.ReactElement;
|
|
1327
|
+
|
|
583
1328
|
/**
|
|
584
|
-
*
|
|
1329
|
+
* React adapter for Marwes Accordion.
|
|
1330
|
+
* - Renders a compound structure: wrapper div > trigger button + panel div.
|
|
1331
|
+
* - id is optional; falls back to React.useId() for aria wiring.
|
|
1332
|
+
*/
|
|
1333
|
+
|
|
1334
|
+
interface AccordionProps {
|
|
1335
|
+
/** Unique id for aria wiring. Defaults to React.useId() when omitted. */
|
|
1336
|
+
id?: string;
|
|
1337
|
+
open?: boolean;
|
|
1338
|
+
disabled?: boolean;
|
|
1339
|
+
/** Content of the trigger button header */
|
|
1340
|
+
title: React.ReactNode;
|
|
1341
|
+
/** Content shown in the collapsible panel */
|
|
1342
|
+
children: React.ReactNode;
|
|
1343
|
+
className?: string;
|
|
1344
|
+
/** Called when the trigger is clicked */
|
|
1345
|
+
onToggle?: () => void;
|
|
1346
|
+
}
|
|
1347
|
+
declare function Accordion(props: AccordionProps): React.ReactElement;
|
|
1348
|
+
|
|
1349
|
+
/**
|
|
1350
|
+
* AccordionField (Molecule) — Recommended
|
|
585
1351
|
*
|
|
586
|
-
*
|
|
587
|
-
*
|
|
588
|
-
* - optional `description` and `error` regions
|
|
589
|
-
* - automatic `aria-describedby` wiring (description + error + any external ids)
|
|
590
|
-
* - automatic invalid state when `error` is present
|
|
1352
|
+
* An accessible accordion group with field semantics: group label, optional
|
|
1353
|
+
* description, optional error, and coordinated open-state management.
|
|
591
1354
|
*
|
|
592
|
-
*
|
|
593
|
-
* a
|
|
1355
|
+
* Composes `Accordion` atoms into a `role="group"` container with:
|
|
1356
|
+
* - a visible label wired via `aria-labelledby`
|
|
1357
|
+
* - optional `description` and `error` regions
|
|
1358
|
+
* - automatic `aria-describedby` wiring (description + error + external IDs)
|
|
1359
|
+
* - automatic `aria-invalid` when `error` is present
|
|
1360
|
+
* - controlled (`openItems` + `onOpenItemsChange`) or uncontrolled (`defaultOpenItems`) state
|
|
1361
|
+
* - single-open (`multiple=false`, default) or multi-open (`multiple=true`) behaviour
|
|
594
1362
|
*
|
|
595
|
-
*
|
|
596
|
-
*
|
|
597
|
-
* - Always renders a real `<label>` element connected to the checkbox control.
|
|
598
|
-
* - When `description` and/or `error` are present, it sets `aria-describedby`
|
|
599
|
-
* on the checkbox to reference their ids.
|
|
600
|
-
* - When `error` is present, the checkbox is marked invalid (aria-invalid via core).
|
|
1363
|
+
* Use `AccordionField` for most accordion groups. Use `Accordion` directly only
|
|
1364
|
+
* when you need a standalone collapsible panel outside of group semantics.
|
|
601
1365
|
*
|
|
602
|
-
* @example
|
|
1366
|
+
* @example Basic (uncontrolled, single-open)
|
|
603
1367
|
* ```tsx
|
|
604
|
-
* <
|
|
605
|
-
* label="
|
|
606
|
-
*
|
|
1368
|
+
* <AccordionField
|
|
1369
|
+
* label="FAQ"
|
|
1370
|
+
* items={[
|
|
1371
|
+
* { value: "q1", title: "What is Marwes?", content: <p>A design system.</p> },
|
|
1372
|
+
* { value: "q2", title: "Is it free?", content: <p>Yes.</p> },
|
|
1373
|
+
* ]}
|
|
1374
|
+
* defaultOpenItems={["q1"]}
|
|
607
1375
|
* />
|
|
608
1376
|
* ```
|
|
609
1377
|
*
|
|
610
|
-
* @example
|
|
1378
|
+
* @example Multi-open, controlled
|
|
611
1379
|
* ```tsx
|
|
612
|
-
* <
|
|
613
|
-
*
|
|
614
|
-
*
|
|
615
|
-
*
|
|
1380
|
+
* const [open, setOpen] = React.useState<string[]>([]);
|
|
1381
|
+
*
|
|
1382
|
+
* <AccordionField
|
|
1383
|
+
* label="Settings"
|
|
1384
|
+
* items={settingsItems}
|
|
1385
|
+
* openItems={open}
|
|
1386
|
+
* onOpenItemsChange={setOpen}
|
|
1387
|
+
* multiple
|
|
616
1388
|
* />
|
|
617
1389
|
* ```
|
|
1390
|
+
*/
|
|
1391
|
+
|
|
1392
|
+
interface AccordionFieldItem {
|
|
1393
|
+
value: string;
|
|
1394
|
+
title: React.ReactNode;
|
|
1395
|
+
content?: React.ReactNode;
|
|
1396
|
+
/** @deprecated Use `content` instead for cross-framework parity. */
|
|
1397
|
+
children?: React.ReactNode;
|
|
1398
|
+
disabled?: boolean;
|
|
1399
|
+
}
|
|
1400
|
+
interface AccordionFieldProps {
|
|
1401
|
+
/** Visible label for the accordion group. */
|
|
1402
|
+
label: React.ReactNode;
|
|
1403
|
+
/** Optional description text below the label. */
|
|
1404
|
+
description?: React.ReactNode;
|
|
1405
|
+
/** Error message. When present, sets aria-invalid on the group. */
|
|
1406
|
+
error?: React.ReactNode;
|
|
1407
|
+
/** Accordion items to render. */
|
|
1408
|
+
items: AccordionFieldItem[];
|
|
1409
|
+
/** Allow multiple items open simultaneously. Defaults to `true`. */
|
|
1410
|
+
multiple?: boolean;
|
|
1411
|
+
/** Controlled: currently open item values. */
|
|
1412
|
+
openItems?: string[];
|
|
1413
|
+
/** Controlled: called with the new open-items array when state changes. */
|
|
1414
|
+
onOpenItemsChange?: (openItems: string[]) => void;
|
|
1415
|
+
/** Uncontrolled: initially open item values. */
|
|
1416
|
+
defaultOpenItems?: string[];
|
|
1417
|
+
/** Disables all accordion items. */
|
|
1418
|
+
disabled?: boolean;
|
|
1419
|
+
/** Explicit ID. If omitted, generated via useId(). */
|
|
1420
|
+
id?: string;
|
|
1421
|
+
/** Additional aria-describedby IDs to merge with internal description/error IDs. */
|
|
1422
|
+
ariaDescribedBy?: string;
|
|
1423
|
+
/** Data attributes for AI-friendly metadata (used by context variants). */
|
|
1424
|
+
dataAttributes?: Record<string, string>;
|
|
1425
|
+
}
|
|
1426
|
+
declare function AccordionField(props: AccordionFieldProps): React.ReactElement;
|
|
1427
|
+
|
|
1428
|
+
/**
|
|
1429
|
+
* Purpose Components — Accordion
|
|
618
1430
|
*
|
|
619
|
-
*
|
|
620
|
-
*
|
|
621
|
-
*
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
*
|
|
1431
|
+
* Pre-configured accordion compositions that encode a specific semantic purpose.
|
|
1432
|
+
* Each sets `data-purpose` for machine-readable intent while keeping the
|
|
1433
|
+
* visual `variant` prop for presentation only.
|
|
1434
|
+
*/
|
|
1435
|
+
type FAQAccordionProps = Omit<AccordionFieldProps, "multiple">;
|
|
1436
|
+
/**
|
|
1437
|
+
* FAQAccordion - For question-and-answer sections.
|
|
1438
|
+
*
|
|
1439
|
+
* **AI Context:**
|
|
1440
|
+
* - Enforces single-open behaviour (opening one closes others)
|
|
1441
|
+
* - Adds `data-purpose="faq"` for AI parsing
|
|
1442
|
+
* - Ideal for FAQ pages, help sections, knowledge bases
|
|
1443
|
+
*
|
|
1444
|
+
* @example
|
|
1445
|
+
* ```tsx
|
|
1446
|
+
* import { FAQAccordion } from "@marwes-ui/react";
|
|
1447
|
+
*
|
|
1448
|
+
* export function Example() {
|
|
1449
|
+
* return (
|
|
1450
|
+
* <FAQAccordion
|
|
1451
|
+
* label="Frequently Asked Questions"
|
|
1452
|
+
* items={[
|
|
1453
|
+
* { value: "q1", title: "What is Marwes?", content: <p>A design system.</p> },
|
|
1454
|
+
* { value: "q2", title: "Is it free?", content: <p>Yes.</p> },
|
|
1455
|
+
* ]}
|
|
1456
|
+
* defaultOpenItems={["q1"]}
|
|
1457
|
+
* />
|
|
1458
|
+
* );
|
|
1459
|
+
* }
|
|
626
1460
|
* ```
|
|
1461
|
+
*/
|
|
1462
|
+
declare function FAQAccordion(props: FAQAccordionProps): React.ReactElement;
|
|
1463
|
+
type SettingsAccordionProps = Omit<AccordionFieldProps, "multiple">;
|
|
1464
|
+
/**
|
|
1465
|
+
* SettingsAccordion - For configuration and settings panels.
|
|
627
1466
|
*
|
|
628
|
-
*
|
|
1467
|
+
* **AI Context:**
|
|
1468
|
+
* - Enforces multi-open behaviour (multiple sections open simultaneously)
|
|
1469
|
+
* - Adds `data-purpose="settings"` for AI parsing
|
|
1470
|
+
* - Ideal for preferences, admin panels, configuration forms
|
|
1471
|
+
*
|
|
1472
|
+
* @example
|
|
629
1473
|
* ```tsx
|
|
630
|
-
*
|
|
1474
|
+
* import { SettingsAccordion } from "@marwes-ui/react";
|
|
631
1475
|
*
|
|
632
|
-
*
|
|
633
|
-
*
|
|
634
|
-
*
|
|
635
|
-
*
|
|
636
|
-
*
|
|
637
|
-
*
|
|
1476
|
+
* export function Example() {
|
|
1477
|
+
* return (
|
|
1478
|
+
* <SettingsAccordion
|
|
1479
|
+
* label="Account Settings"
|
|
1480
|
+
* items={[
|
|
1481
|
+
* { value: "profile", title: "Profile", content: <ProfileForm /> },
|
|
1482
|
+
* { value: "notifications", title: "Notifications", content: <NotificationsForm /> },
|
|
1483
|
+
* { value: "privacy", title: "Privacy", content: <PrivacyForm /> },
|
|
1484
|
+
* ]}
|
|
1485
|
+
* />
|
|
1486
|
+
* );
|
|
1487
|
+
* }
|
|
1488
|
+
* ```
|
|
1489
|
+
*/
|
|
1490
|
+
declare function SettingsAccordion(props: SettingsAccordionProps): React.ReactElement;
|
|
1491
|
+
type SectionsAccordionProps = AccordionFieldProps;
|
|
1492
|
+
/**
|
|
1493
|
+
* SectionsAccordion - For generic collapsible content sections.
|
|
1494
|
+
*
|
|
1495
|
+
* **AI Context:**
|
|
1496
|
+
* - Same API as `AccordionField` with `data-purpose="sections"` for AI parsing
|
|
1497
|
+
* - Defaults to multi-open but can be overridden with `multiple={false}`
|
|
1498
|
+
* - Use when no more specific purpose component fits
|
|
1499
|
+
* - Documentation, product details, order breakdowns
|
|
1500
|
+
*
|
|
1501
|
+
* @example
|
|
1502
|
+
* ```tsx
|
|
1503
|
+
* import { SectionsAccordion } from "@marwes-ui/react";
|
|
1504
|
+
*
|
|
1505
|
+
* export function Example() {
|
|
1506
|
+
* return (
|
|
1507
|
+
* <SectionsAccordion
|
|
1508
|
+
* label="Product Details"
|
|
1509
|
+
* items={[
|
|
1510
|
+
* { value: "desc", title: "Description", content: <p>Full description.</p> },
|
|
1511
|
+
* { value: "specs", title: "Specifications", content: <SpecsTable /> },
|
|
1512
|
+
* { value: "reviews", title: "Reviews", content: <ReviewsList /> },
|
|
1513
|
+
* ]}
|
|
1514
|
+
* />
|
|
1515
|
+
* );
|
|
1516
|
+
* }
|
|
1517
|
+
* ```
|
|
1518
|
+
*/
|
|
1519
|
+
declare function SectionsAccordion(props: SectionsAccordionProps): React.ReactElement;
|
|
1520
|
+
|
|
1521
|
+
/**
|
|
1522
|
+
* React adapter for Marwes Radio.
|
|
1523
|
+
* - Renders a native <input type="radio"> using the core render kit.
|
|
1524
|
+
* - Applies strict a11y fields and modifier classes.
|
|
1525
|
+
*/
|
|
1526
|
+
|
|
1527
|
+
type RadioProps = RadioOptions & {
|
|
1528
|
+
/**
|
|
1529
|
+
* Called with the next checked value when the user selects this radio.
|
|
1530
|
+
* In a group, only the newly selected radio fires `true`.
|
|
1531
|
+
*/
|
|
1532
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
1533
|
+
/** Raw event access escape hatch. */
|
|
1534
|
+
onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
1535
|
+
};
|
|
1536
|
+
/**
|
|
1537
|
+
* Radio (Atom)
|
|
1538
|
+
*
|
|
1539
|
+
* Low-level radio control built on a native `<input type="radio">`.
|
|
1540
|
+
* Use this when you need custom layout or when the label/grouping is handled
|
|
1541
|
+
* elsewhere (e.g. inside a list item, table row, or custom field wrapper).
|
|
1542
|
+
*
|
|
1543
|
+
* For most forms, prefer `RadioGroupField`, which composes `Radio` with
|
|
1544
|
+
* group label/description/error wiring, selection state, and consistent spacing.
|
|
1545
|
+
*
|
|
1546
|
+
* **AI Context:**
|
|
1547
|
+
* - Renders a native `<input type="radio">` using the core `radioRecipe`
|
|
1548
|
+
* - Applies strict a11y attributes: `aria-label`, `aria-labelledby`, `aria-describedby`, `aria-invalid`
|
|
1549
|
+
* - Supports controlled (`checked` + `onCheckedChange`) and uncontrolled (`defaultChecked`) modes
|
|
1550
|
+
* - Modifier classes: `mw-radio`, `mw-radio--disabled`, `mw-radio--invalid`
|
|
1551
|
+
*
|
|
1552
|
+
* Accessibility:
|
|
1553
|
+
* - Provide **either** `ariaLabel` **or** `ariaLabelledBy` (or wrap with a `<label htmlFor>`).
|
|
1554
|
+
* - Use the same `name` attribute on all radios in a group for native keyboard navigation.
|
|
1555
|
+
* - Use `ariaDescribedBy` to connect supporting text (help/error).
|
|
1556
|
+
*
|
|
1557
|
+
* @example Basic (uncontrolled)
|
|
1558
|
+
* ```tsx
|
|
1559
|
+
* <Radio ariaLabel="Option A" name="preference" defaultChecked />
|
|
1560
|
+
* ```
|
|
1561
|
+
*
|
|
1562
|
+
* @example Controlled
|
|
1563
|
+
* ```tsx
|
|
1564
|
+
* const [selected, setSelected] = React.useState("a");
|
|
1565
|
+
*
|
|
1566
|
+
* <Radio
|
|
1567
|
+
* name="color"
|
|
1568
|
+
* value="a"
|
|
1569
|
+
* checked={selected === "a"}
|
|
1570
|
+
* onCheckedChange={(checked) => { if (checked) setSelected("a"); }}
|
|
1571
|
+
* ariaLabel="Red"
|
|
638
1572
|
* />
|
|
639
1573
|
* ```
|
|
640
1574
|
*
|
|
641
|
-
* @example
|
|
1575
|
+
* @example With external label
|
|
642
1576
|
* ```tsx
|
|
643
|
-
* const
|
|
644
|
-
* const [mixed, setMixed] = React.useState(true);
|
|
1577
|
+
* const id = "opt-1";
|
|
645
1578
|
*
|
|
646
|
-
* <
|
|
647
|
-
*
|
|
648
|
-
*
|
|
649
|
-
*
|
|
650
|
-
*
|
|
651
|
-
*
|
|
652
|
-
*
|
|
653
|
-
*
|
|
654
|
-
*
|
|
655
|
-
*
|
|
656
|
-
* }
|
|
1579
|
+
* <div style={{ display: "flex", alignItems: "center", gap: 8 }}>
|
|
1580
|
+
* <Radio id={id} name="group" value="a" />
|
|
1581
|
+
* <label htmlFor={id}>Option A</label>
|
|
1582
|
+
* </div>
|
|
1583
|
+
* ```
|
|
1584
|
+
*
|
|
1585
|
+
* @example In a group (manual)
|
|
1586
|
+
* ```tsx
|
|
1587
|
+
* const [selected, setSelected] = React.useState("a");
|
|
1588
|
+
* const options = [
|
|
1589
|
+
* { value: "a", label: "Option A" },
|
|
1590
|
+
* { value: "b", label: "Option B" },
|
|
1591
|
+
* ];
|
|
1592
|
+
*
|
|
1593
|
+
* <div role="radiogroup" aria-label="Preference">
|
|
1594
|
+
* {options.map(({ value, label }) => (
|
|
1595
|
+
* <label key={value}>
|
|
1596
|
+
* <Radio
|
|
1597
|
+
* name="preference"
|
|
1598
|
+
* value={value}
|
|
1599
|
+
* checked={selected === value}
|
|
1600
|
+
* onCheckedChange={(checked) => { if (checked) setSelected(value); }}
|
|
1601
|
+
* />
|
|
1602
|
+
* {label}
|
|
1603
|
+
* </label>
|
|
1604
|
+
* ))}
|
|
1605
|
+
* </div>
|
|
1606
|
+
* ```
|
|
1607
|
+
*/
|
|
1608
|
+
declare function Radio(props: RadioProps): React.ReactElement;
|
|
1609
|
+
|
|
1610
|
+
/**
|
|
1611
|
+
* RadioGroupField (Molecule) — Recommended
|
|
1612
|
+
*
|
|
1613
|
+
* An accessible radio group with field semantics: group label, optional
|
|
1614
|
+
* description, optional error, and selection state management.
|
|
1615
|
+
*
|
|
1616
|
+
* Composes `Radio` atoms into a `role="radiogroup"` container with:
|
|
1617
|
+
* - a visible label wired via `aria-labelledby`
|
|
1618
|
+
* - optional `description` and `error` regions
|
|
1619
|
+
* - automatic `aria-describedby` wiring (description + error + external IDs)
|
|
1620
|
+
* - automatic `aria-invalid` when `error` is present
|
|
1621
|
+
* - controlled (`value` + `onChange`) or uncontrolled (`defaultValue`) state
|
|
1622
|
+
*
|
|
1623
|
+
* Use `RadioGroupField` for most forms. Use `Radio` directly only when you
|
|
1624
|
+
* need a highly custom layout (tables, list rows, compound list items, etc.).
|
|
1625
|
+
*
|
|
1626
|
+
* **AI Context:**
|
|
1627
|
+
* - Renders `role="radiogroup"` with proper ARIA wiring
|
|
1628
|
+
* - Manages selection state for child Radio atoms
|
|
1629
|
+
* - All child radios share the same `name` for native keyboard navigation
|
|
1630
|
+
* - Supports both controlled and uncontrolled patterns
|
|
1631
|
+
*
|
|
1632
|
+
* @example Basic (uncontrolled)
|
|
1633
|
+
* ```tsx
|
|
1634
|
+
* <RadioGroupField
|
|
1635
|
+
* name="color"
|
|
1636
|
+
* label="Favorite color"
|
|
1637
|
+
* options={[
|
|
1638
|
+
* { value: "red", label: "Red" },
|
|
1639
|
+
* { value: "blue", label: "Blue" },
|
|
1640
|
+
* { value: "green", label: "Green" },
|
|
1641
|
+
* ]}
|
|
1642
|
+
* defaultValue="red"
|
|
657
1643
|
* />
|
|
658
1644
|
* ```
|
|
659
1645
|
*
|
|
660
|
-
* @example
|
|
1646
|
+
* @example Controlled
|
|
661
1647
|
* ```tsx
|
|
662
|
-
*
|
|
663
|
-
*
|
|
664
|
-
*
|
|
665
|
-
*
|
|
666
|
-
*
|
|
1648
|
+
* const [color, setColor] = React.useState("red");
|
|
1649
|
+
*
|
|
1650
|
+
* <RadioGroupField
|
|
1651
|
+
* name="color"
|
|
1652
|
+
* label="Favorite color"
|
|
1653
|
+
* options={[
|
|
1654
|
+
* { value: "red", label: "Red" },
|
|
1655
|
+
* { value: "blue", label: "Blue" },
|
|
1656
|
+
* ]}
|
|
1657
|
+
* value={color}
|
|
1658
|
+
* onChange={setColor}
|
|
667
1659
|
* />
|
|
1660
|
+
* ```
|
|
668
1661
|
*
|
|
669
|
-
*
|
|
1662
|
+
* @example With description and error
|
|
1663
|
+
* ```tsx
|
|
1664
|
+
* <RadioGroupField
|
|
1665
|
+
* name="plan"
|
|
1666
|
+
* label="Select a plan"
|
|
1667
|
+
* description="Choose the plan that best fits your needs."
|
|
1668
|
+
* error="Please select a plan to continue."
|
|
1669
|
+
* options={[
|
|
1670
|
+
* { value: "free", label: "Free" },
|
|
1671
|
+
* { value: "pro", label: "Pro" },
|
|
1672
|
+
* ]}
|
|
1673
|
+
* />
|
|
670
1674
|
* ```
|
|
671
1675
|
*/
|
|
672
|
-
declare function CheckboxField(props: CheckboxFieldProps): React.ReactElement;
|
|
673
1676
|
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
id?: string;
|
|
677
|
-
/** Field label (required for accessibility). */
|
|
1677
|
+
interface RadioGroupFieldOption {
|
|
1678
|
+
value: string;
|
|
678
1679
|
label: React.ReactNode;
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
1680
|
+
disabled?: boolean;
|
|
1681
|
+
}
|
|
1682
|
+
interface RadioGroupFieldProps {
|
|
1683
|
+
/** Shared name for all radio inputs in the group. */
|
|
1684
|
+
name: string;
|
|
1685
|
+
/** Visible label for the radio group. */
|
|
1686
|
+
label: React.ReactNode;
|
|
1687
|
+
/** Optional description text below the label. */
|
|
1688
|
+
description?: React.ReactNode;
|
|
1689
|
+
/** Error message. When present, sets aria-invalid on the group. */
|
|
682
1690
|
error?: React.ReactNode;
|
|
683
|
-
/**
|
|
684
|
-
|
|
685
|
-
/**
|
|
1691
|
+
/** Controlled: current selected value. */
|
|
1692
|
+
value?: string;
|
|
1693
|
+
/** Controlled: called with the new value when selection changes. */
|
|
1694
|
+
onChange?: (value: string) => void;
|
|
1695
|
+
/** Uncontrolled: initial selected value. */
|
|
1696
|
+
defaultValue?: string;
|
|
1697
|
+
/** Radio options to render. */
|
|
1698
|
+
options: RadioGroupFieldOption[];
|
|
1699
|
+
/** Disables all radio inputs in the group. */
|
|
1700
|
+
disabled?: boolean;
|
|
1701
|
+
/** Marks the group as required. */
|
|
1702
|
+
required?: boolean;
|
|
1703
|
+
/** Explicit ID. If omitted, generated via useId(). */
|
|
1704
|
+
id?: string;
|
|
1705
|
+
/** Additional aria-describedby IDs to merge with internal description/error IDs. */
|
|
686
1706
|
ariaDescribedBy?: string;
|
|
1707
|
+
/** Data attributes for AI-friendly metadata (used by context variants). */
|
|
1708
|
+
dataAttributes?: Record<string, string>;
|
|
1709
|
+
}
|
|
1710
|
+
declare function RadioGroupField(props: RadioGroupFieldProps): React.ReactElement;
|
|
1711
|
+
|
|
1712
|
+
/**
|
|
1713
|
+
* Purpose Components — Radio Group
|
|
1714
|
+
*
|
|
1715
|
+
* Pre-configured radio group compositions that encode a specific semantic purpose.
|
|
1716
|
+
* Each sets `data-purpose` for machine-readable intent while keeping the
|
|
1717
|
+
* visual `variant` prop for presentation only.
|
|
1718
|
+
*/
|
|
1719
|
+
type YesNoRadioGroupProps = Omit<RadioGroupFieldProps, "options"> & {
|
|
1720
|
+
/** Label for the "Yes" option. Defaults to "Yes". */
|
|
1721
|
+
yesLabel?: React.ReactNode;
|
|
1722
|
+
/** Label for the "No" option. Defaults to "No". */
|
|
1723
|
+
noLabel?: React.ReactNode;
|
|
687
1724
|
};
|
|
688
1725
|
/**
|
|
689
|
-
*
|
|
1726
|
+
* YesNoRadioGroup - For binary yes/no choices.
|
|
690
1727
|
*
|
|
691
|
-
*
|
|
692
|
-
* -
|
|
693
|
-
* -
|
|
694
|
-
* -
|
|
695
|
-
* - automatic invalid state when `error` is present
|
|
1728
|
+
* **AI Context:**
|
|
1729
|
+
* - Pre-built options with values `"yes"` and `"no"`
|
|
1730
|
+
* - Adds `data-purpose="binary-choice"` for AI parsing
|
|
1731
|
+
* - Labels customizable via `yesLabel` / `noLabel`
|
|
696
1732
|
*
|
|
697
|
-
*
|
|
698
|
-
*
|
|
1733
|
+
* @example
|
|
1734
|
+
* ```tsx
|
|
1735
|
+
* import { YesNoRadioGroup } from "@marwes-ui/react";
|
|
699
1736
|
*
|
|
700
|
-
*
|
|
701
|
-
*
|
|
702
|
-
*
|
|
703
|
-
*
|
|
704
|
-
*
|
|
705
|
-
*
|
|
706
|
-
*
|
|
1737
|
+
* export function Example() {
|
|
1738
|
+
* return (
|
|
1739
|
+
* <YesNoRadioGroup
|
|
1740
|
+
* name="accept-terms"
|
|
1741
|
+
* label="Do you accept the terms?"
|
|
1742
|
+
* defaultValue="no"
|
|
1743
|
+
* />
|
|
1744
|
+
* );
|
|
1745
|
+
* }
|
|
1746
|
+
* ```
|
|
707
1747
|
*
|
|
708
|
-
* @example
|
|
1748
|
+
* @example Custom labels
|
|
709
1749
|
* ```tsx
|
|
710
|
-
* <
|
|
711
|
-
*
|
|
712
|
-
*
|
|
1750
|
+
* <YesNoRadioGroup
|
|
1751
|
+
* name="newsletter"
|
|
1752
|
+
* label="Subscribe to newsletter?"
|
|
1753
|
+
* yesLabel="Subscribe"
|
|
1754
|
+
* noLabel="No thanks"
|
|
713
1755
|
* />
|
|
714
1756
|
* ```
|
|
1757
|
+
*/
|
|
1758
|
+
declare function YesNoRadioGroup(props: YesNoRadioGroupProps): React.ReactElement;
|
|
1759
|
+
type RatingRadioGroupProps = Omit<RadioGroupFieldProps, "options"> & {
|
|
1760
|
+
/** Minimum value (inclusive). Defaults to 1. */
|
|
1761
|
+
min?: number;
|
|
1762
|
+
/** Maximum value (inclusive). Defaults to 5. */
|
|
1763
|
+
max?: number;
|
|
1764
|
+
/** Custom label function. Receives the numeric value, returns a label. Defaults to `String(value)`. */
|
|
1765
|
+
labelFn?: (value: number) => React.ReactNode;
|
|
1766
|
+
};
|
|
1767
|
+
/**
|
|
1768
|
+
* RatingRadioGroup - For numeric scale selections.
|
|
1769
|
+
*
|
|
1770
|
+
* **AI Context:**
|
|
1771
|
+
* - Generates options from `min` to `max` (default 1–5)
|
|
1772
|
+
* - Values are string representations of numbers ("1", "2", etc.)
|
|
1773
|
+
* - Adds `data-purpose="rating"` for AI parsing
|
|
1774
|
+
* - Custom labels via `labelFn`
|
|
1775
|
+
*
|
|
1776
|
+
* @example
|
|
1777
|
+
* ```tsx
|
|
1778
|
+
* import { RatingRadioGroup } from "@marwes-ui/react";
|
|
1779
|
+
*
|
|
1780
|
+
* export function Example() {
|
|
1781
|
+
* return (
|
|
1782
|
+
* <RatingRadioGroup
|
|
1783
|
+
* name="satisfaction"
|
|
1784
|
+
* label="How satisfied are you?"
|
|
1785
|
+
* defaultValue="3"
|
|
1786
|
+
* />
|
|
1787
|
+
* );
|
|
1788
|
+
* }
|
|
1789
|
+
* ```
|
|
715
1790
|
*
|
|
716
|
-
* @example
|
|
1791
|
+
* @example Custom range and labels
|
|
717
1792
|
* ```tsx
|
|
718
|
-
* <
|
|
719
|
-
*
|
|
720
|
-
*
|
|
721
|
-
*
|
|
1793
|
+
* <RatingRadioGroup
|
|
1794
|
+
* name="priority"
|
|
1795
|
+
* label="Priority level"
|
|
1796
|
+
* min={1}
|
|
1797
|
+
* max={3}
|
|
1798
|
+
* labelFn={(v) => ["Low", "Medium", "High"][v - 1]}
|
|
722
1799
|
* />
|
|
723
1800
|
* ```
|
|
1801
|
+
*/
|
|
1802
|
+
declare function RatingRadioGroup(props: RatingRadioGroupProps): React.ReactElement;
|
|
1803
|
+
type OptionRadioGroupProps = RadioGroupFieldProps;
|
|
1804
|
+
/**
|
|
1805
|
+
* OptionRadioGroup - For general labeled option selection.
|
|
724
1806
|
*
|
|
725
|
-
*
|
|
1807
|
+
* **AI Context:**
|
|
1808
|
+
* - Same API as `RadioGroupField` with `data-purpose="selection"` for AI parsing
|
|
1809
|
+
* - Use when no more specific purpose component fits
|
|
1810
|
+
* - Preferences, categories, modes, or any custom option list
|
|
1811
|
+
*
|
|
1812
|
+
* @example
|
|
726
1813
|
* ```tsx
|
|
727
|
-
*
|
|
728
|
-
*
|
|
729
|
-
*
|
|
730
|
-
*
|
|
731
|
-
*
|
|
1814
|
+
* import { OptionRadioGroup } from "@marwes-ui/react";
|
|
1815
|
+
*
|
|
1816
|
+
* export function Example() {
|
|
1817
|
+
* return (
|
|
1818
|
+
* <OptionRadioGroup
|
|
1819
|
+
* name="theme"
|
|
1820
|
+
* label="Select theme"
|
|
1821
|
+
* options={[
|
|
1822
|
+
* { value: "light", label: "Light" },
|
|
1823
|
+
* { value: "dark", label: "Dark" },
|
|
1824
|
+
* { value: "system", label: "System" },
|
|
1825
|
+
* ]}
|
|
1826
|
+
* defaultValue="system"
|
|
1827
|
+
* />
|
|
1828
|
+
* );
|
|
1829
|
+
* }
|
|
732
1830
|
* ```
|
|
1831
|
+
*/
|
|
1832
|
+
declare function OptionRadioGroup(props: OptionRadioGroupProps): React.ReactElement;
|
|
1833
|
+
|
|
1834
|
+
type BadgeProps = BadgeOptions & {
|
|
1835
|
+
children?: React.ReactNode;
|
|
1836
|
+
className?: string;
|
|
1837
|
+
id?: string;
|
|
1838
|
+
/** Data attributes for AI-friendly metadata (used by context variants). */
|
|
1839
|
+
dataAttributes?: Record<string, string>;
|
|
1840
|
+
};
|
|
1841
|
+
declare function Badge(props: BadgeProps): React.ReactElement;
|
|
1842
|
+
|
|
1843
|
+
/**
|
|
1844
|
+
* BadgeGroup (Molecule) — Recommended
|
|
733
1845
|
*
|
|
734
|
-
*
|
|
1846
|
+
* An accessible badge group with a visible label. Groups related badges
|
|
1847
|
+
* into a `role="group"` container with `aria-labelledby` wiring.
|
|
1848
|
+
*
|
|
1849
|
+
* Use `BadgeGroup` when displaying multiple related badges together
|
|
1850
|
+
* (e.g. a list of tags, status indicators, or categories).
|
|
1851
|
+
* Use `Badge` directly only when a single standalone badge is needed.
|
|
1852
|
+
*
|
|
1853
|
+
* @example
|
|
735
1854
|
* ```tsx
|
|
736
|
-
*
|
|
1855
|
+
* import { BadgeVariant } from "@marwes-ui/core";
|
|
737
1856
|
*
|
|
738
|
-
* <
|
|
739
|
-
*
|
|
740
|
-
*
|
|
741
|
-
*
|
|
742
|
-
* value: email,
|
|
743
|
-
* onValueChange: setEmail,
|
|
744
|
-
* }}
|
|
745
|
-
* />
|
|
1857
|
+
* <BadgeGroup label="Status">
|
|
1858
|
+
* <Badge variant={BadgeVariant.success}>Active</Badge>
|
|
1859
|
+
* <Badge variant={BadgeVariant.warning}>Pending review</Badge>
|
|
1860
|
+
* </BadgeGroup>
|
|
746
1861
|
* ```
|
|
1862
|
+
*/
|
|
1863
|
+
|
|
1864
|
+
interface BadgeGroupProps {
|
|
1865
|
+
/** Visible label for the badge group. */
|
|
1866
|
+
label: React.ReactNode;
|
|
1867
|
+
/** Badge children to render inside the group. */
|
|
1868
|
+
children: React.ReactNode;
|
|
1869
|
+
/** Additional CSS class names. */
|
|
1870
|
+
className?: string;
|
|
1871
|
+
/** Explicit ID. If omitted, generated via useId(). */
|
|
1872
|
+
id?: string;
|
|
1873
|
+
/** Data attributes for AI-friendly metadata (used by context variants). */
|
|
1874
|
+
dataAttributes?: Record<string, string>;
|
|
1875
|
+
}
|
|
1876
|
+
declare function BadgeGroup(props: BadgeGroupProps): React.ReactElement;
|
|
1877
|
+
|
|
1878
|
+
/**
|
|
1879
|
+
* Purpose Components — Badge
|
|
747
1880
|
*
|
|
748
|
-
*
|
|
1881
|
+
* Pre-configured badge compositions that encode a specific semantic purpose.
|
|
1882
|
+
* Each sets `data-purpose` for machine-readable intent while keeping the
|
|
1883
|
+
* visual `variant` prop for presentation only.
|
|
1884
|
+
*/
|
|
1885
|
+
|
|
1886
|
+
type StatusBadgeProps = BadgeProps;
|
|
1887
|
+
/**
|
|
1888
|
+
* StatusBadge - For operational or lifecycle status indicators.
|
|
1889
|
+
*
|
|
1890
|
+
* **AI Context:**
|
|
1891
|
+
* - Adds `data-purpose="status"` for AI parsing
|
|
1892
|
+
* - Ideal for active/inactive, online/offline, enabled/disabled states
|
|
1893
|
+
*
|
|
1894
|
+
* @example
|
|
749
1895
|
* ```tsx
|
|
750
|
-
*
|
|
751
|
-
*
|
|
752
|
-
*
|
|
753
|
-
*
|
|
754
|
-
* />
|
|
1896
|
+
* import { BadgeVariant } from "@marwes-ui/core";
|
|
1897
|
+
*
|
|
1898
|
+
* <StatusBadge variant={BadgeVariant.success}>Active</StatusBadge>
|
|
1899
|
+
* <StatusBadge variant={BadgeVariant.error}>Offline</StatusBadge>
|
|
755
1900
|
* ```
|
|
1901
|
+
*/
|
|
1902
|
+
declare function StatusBadge(props: StatusBadgeProps): React.ReactElement;
|
|
1903
|
+
type PriorityBadgeProps = BadgeProps;
|
|
1904
|
+
/**
|
|
1905
|
+
* PriorityBadge - For urgency or importance indicators.
|
|
756
1906
|
*
|
|
757
|
-
*
|
|
1907
|
+
* **AI Context:**
|
|
1908
|
+
* - Adds `data-purpose="priority"` for AI parsing
|
|
1909
|
+
* - Ideal for critical/high/medium/low priority labels
|
|
1910
|
+
*
|
|
1911
|
+
* @example
|
|
758
1912
|
* ```tsx
|
|
759
|
-
*
|
|
760
|
-
*
|
|
761
|
-
*
|
|
762
|
-
*
|
|
1913
|
+
* import { BadgeVariant } from "@marwes-ui/core";
|
|
1914
|
+
*
|
|
1915
|
+
* <PriorityBadge variant={BadgeVariant.error}>Critical</PriorityBadge>
|
|
1916
|
+
* <PriorityBadge variant={BadgeVariant.warning}>High</PriorityBadge>
|
|
763
1917
|
* ```
|
|
1918
|
+
*/
|
|
1919
|
+
declare function PriorityBadge(props: PriorityBadgeProps): React.ReactElement;
|
|
1920
|
+
type NotificationBadgeProps = BadgeProps;
|
|
1921
|
+
/**
|
|
1922
|
+
* NotificationBadge - For notification counts and alert indicators.
|
|
764
1923
|
*
|
|
765
|
-
*
|
|
1924
|
+
* **AI Context:**
|
|
1925
|
+
* - Adds `data-purpose="notification"` for AI parsing
|
|
1926
|
+
* - Ideal for unread counts, new items, alert badges
|
|
1927
|
+
* - Always provide `ariaLabel` for numeric-only content
|
|
1928
|
+
*
|
|
1929
|
+
* @example
|
|
766
1930
|
* ```tsx
|
|
767
|
-
*
|
|
768
|
-
* ariaDescribedBy="my-extra-help"
|
|
769
|
-
* label="API Key"
|
|
770
|
-
* helperText="Your key is stored securely."
|
|
771
|
-
* input={{ type: "password" }}
|
|
772
|
-
* />
|
|
1931
|
+
* import { BadgeVariant } from "@marwes-ui/core";
|
|
773
1932
|
*
|
|
774
|
-
* <
|
|
1933
|
+
* <NotificationBadge variant={BadgeVariant.info} ariaLabel="5 unread messages">5</NotificationBadge>
|
|
775
1934
|
* ```
|
|
776
1935
|
*/
|
|
777
|
-
declare function
|
|
1936
|
+
declare function NotificationBadge(props: NotificationBadgeProps): React.ReactElement;
|
|
1937
|
+
|
|
1938
|
+
type SwitchProps = SwitchOptions & {
|
|
1939
|
+
/** Label text rendered next to the toggle */
|
|
1940
|
+
children?: React.ReactNode;
|
|
1941
|
+
className?: string;
|
|
1942
|
+
id?: string;
|
|
1943
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
1944
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
1945
|
+
};
|
|
1946
|
+
declare function Switch(props: SwitchProps): React.ReactElement;
|
|
1947
|
+
|
|
1948
|
+
type SwitchFieldProps = {
|
|
1949
|
+
id?: string;
|
|
1950
|
+
label: React.ReactNode;
|
|
1951
|
+
description?: React.ReactNode;
|
|
1952
|
+
error?: React.ReactNode;
|
|
1953
|
+
switch: SwitchProps;
|
|
1954
|
+
ariaDescribedBy?: string;
|
|
1955
|
+
dataAttributes?: Record<string, string>;
|
|
1956
|
+
};
|
|
1957
|
+
declare function SwitchField(props: SwitchFieldProps): React.ReactElement;
|
|
1958
|
+
|
|
1959
|
+
type FeatureToggleProps = SwitchFieldProps;
|
|
1960
|
+
declare function FeatureToggle(props: FeatureToggleProps): React.ReactElement;
|
|
1961
|
+
type PreferenceSwitchProps = SwitchFieldProps;
|
|
1962
|
+
declare function PreferenceSwitch(props: PreferenceSwitchProps): React.ReactElement;
|
|
1963
|
+
type PermissionSwitchProps = SwitchFieldProps;
|
|
1964
|
+
declare function PermissionSwitch(props: PermissionSwitchProps): React.ReactElement;
|
|
1965
|
+
|
|
1966
|
+
type NativeSliderProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, "className" | "defaultValue" | "max" | "min" | "onChange" | "step" | "style" | "type" | "value">;
|
|
1967
|
+
type SliderProps = SliderOptions & NativeSliderProps & {
|
|
1968
|
+
className?: string;
|
|
1969
|
+
style?: React.CSSProperties;
|
|
1970
|
+
onValueChange?: (value: number) => void;
|
|
1971
|
+
onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
1972
|
+
};
|
|
1973
|
+
declare const Slider: React.ForwardRefExoticComponent<SliderOptions & NativeSliderProps & {
|
|
1974
|
+
className?: string;
|
|
1975
|
+
style?: React.CSSProperties;
|
|
1976
|
+
onValueChange?: (value: number) => void;
|
|
1977
|
+
onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
1978
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
1979
|
+
|
|
1980
|
+
type SliderFieldLabelPosition = "top" | "inline";
|
|
1981
|
+
type SliderFieldProps = {
|
|
1982
|
+
id?: string;
|
|
1983
|
+
label: React.ReactNode;
|
|
1984
|
+
description?: React.ReactNode;
|
|
1985
|
+
error?: React.ReactNode;
|
|
1986
|
+
slider: SliderProps;
|
|
1987
|
+
ariaDescribedBy?: string;
|
|
1988
|
+
minValueLabel?: React.ReactNode;
|
|
1989
|
+
maxValueLabel?: React.ReactNode;
|
|
1990
|
+
labelPosition?: SliderFieldLabelPosition;
|
|
1991
|
+
showEdgeValues?: boolean;
|
|
1992
|
+
dataAttributes?: Record<string, string>;
|
|
1993
|
+
};
|
|
1994
|
+
declare function SliderField(props: SliderFieldProps): React.ReactElement;
|
|
1995
|
+
|
|
1996
|
+
type SliderFieldPurposeProps = Omit<SliderFieldProps, "label" | "slider" | "minValueLabel" | "maxValueLabel"> & {
|
|
1997
|
+
label?: React.ReactNode;
|
|
1998
|
+
slider?: SliderProps;
|
|
1999
|
+
orientation?: SliderProps["orientation"];
|
|
2000
|
+
minValueLabel?: React.ReactNode;
|
|
2001
|
+
maxValueLabel?: React.ReactNode;
|
|
2002
|
+
};
|
|
2003
|
+
type VolumeSliderProps = SliderFieldPurposeProps;
|
|
2004
|
+
declare function VolumeSlider(props: VolumeSliderProps): React.ReactElement;
|
|
2005
|
+
type BrightnessSliderProps = SliderFieldPurposeProps;
|
|
2006
|
+
declare function BrightnessSlider(props: BrightnessSliderProps): React.ReactElement;
|
|
2007
|
+
type RadiusSliderProps = SliderFieldPurposeProps;
|
|
2008
|
+
declare function RadiusSlider(props: RadiusSliderProps): React.ReactElement;
|
|
2009
|
+
|
|
2010
|
+
/**
|
|
2011
|
+
* React adapter for Marwes Tab.
|
|
2012
|
+
* - Renders a native <button> using the core render kit.
|
|
2013
|
+
* - Applies strict a11y fields and modifier classes.
|
|
2014
|
+
*/
|
|
2015
|
+
|
|
2016
|
+
type TabProps = TabOptions & {
|
|
2017
|
+
children?: React.ReactNode;
|
|
2018
|
+
className?: string;
|
|
2019
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
2020
|
+
id?: string;
|
|
2021
|
+
};
|
|
2022
|
+
declare function Tab(props: TabProps): React.ReactElement;
|
|
2023
|
+
|
|
2024
|
+
interface TabGroupItem {
|
|
2025
|
+
value: string;
|
|
2026
|
+
label: React.ReactNode;
|
|
2027
|
+
panel: React.ReactNode;
|
|
2028
|
+
disabled?: boolean;
|
|
2029
|
+
ariaLabel?: string;
|
|
2030
|
+
}
|
|
2031
|
+
interface TabGroupProps {
|
|
2032
|
+
id?: string;
|
|
2033
|
+
label?: React.ReactNode;
|
|
2034
|
+
ariaLabel?: string;
|
|
2035
|
+
tabs: TabGroupItem[];
|
|
2036
|
+
activeTab?: string;
|
|
2037
|
+
defaultActiveTab?: string;
|
|
2038
|
+
onActiveTabChange?: (value: string) => void;
|
|
2039
|
+
className?: string;
|
|
2040
|
+
dataAttributes?: Record<string, string>;
|
|
2041
|
+
}
|
|
2042
|
+
interface TabPanelProps {
|
|
2043
|
+
id: string;
|
|
2044
|
+
tabId: string;
|
|
2045
|
+
hidden?: boolean;
|
|
2046
|
+
className?: string;
|
|
2047
|
+
children?: React.ReactNode;
|
|
2048
|
+
}
|
|
2049
|
+
declare function TabPanel(props: TabPanelProps): React.ReactElement;
|
|
2050
|
+
declare function TabGroup(props: TabGroupProps): React.ReactElement;
|
|
2051
|
+
|
|
2052
|
+
type NavigationTabsProps = TabGroupProps;
|
|
2053
|
+
declare function NavigationTabs(props: NavigationTabsProps): React.ReactElement;
|
|
2054
|
+
type ContentTabsProps = TabGroupProps;
|
|
2055
|
+
declare function ContentTabs(props: ContentTabsProps): React.ReactElement;
|
|
2056
|
+
type SettingsTabsProps = TabGroupProps;
|
|
2057
|
+
declare function SettingsTabs(props: SettingsTabsProps): React.ReactElement;
|
|
2058
|
+
|
|
2059
|
+
interface DialogProps extends DialogOptions {
|
|
2060
|
+
id?: string;
|
|
2061
|
+
title?: React.ReactNode;
|
|
2062
|
+
description?: React.ReactNode;
|
|
2063
|
+
footer?: React.ReactNode;
|
|
2064
|
+
children?: React.ReactNode;
|
|
2065
|
+
onClose?: () => void;
|
|
2066
|
+
className?: string;
|
|
2067
|
+
dataAttributes?: Record<string, string>;
|
|
2068
|
+
}
|
|
2069
|
+
declare function Dialog(props: DialogProps): React.ReactElement;
|
|
2070
|
+
|
|
2071
|
+
interface DialogFooterControls {
|
|
2072
|
+
close: () => void;
|
|
2073
|
+
}
|
|
2074
|
+
interface DialogModalProps extends Omit<DialogProps, "footer" | "onClose"> {
|
|
2075
|
+
open?: boolean;
|
|
2076
|
+
defaultOpen?: boolean;
|
|
2077
|
+
onOpenChange?: (open: boolean) => void;
|
|
2078
|
+
closeOnEscape?: boolean;
|
|
2079
|
+
closeOnScrimClick?: boolean;
|
|
2080
|
+
restoreFocus?: boolean;
|
|
2081
|
+
portalTarget?: HTMLElement | null;
|
|
2082
|
+
overlayClassName?: string;
|
|
2083
|
+
footer?: React.ReactNode | ((controls: DialogFooterControls) => React.ReactNode);
|
|
2084
|
+
}
|
|
2085
|
+
declare function DialogModal(props: DialogModalProps): React.ReactElement | null;
|
|
2086
|
+
|
|
2087
|
+
type ConfirmDialogProps = Omit<DialogModalProps, "footer"> & {
|
|
2088
|
+
confirmLabel?: React.ReactNode;
|
|
2089
|
+
cancelLabel?: React.ReactNode;
|
|
2090
|
+
onConfirm?: () => void;
|
|
2091
|
+
onCancel?: () => void;
|
|
2092
|
+
};
|
|
2093
|
+
declare function ConfirmDialog(props: ConfirmDialogProps): React.ReactElement;
|
|
2094
|
+
type DestructiveDialogProps = Omit<DialogModalProps, "footer"> & {
|
|
2095
|
+
confirmLabel?: React.ReactNode;
|
|
2096
|
+
cancelLabel?: React.ReactNode;
|
|
2097
|
+
onConfirm?: () => void;
|
|
2098
|
+
onCancel?: () => void;
|
|
2099
|
+
};
|
|
2100
|
+
declare function DestructiveDialog(props: DestructiveDialogProps): React.ReactElement;
|
|
2101
|
+
type InfoDialogProps = Omit<DialogModalProps, "footer"> & {
|
|
2102
|
+
acknowledgeLabel?: React.ReactNode;
|
|
2103
|
+
onAcknowledge?: () => void;
|
|
2104
|
+
};
|
|
2105
|
+
declare function InfoDialog(props: InfoDialogProps): React.ReactElement;
|
|
778
2106
|
|
|
779
|
-
export { Button, type ButtonProps, CancelButton, type CancelButtonProps, Checkbox, CheckboxField, type CheckboxFieldProps, type CheckboxProps, CreateButton, type CreateButtonProps,
|
|
2107
|
+
export { Accordion, AccordionField, type AccordionFieldItem, type AccordionFieldProps, type AccordionProps, Avatar, AvatarBadge, type AvatarBadgeProps, AvatarGroup, type AvatarGroupItem, type AvatarGroupProps, type AvatarProps, Badge, BadgeGroup, type BadgeGroupProps, type BadgeProps, BrightnessSlider, type BrightnessSliderProps, Button, type ButtonProps, ButtonSpinner, type ButtonSpinnerProps, CancelButton, type CancelButtonProps, Card, type CardProps, Checkbox, CheckboxField, type CheckboxFieldProps, CheckboxGroupField, type CheckboxGroupFieldOption, type CheckboxGroupFieldProps, type CheckboxProps, CloseButton, type CloseButtonProps, ConfirmButton, type ConfirmButtonProps, ConfirmDialog, type ConfirmDialogProps, ContentTabs, type ContentTabsProps, CopyButton, type CopyButtonProps, CreateButton, type CreateButtonProps, CurrencyField, type CurrencyFieldProps, DateOfBirthField, type DateOfBirthFieldProps, DestructiveButton, type DestructiveButtonProps, DestructiveDialog, type DestructiveDialogProps, Dialog, type DialogFooterControls, DialogModal, type DialogModalProps, type DialogProps, Divider, type DividerProps, DownloadButton, type DownloadButtonProps, DropdownButton, type DropdownButtonProps, DropdownField, type DropdownFieldProps, EditButton, type EditButtonProps, EmailField, type EmailFieldProps, EmptyStateSpinner, type EmptyStateSpinnerProps, ErrorToast, type ErrorToastProps, FAQAccordion, type FAQAccordionProps, FeatureToggle, type FeatureToggleProps, FilterButton, type FilterButtonProps, H1, type H1Props, H2, type H2Props, H3, type H3Props, Icon, type IconProps, InfoDialog, type InfoDialogProps, InfoToast, type InfoToastProps, Input, InputField, type InputFieldProps, InputOtp, type InputOtpProps, type InputProps, LinkButton, type LinkButtonProps, type ManagedToast, MarwesProvider, type MarwesProviderProps, NavigationTabs, type NavigationTabsProps, NotificationBadge, type NotificationBadgeProps, OptionRadioGroup, type OptionRadioGroupProps, Paragraph, type ParagraphProps, PasswordField, type PasswordFieldProps, PermissionSwitch, type PermissionSwitchProps, PhoneField, type PhoneFieldProps, PreferenceSwitch, type PreferenceSwitchProps, PresenceAvatar, type PresenceAvatarProps, PrimaryButton, type PrimaryButtonProps, PriorityBadge, type PriorityBadgeProps, ProductCard, type ProductCardProps, ProfileAvatar, type ProfileAvatarProps, ProfileCard, type ProfileCardProps, Radio, RadioGroupField, type RadioGroupFieldOption, type RadioGroupFieldProps, type RadioProps, RadiusSlider, type RadiusSliderProps, RatingRadioGroup, type RatingRadioGroupProps, RefreshButton, type RefreshButtonProps, RichText, RichTextField, type RichTextFieldProps, type RichTextProps, SaveButton, type SaveButtonProps, SearchButton, type SearchButtonProps, SearchField, type SearchFieldProps, SecondaryButton, type SecondaryButtonProps, SectionsAccordion, type SectionsAccordionProps, Select, type SelectAppearance, SelectField, type SelectFieldProps, type SelectOption, type SelectProps, SettingsAccordion, type SettingsAccordionProps, SettingsTabs, type SettingsTabsProps, type ShowToastOptions, Slider, SliderField, type SliderFieldProps, type SliderProps, SortButton, type SortButtonProps, Spacer, type SpacerProps, Spacing, type SpacingProps, Spinner, type SpinnerProps, StatCard, type StatCardProps, StatusBadge, type StatusBadgeProps, SubmitButton, type SubmitButtonProps, SuccessButton, type SuccessButtonProps, SuccessToast, type SuccessToastProps, Switch, SwitchField, type SwitchFieldProps, type SwitchProps, Tab, TabGroup, type TabGroupItem, type TabGroupProps, TabPanel, type TabPanelProps, type TabProps, TeamAvatarGroup, type TeamAvatarGroupProps, TextButton, type TextButtonProps, Textarea, TextareaField, type TextareaFieldProps, type TextareaProps, Toast, ToastContainer, type ToastContainerProps, type ToastController, type ToastProps, ToastProvider, type ToastProviderProps, Tooltip, TooltipGroup, type TooltipGroupProps, type TooltipProps, URLField, type URLFieldProps, UploadButton, type UploadButtonProps, VerifyButton, type VerifyButtonProps, VolumeSlider, type VolumeSliderProps, WarningToast, type WarningToastProps, YesNoRadioGroup, type YesNoRadioGroupProps, ZipCodeField, type ZipCodeFieldProps, useTheme, useToast };
|