@marwes-ui/react 0.0.3
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 +21 -0
- package/README.md +100 -0
- package/dist/index.d.ts +779 -0
- package/dist/index.js +422 -0
- package/dist/index.js.map +1 -0
- package/package.json +47 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,779 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Preset, ThemeOverrides, ThemeMode, System, Theme, ButtonOptions, InputOptions, iconRegistry, IconSize, IconStrokeWidth, CheckboxProps as CheckboxProps$1, DividerOptions, DividerSize, DividerOrientation, HeadingOptions, HeadingSize, ParagraphOptions, ParagraphSize } from '@marwes-ui/core';
|
|
3
|
+
export { Preset, System, Theme, ThemeOverrides } from '@marwes-ui/core';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
|
|
6
|
+
type MarwesProviderProps = {
|
|
7
|
+
preset?: Preset;
|
|
8
|
+
theme?: ThemeOverrides;
|
|
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
|
+
*/
|
|
32
|
+
onModeChange?: (mode: ThemeMode) => void;
|
|
33
|
+
children: React.ReactNode;
|
|
34
|
+
};
|
|
35
|
+
declare function MarwesProvider({ preset, theme, mode, onModeChange, children, }: MarwesProviderProps): react_jsx_runtime.JSX.Element;
|
|
36
|
+
|
|
37
|
+
declare function useSystem(): System;
|
|
38
|
+
|
|
39
|
+
declare function useTheme(): Theme;
|
|
40
|
+
|
|
41
|
+
type ButtonProps = ButtonOptions & {
|
|
42
|
+
children?: React.ReactNode;
|
|
43
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;
|
|
44
|
+
className?: string;
|
|
45
|
+
};
|
|
46
|
+
declare function Button(props: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Semantic Button Variants - AI-Friendly Components
|
|
50
|
+
*
|
|
51
|
+
* These variants encode best practices and automatically set AI-friendly
|
|
52
|
+
* metadata, making it easier for both developers and AI tools to understand
|
|
53
|
+
* the purpose and behavior of each button.
|
|
54
|
+
*/
|
|
55
|
+
type DangerButtonProps = Omit<ButtonProps, "tone" | "action"> & {
|
|
56
|
+
/**
|
|
57
|
+
* Override automatic confirmation requirement.
|
|
58
|
+
* Defaults to `true` for destructive actions.
|
|
59
|
+
*/
|
|
60
|
+
confirmation?: boolean;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* DangerButton - For destructive actions like delete, remove, or irreversible operations.
|
|
64
|
+
*
|
|
65
|
+
* **AI Context:**
|
|
66
|
+
* - Sets `tone="danger"` for visual warning
|
|
67
|
+
* - Sets `action="delete"` to indicate destructive behavior
|
|
68
|
+
* - Enables confirmation by default
|
|
69
|
+
* - Adds `data-destructive="true"` for AI parsing
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```tsx
|
|
73
|
+
* import { DangerButton } from "@marwes-ui/react";
|
|
74
|
+
*
|
|
75
|
+
* export function Example() {
|
|
76
|
+
* return <DangerButton onClick={deleteProject}>Delete Project</DangerButton>;
|
|
77
|
+
* }
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
declare function DangerButton(props: DangerButtonProps): react_jsx_runtime.JSX.Element;
|
|
81
|
+
type CreateButtonProps = Omit<ButtonProps, "action">;
|
|
82
|
+
/**
|
|
83
|
+
* CreateButton - For creation actions like adding new items or entities.
|
|
84
|
+
*
|
|
85
|
+
* **AI Context:**
|
|
86
|
+
* - Sets `action="create"` to indicate creation behavior
|
|
87
|
+
* - Uses primary tone by default
|
|
88
|
+
* - Adds `data-creative="true"` for AI parsing
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```tsx
|
|
92
|
+
* <CreateButton onClick={createProject}>
|
|
93
|
+
* New Project
|
|
94
|
+
* </CreateButton>
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
declare function CreateButton(props: CreateButtonProps): react_jsx_runtime.JSX.Element;
|
|
98
|
+
type SubmitButtonProps = Omit<ButtonProps, "action" | "as">;
|
|
99
|
+
/**
|
|
100
|
+
* SubmitButton - For form submissions.
|
|
101
|
+
*
|
|
102
|
+
* **AI Context:**
|
|
103
|
+
* - Sets `action="submit"` and `type="submit"`
|
|
104
|
+
* - Adds `data-context="form-submit"` for AI parsing
|
|
105
|
+
* - Automatically uses button element (not anchor)
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```tsx
|
|
109
|
+
* <SubmitButton>Submit</SubmitButton>
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
declare function SubmitButton(props: SubmitButtonProps): react_jsx_runtime.JSX.Element;
|
|
113
|
+
type CancelButtonProps = Omit<ButtonProps, "action" | "variant">;
|
|
114
|
+
/**
|
|
115
|
+
* CancelButton - For cancel or reset actions.
|
|
116
|
+
*
|
|
117
|
+
* **AI Context:**
|
|
118
|
+
* - Sets `action="cancel"` to indicate cancellation
|
|
119
|
+
* - Uses ghost variant and secondary tone by default
|
|
120
|
+
* - Adds `data-cancel="true"` for AI parsing
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```tsx
|
|
124
|
+
* <CancelButton onClick={handleCancel}>
|
|
125
|
+
* Cancel
|
|
126
|
+
* </CancelButton>
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
declare function CancelButton(props: CancelButtonProps): react_jsx_runtime.JSX.Element;
|
|
130
|
+
type LinkButtonProps = Omit<ButtonProps, "action" | "as"> & {
|
|
131
|
+
/**
|
|
132
|
+
* The URL to navigate to. Required for LinkButton.
|
|
133
|
+
*/
|
|
134
|
+
href: string;
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* LinkButton - For navigation actions that look like buttons.
|
|
138
|
+
*
|
|
139
|
+
* **AI Context:**
|
|
140
|
+
* - Sets `action="navigate"` to indicate navigation
|
|
141
|
+
* - Uses anchor element with button styling
|
|
142
|
+
* - Adds `data-navigation="true"` for AI parsing
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```tsx
|
|
146
|
+
* <LinkButton href="/dashboard">
|
|
147
|
+
* Go to Dashboard
|
|
148
|
+
* </LinkButton>
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
declare function LinkButton(props: LinkButtonProps): react_jsx_runtime.JSX.Element;
|
|
152
|
+
type PrimaryButtonProps = Omit<ButtonProps, "tone" | "as"> & {};
|
|
153
|
+
/**
|
|
154
|
+
* PrimaryButton - For general use when no specific semantic variant fits.
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```tsx
|
|
158
|
+
* <PrimaryButton onClick={handlePrimaryAction}>
|
|
159
|
+
* Do something important
|
|
160
|
+
* </PrimaryButton>
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
declare function PrimaryButton(props: PrimaryButtonProps): react_jsx_runtime.JSX.Element;
|
|
164
|
+
type SecondaryButtonProps = Omit<ButtonProps, "tone" | "as"> & {};
|
|
165
|
+
/**
|
|
166
|
+
* SecondaryButton - For general use when no specific semantic variant fits.
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```tsx
|
|
170
|
+
* <SecondaryButton onClick={handleSecondaryAction}>
|
|
171
|
+
* Do something important
|
|
172
|
+
* </SecondaryButton>
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
declare function SecondaryButton(props: SecondaryButtonProps): react_jsx_runtime.JSX.Element;
|
|
176
|
+
type TextButtonProps = Omit<ButtonProps, "tone" | "as"> & {};
|
|
177
|
+
/**
|
|
178
|
+
* TextButton - For general use when no specific semantic variant fits.
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* ```tsx
|
|
182
|
+
* <TextButton onClick={handleTextAction}>
|
|
183
|
+
* Do something important
|
|
184
|
+
* </TextButton>
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
declare function TextButton(props: TextButtonProps): react_jsx_runtime.JSX.Element;
|
|
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;
|
|
194
|
+
|
|
195
|
+
type IconName = keyof typeof iconRegistry;
|
|
196
|
+
type IconProps = {
|
|
197
|
+
name: IconName;
|
|
198
|
+
/**
|
|
199
|
+
* Token ("xs"|"sm"|"md"|"lg") or a raw px number.
|
|
200
|
+
* Defaults to system.theme.icon.size
|
|
201
|
+
*/
|
|
202
|
+
size?: IconSize | number;
|
|
203
|
+
/**
|
|
204
|
+
* Token ("xs"|"sm"|"md"|"lg") or a raw number.
|
|
205
|
+
* Defaults to system.theme.icon.strokeWidth
|
|
206
|
+
*/
|
|
207
|
+
strokeWidth?: IconStrokeWidth | number;
|
|
208
|
+
/**
|
|
209
|
+
* Common props
|
|
210
|
+
*/
|
|
211
|
+
className?: string;
|
|
212
|
+
"aria-label"?: string;
|
|
213
|
+
decorative?: boolean;
|
|
214
|
+
};
|
|
215
|
+
declare function Icon({ name, size, strokeWidth, className, "aria-label": ariaLabel, decorative, }: IconProps): react_jsx_runtime.JSX.Element;
|
|
216
|
+
|
|
217
|
+
declare function useRenderKitDebug(renderKit: unknown, componentName: string): void;
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* React adapter for Marwes Checkbox.
|
|
221
|
+
* - Renders a native <input type="checkbox"> using the core render kit.
|
|
222
|
+
* - Applies strict a11y fields and CSS vars.
|
|
223
|
+
* - Sets `indeterminate` via DOM property (not an HTML attribute).
|
|
224
|
+
*/
|
|
225
|
+
|
|
226
|
+
type CheckboxProps = CheckboxProps$1 & {
|
|
227
|
+
/**
|
|
228
|
+
* Called with the next checked value when the user toggles the checkbox.
|
|
229
|
+
* For indeterminate state: browser toggling typically results in `checked=true` and `indeterminate=false`
|
|
230
|
+
* unless you keep controlling it.
|
|
231
|
+
*/
|
|
232
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
233
|
+
/**
|
|
234
|
+
* Escape hatch for consumers that want raw event access.
|
|
235
|
+
* (Optional – keep if you want parity with other components.)
|
|
236
|
+
*/
|
|
237
|
+
onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
238
|
+
};
|
|
239
|
+
/**
|
|
240
|
+
* Checkbox (Atom)
|
|
241
|
+
*
|
|
242
|
+
* Low-level checkbox control built on a native `<input type="checkbox">`.
|
|
243
|
+
* Use this when you need custom layout or when the label/description is handled
|
|
244
|
+
* elsewhere (e.g. inside a list item, table row, or custom field wrapper).
|
|
245
|
+
*
|
|
246
|
+
* For most forms, prefer `CheckboxField`, which composes `Checkbox` with
|
|
247
|
+
* label/description/error wiring and consistent spacing.
|
|
248
|
+
*
|
|
249
|
+
* Accessibility
|
|
250
|
+
* - Provide **either** `ariaLabel` **or** `ariaLabelledBy` (or use `CheckboxField` which wires a `<label>`).
|
|
251
|
+
* - Use `ariaDescribedBy` to connect supporting text (help/error).
|
|
252
|
+
* - `indeterminate` is applied via a DOM property, not an HTML attribute.
|
|
253
|
+
*
|
|
254
|
+
* @example Basic (uncontrolled)
|
|
255
|
+
* ```tsx
|
|
256
|
+
* <Checkbox ariaLabel="Subscribe to updates" defaultChecked />
|
|
257
|
+
* ```
|
|
258
|
+
*
|
|
259
|
+
* @example Controlled
|
|
260
|
+
* ```tsx
|
|
261
|
+
* const [checked, setChecked] = React.useState(false);
|
|
262
|
+
*
|
|
263
|
+
* <Checkbox
|
|
264
|
+
* ariaLabel="Accept terms"
|
|
265
|
+
* checked={checked}
|
|
266
|
+
* onCheckedChange={setChecked}
|
|
267
|
+
* />
|
|
268
|
+
* ```
|
|
269
|
+
*
|
|
270
|
+
* @example Indeterminate (mixed)
|
|
271
|
+
* ```tsx
|
|
272
|
+
* const [checked, setChecked] = React.useState(false);
|
|
273
|
+
* const [mixed, setMixed] = React.useState(true);
|
|
274
|
+
*
|
|
275
|
+
* <Checkbox
|
|
276
|
+
* ariaLabel="Select all"
|
|
277
|
+
* checked={checked}
|
|
278
|
+
* indeterminate={mixed}
|
|
279
|
+
* onCheckedChange={(next) => {
|
|
280
|
+
* setMixed(false); // first interaction clears mixed state
|
|
281
|
+
* setChecked(next);
|
|
282
|
+
* }}
|
|
283
|
+
* />
|
|
284
|
+
* ```
|
|
285
|
+
*
|
|
286
|
+
* @example With external label + description
|
|
287
|
+
* ```tsx
|
|
288
|
+
* const id = "terms";
|
|
289
|
+
* const descId = "terms-desc";
|
|
290
|
+
*
|
|
291
|
+
* <>
|
|
292
|
+
* <div style={{ display: "flex", alignItems: "center", gap: 10 }}>
|
|
293
|
+
* <Checkbox id={id} ariaDescribedBy={descId} />
|
|
294
|
+
* <label htmlFor={id}>I accept the terms</label>
|
|
295
|
+
* </div>
|
|
296
|
+
* <div id={descId}>Required to continue.</div>
|
|
297
|
+
* </>
|
|
298
|
+
* ```
|
|
299
|
+
*/
|
|
300
|
+
declare function Checkbox(props: CheckboxProps): React.ReactElement;
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* React adapter for Marwes Divider component.
|
|
304
|
+
* - Renders semantic <hr> using the core divider recipe.
|
|
305
|
+
* - Supports 7 size variants: xxs/xs/sm/md/lg/xl/xxl.
|
|
306
|
+
* - Supports horizontal and vertical orientation.
|
|
307
|
+
* - Figma reference: node-id=1-932
|
|
308
|
+
*/
|
|
309
|
+
|
|
310
|
+
type DividerProps = DividerOptions & Omit<React.HTMLAttributes<HTMLHRElement>, "children"> & {
|
|
311
|
+
/**
|
|
312
|
+
* Size variant for the divider.
|
|
313
|
+
* Maps to pixel values: xxs=1px, xs=8px, sm=16px, md=32px, lg=48px, xl=64px, xxl=80px
|
|
314
|
+
* @default "md"
|
|
315
|
+
*/
|
|
316
|
+
size?: DividerSize;
|
|
317
|
+
/**
|
|
318
|
+
* Orientation of the divider.
|
|
319
|
+
* @default "horizontal"
|
|
320
|
+
*/
|
|
321
|
+
orientation?: DividerOrientation;
|
|
322
|
+
/**
|
|
323
|
+
* Additional CSS class names.
|
|
324
|
+
*/
|
|
325
|
+
className?: string;
|
|
326
|
+
/**
|
|
327
|
+
* Inline styles.
|
|
328
|
+
*/
|
|
329
|
+
style?: React.CSSProperties;
|
|
330
|
+
};
|
|
331
|
+
/**
|
|
332
|
+
* Divider
|
|
333
|
+
*
|
|
334
|
+
* Semantic separator rendered as `<hr>`.
|
|
335
|
+
* Supports size variants and both horizontal and vertical orientations.
|
|
336
|
+
*
|
|
337
|
+
* @example Basic usage (horizontal, medium size)
|
|
338
|
+
* ```tsx
|
|
339
|
+
* <Divider />
|
|
340
|
+
* ```
|
|
341
|
+
*
|
|
342
|
+
* @example Different sizes
|
|
343
|
+
* ```tsx
|
|
344
|
+
* <Divider size="xxs" /> // 1px hairline
|
|
345
|
+
* <Divider size="sm" /> // 16px
|
|
346
|
+
* <Divider size="lg" /> // 48px
|
|
347
|
+
* ```
|
|
348
|
+
*
|
|
349
|
+
* @example Vertical divider
|
|
350
|
+
* ```tsx
|
|
351
|
+
* <div style={{ display: 'flex', alignItems: 'center', gap: '1rem' }}>
|
|
352
|
+
* <span>Left content</span>
|
|
353
|
+
* <Divider orientation="vertical" size="sm" />
|
|
354
|
+
* <span>Right content</span>
|
|
355
|
+
* </div>
|
|
356
|
+
* ```
|
|
357
|
+
*
|
|
358
|
+
* @example With custom ID
|
|
359
|
+
* ```tsx
|
|
360
|
+
* <Divider id="section-break" />
|
|
361
|
+
* ```
|
|
362
|
+
*/
|
|
363
|
+
declare const Divider: React.ForwardRefExoticComponent<DividerOptions & Omit<React.HTMLAttributes<HTMLHRElement>, "children"> & {
|
|
364
|
+
/**
|
|
365
|
+
* Size variant for the divider.
|
|
366
|
+
* Maps to pixel values: xxs=1px, xs=8px, sm=16px, md=32px, lg=48px, xl=64px, xxl=80px
|
|
367
|
+
* @default "md"
|
|
368
|
+
*/
|
|
369
|
+
size?: DividerSize;
|
|
370
|
+
/**
|
|
371
|
+
* Orientation of the divider.
|
|
372
|
+
* @default "horizontal"
|
|
373
|
+
*/
|
|
374
|
+
orientation?: DividerOrientation;
|
|
375
|
+
/**
|
|
376
|
+
* Additional CSS class names.
|
|
377
|
+
*/
|
|
378
|
+
className?: string;
|
|
379
|
+
/**
|
|
380
|
+
* Inline styles.
|
|
381
|
+
*/
|
|
382
|
+
style?: React.CSSProperties;
|
|
383
|
+
} & React.RefAttributes<HTMLHRElement>>;
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* React adapter for Marwes H1 component.
|
|
387
|
+
* - Renders semantic <h1> using the core heading recipe.
|
|
388
|
+
* - Supports size override for visual/semantic mismatch.
|
|
389
|
+
*/
|
|
390
|
+
|
|
391
|
+
type H1Props = Omit<HeadingOptions, "level"> & {
|
|
392
|
+
/**
|
|
393
|
+
* Visual size override.
|
|
394
|
+
* Allows using h1 semantics with different visual styling.
|
|
395
|
+
* @default "h1"
|
|
396
|
+
*/
|
|
397
|
+
size?: HeadingSize;
|
|
398
|
+
/**
|
|
399
|
+
* Content of the heading.
|
|
400
|
+
*/
|
|
401
|
+
children?: React.ReactNode;
|
|
402
|
+
/**
|
|
403
|
+
* Additional CSS class names.
|
|
404
|
+
*/
|
|
405
|
+
className?: string;
|
|
406
|
+
/**
|
|
407
|
+
* Inline styles.
|
|
408
|
+
*/
|
|
409
|
+
style?: React.CSSProperties;
|
|
410
|
+
};
|
|
411
|
+
/**
|
|
412
|
+
* H1 (Heading Level 1)
|
|
413
|
+
*
|
|
414
|
+
* Semantic top-level heading rendered as `<h1>`.
|
|
415
|
+
* Supports visual size override for cases where semantic and visual hierarchy differ.
|
|
416
|
+
*
|
|
417
|
+
* @example Basic usage
|
|
418
|
+
* ```tsx
|
|
419
|
+
* <H1>Page Title</H1>
|
|
420
|
+
* ```
|
|
421
|
+
*
|
|
422
|
+
* @example With size override
|
|
423
|
+
* ```tsx
|
|
424
|
+
* <H1 size="h2">Visually smaller but semantically h1</H1>
|
|
425
|
+
* ```
|
|
426
|
+
*
|
|
427
|
+
* @example With ID for anchor linking
|
|
428
|
+
* ```tsx
|
|
429
|
+
* <H1 id="introduction">Introduction</H1>
|
|
430
|
+
* ```
|
|
431
|
+
*/
|
|
432
|
+
declare function H1(props: H1Props): React.ReactElement;
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* React adapter for Marwes H2 component.
|
|
436
|
+
* - Renders semantic <h2> using the core heading recipe.
|
|
437
|
+
* - Supports size override for visual/semantic mismatch.
|
|
438
|
+
*/
|
|
439
|
+
|
|
440
|
+
type H2Props = Omit<HeadingOptions, "level"> & {
|
|
441
|
+
/**
|
|
442
|
+
* Visual size override.
|
|
443
|
+
* Allows using h2 semantics with different visual styling.
|
|
444
|
+
* @default "h2"
|
|
445
|
+
*/
|
|
446
|
+
size?: HeadingSize;
|
|
447
|
+
/**
|
|
448
|
+
* Content of the heading.
|
|
449
|
+
*/
|
|
450
|
+
children?: React.ReactNode;
|
|
451
|
+
/**
|
|
452
|
+
* Additional CSS class names.
|
|
453
|
+
*/
|
|
454
|
+
className?: string;
|
|
455
|
+
/**
|
|
456
|
+
* Inline styles.
|
|
457
|
+
*/
|
|
458
|
+
style?: React.CSSProperties;
|
|
459
|
+
};
|
|
460
|
+
/**
|
|
461
|
+
* H2 (Heading Level 2)
|
|
462
|
+
*
|
|
463
|
+
* Semantic section heading rendered as `<h2>`.
|
|
464
|
+
* Supports visual size override for cases where semantic and visual hierarchy differ.
|
|
465
|
+
*
|
|
466
|
+
* @example Basic usage
|
|
467
|
+
* ```tsx
|
|
468
|
+
* <H2>Section Title</H2>
|
|
469
|
+
* ```
|
|
470
|
+
*
|
|
471
|
+
* @example With size override
|
|
472
|
+
* ```tsx
|
|
473
|
+
* <H2 size="h1">Visually larger but semantically h2</H2>
|
|
474
|
+
* ```
|
|
475
|
+
*/
|
|
476
|
+
declare function H2(props: H2Props): React.ReactElement;
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* React adapter for Marwes H3 component.
|
|
480
|
+
* - Renders semantic <h3> using the core heading recipe.
|
|
481
|
+
* - Supports size override for visual/semantic mismatch.
|
|
482
|
+
*/
|
|
483
|
+
|
|
484
|
+
type H3Props = Omit<HeadingOptions, "level"> & {
|
|
485
|
+
/**
|
|
486
|
+
* Visual size override.
|
|
487
|
+
* Allows using h3 semantics with different visual styling.
|
|
488
|
+
* @default "h3"
|
|
489
|
+
*/
|
|
490
|
+
size?: HeadingSize;
|
|
491
|
+
/**
|
|
492
|
+
* Content of the heading.
|
|
493
|
+
*/
|
|
494
|
+
children?: React.ReactNode;
|
|
495
|
+
/**
|
|
496
|
+
* Additional CSS class names.
|
|
497
|
+
*/
|
|
498
|
+
className?: string;
|
|
499
|
+
/**
|
|
500
|
+
* Inline styles.
|
|
501
|
+
*/
|
|
502
|
+
style?: React.CSSProperties;
|
|
503
|
+
};
|
|
504
|
+
/**
|
|
505
|
+
* H3 (Heading Level 3)
|
|
506
|
+
*
|
|
507
|
+
* Semantic subsection heading rendered as `<h3>`.
|
|
508
|
+
* Supports visual size override for cases where semantic and visual hierarchy differ.
|
|
509
|
+
*
|
|
510
|
+
* @example Basic usage
|
|
511
|
+
* ```tsx
|
|
512
|
+
* <H3>Subsection Title</H3>
|
|
513
|
+
* ```
|
|
514
|
+
*
|
|
515
|
+
* @example With size override
|
|
516
|
+
* ```tsx
|
|
517
|
+
* <H3 size="h2">Visually larger but semantically h3</H3>
|
|
518
|
+
* ```
|
|
519
|
+
*/
|
|
520
|
+
declare function H3(props: H3Props): React.ReactElement;
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* React adapter for Marwes Paragraph component.
|
|
524
|
+
* - Renders semantic <p> using the core paragraph recipe.
|
|
525
|
+
* - Supports size variants: sm/md/lg.
|
|
526
|
+
*/
|
|
527
|
+
|
|
528
|
+
type ParagraphProps = ParagraphOptions & {
|
|
529
|
+
/**
|
|
530
|
+
* Size variant.
|
|
531
|
+
* @default "md"
|
|
532
|
+
*/
|
|
533
|
+
size?: ParagraphSize;
|
|
534
|
+
/**
|
|
535
|
+
* Content of the paragraph.
|
|
536
|
+
*/
|
|
537
|
+
children?: React.ReactNode;
|
|
538
|
+
/**
|
|
539
|
+
* Additional CSS class names.
|
|
540
|
+
*/
|
|
541
|
+
className?: string;
|
|
542
|
+
/**
|
|
543
|
+
* Inline styles.
|
|
544
|
+
*/
|
|
545
|
+
style?: React.CSSProperties;
|
|
546
|
+
};
|
|
547
|
+
/**
|
|
548
|
+
* Paragraph
|
|
549
|
+
*
|
|
550
|
+
* Semantic text block rendered as `<p>`.
|
|
551
|
+
* Supports size variants for different text contexts.
|
|
552
|
+
*
|
|
553
|
+
* @example Basic usage
|
|
554
|
+
* ```tsx
|
|
555
|
+
* <Paragraph>This is a standard paragraph.</Paragraph>
|
|
556
|
+
* ```
|
|
557
|
+
*
|
|
558
|
+
* @example With size variant
|
|
559
|
+
* ```tsx
|
|
560
|
+
* <Paragraph size="sm">Small text for disclaimers.</Paragraph>
|
|
561
|
+
* <Paragraph size="lg">Emphasized lead paragraph.</Paragraph>
|
|
562
|
+
* ```
|
|
563
|
+
*
|
|
564
|
+
* @example With ID
|
|
565
|
+
* ```tsx
|
|
566
|
+
* <Paragraph id="intro">Introduction text.</Paragraph>
|
|
567
|
+
* ```
|
|
568
|
+
*/
|
|
569
|
+
declare function Paragraph(props: ParagraphProps): React.ReactElement;
|
|
570
|
+
|
|
571
|
+
type CheckboxFieldProps = {
|
|
572
|
+
/** Optional: if omitted, we generate one via useId(). */
|
|
573
|
+
id?: string;
|
|
574
|
+
/** Field content (rendered by adapter). */
|
|
575
|
+
label: React.ReactNode;
|
|
576
|
+
description?: React.ReactNode;
|
|
577
|
+
error?: React.ReactNode;
|
|
578
|
+
/** Props forwarded to the Checkbox atom. */
|
|
579
|
+
checkbox: CheckboxProps;
|
|
580
|
+
/** Additional aria-describedby IDs to merge with internal description/error IDs. */
|
|
581
|
+
ariaDescribedBy?: string;
|
|
582
|
+
};
|
|
583
|
+
/**
|
|
584
|
+
* CheckboxField (Molecule) — Recommended
|
|
585
|
+
*
|
|
586
|
+
* A convenient, accessible wrapper around `Checkbox` that provides:
|
|
587
|
+
* - a clickable `<label>` wired via `htmlFor`/`id`
|
|
588
|
+
* - optional `description` and `error` regions
|
|
589
|
+
* - automatic `aria-describedby` wiring (description + error + any external ids)
|
|
590
|
+
* - automatic invalid state when `error` is present
|
|
591
|
+
*
|
|
592
|
+
* Use `CheckboxField` for most forms. Use `Checkbox` directly only when you need
|
|
593
|
+
* a highly custom layout (tables, list rows, compound list items, etc.).
|
|
594
|
+
*
|
|
595
|
+
* Accessibility
|
|
596
|
+
* - Generates a stable `id` via `useId()` when `id` is not provided.
|
|
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).
|
|
601
|
+
*
|
|
602
|
+
* @example Minimal (recommended)
|
|
603
|
+
* ```tsx
|
|
604
|
+
* <CheckboxField
|
|
605
|
+
* label="Subscribe to updates"
|
|
606
|
+
* checkbox={{ defaultChecked: true }}
|
|
607
|
+
* />
|
|
608
|
+
* ```
|
|
609
|
+
*
|
|
610
|
+
* @example With description
|
|
611
|
+
* ```tsx
|
|
612
|
+
* <CheckboxField
|
|
613
|
+
* label="Subscribe to updates"
|
|
614
|
+
* description="We'll only email you about important product changes."
|
|
615
|
+
* checkbox={{}}
|
|
616
|
+
* />
|
|
617
|
+
* ```
|
|
618
|
+
*
|
|
619
|
+
* @example With error (invalid state)
|
|
620
|
+
* ```tsx
|
|
621
|
+
* <CheckboxField
|
|
622
|
+
* label="Accept terms"
|
|
623
|
+
* error="You must accept the terms to continue."
|
|
624
|
+
* checkbox={{ required: true }}
|
|
625
|
+
* />
|
|
626
|
+
* ```
|
|
627
|
+
*
|
|
628
|
+
* @example Controlled
|
|
629
|
+
* ```tsx
|
|
630
|
+
* const [checked, setChecked] = React.useState(false);
|
|
631
|
+
*
|
|
632
|
+
* <CheckboxField
|
|
633
|
+
* label="Accept terms"
|
|
634
|
+
* checkbox={{
|
|
635
|
+
* checked,
|
|
636
|
+
* onCheckedChange: setChecked,
|
|
637
|
+
* }}
|
|
638
|
+
* />
|
|
639
|
+
* ```
|
|
640
|
+
*
|
|
641
|
+
* @example Indeterminate (mixed)
|
|
642
|
+
* ```tsx
|
|
643
|
+
* const [checked, setChecked] = React.useState(false);
|
|
644
|
+
* const [mixed, setMixed] = React.useState(true);
|
|
645
|
+
*
|
|
646
|
+
* <CheckboxField
|
|
647
|
+
* label="Select all"
|
|
648
|
+
* description="Applies to all items in the current view."
|
|
649
|
+
* checkbox={{
|
|
650
|
+
* checked,
|
|
651
|
+
* indeterminate: mixed,
|
|
652
|
+
* onCheckedChange: (next) => {
|
|
653
|
+
* setMixed(false);
|
|
654
|
+
* setChecked(next);
|
|
655
|
+
* },
|
|
656
|
+
* }}
|
|
657
|
+
* />
|
|
658
|
+
* ```
|
|
659
|
+
*
|
|
660
|
+
* @example Custom describedBy (merge with internal description/error)
|
|
661
|
+
* ```tsx
|
|
662
|
+
* <CheckboxField
|
|
663
|
+
* ariaDescribedBy="my-extra-help"
|
|
664
|
+
* label="Enable telemetry"
|
|
665
|
+
* description="Helps us improve the product."
|
|
666
|
+
* checkbox={{}}
|
|
667
|
+
* />
|
|
668
|
+
*
|
|
669
|
+
* <div id="my-extra-help">This setting can be changed later.</div>
|
|
670
|
+
* ```
|
|
671
|
+
*/
|
|
672
|
+
declare function CheckboxField(props: CheckboxFieldProps): React.ReactElement;
|
|
673
|
+
|
|
674
|
+
type InputFieldProps = {
|
|
675
|
+
/** Optional: if omitted, we generate one via useId(). */
|
|
676
|
+
id?: string;
|
|
677
|
+
/** Field label (required for accessibility). */
|
|
678
|
+
label: React.ReactNode;
|
|
679
|
+
/** Optional helper text shown below the input. */
|
|
680
|
+
helperText?: React.ReactNode;
|
|
681
|
+
/** Optional error message. When present, input is marked invalid. */
|
|
682
|
+
error?: React.ReactNode;
|
|
683
|
+
/** Props forwarded to the Input atom. */
|
|
684
|
+
input: InputProps;
|
|
685
|
+
/** Additional aria-describedby IDs to merge with internal helper/error IDs. */
|
|
686
|
+
ariaDescribedBy?: string;
|
|
687
|
+
};
|
|
688
|
+
/**
|
|
689
|
+
* InputField (Molecule) — Recommended
|
|
690
|
+
*
|
|
691
|
+
* A convenient, accessible wrapper around `Input` that provides:
|
|
692
|
+
* - a visible `<label>` wired via `htmlFor`/`id`
|
|
693
|
+
* - optional `helperText` and `error` regions
|
|
694
|
+
* - automatic `aria-describedby` wiring (helperText + error + any external ids)
|
|
695
|
+
* - automatic invalid state when `error` is present
|
|
696
|
+
*
|
|
697
|
+
* Use `InputField` for most forms. Use `Input` directly only when you need
|
|
698
|
+
* a highly custom layout or composite inputs.
|
|
699
|
+
*
|
|
700
|
+
* Accessibility
|
|
701
|
+
* - Generates a stable `id` via `useId()` when `id` is not provided.
|
|
702
|
+
* - Always renders a visible `<label>` element connected to the input control.
|
|
703
|
+
* - When `helperText` and/or `error` are present, it sets `aria-describedby`
|
|
704
|
+
* on the input to reference their ids.
|
|
705
|
+
* - When `error` is present, the input is marked invalid (aria-invalid).
|
|
706
|
+
* - Error region has `aria-live="polite"` for screen reader announcements.
|
|
707
|
+
*
|
|
708
|
+
* @example Minimal (recommended)
|
|
709
|
+
* ```tsx
|
|
710
|
+
* <InputField
|
|
711
|
+
* label="Email address"
|
|
712
|
+
* input={{ type: "email", placeholder: "you@example.com" }}
|
|
713
|
+
* />
|
|
714
|
+
* ```
|
|
715
|
+
*
|
|
716
|
+
* @example With helper text
|
|
717
|
+
* ```tsx
|
|
718
|
+
* <InputField
|
|
719
|
+
* label="Username"
|
|
720
|
+
* helperText="Choose a unique username between 3-20 characters."
|
|
721
|
+
* input={{ type: "text", placeholder: "johnsmith" }}
|
|
722
|
+
* />
|
|
723
|
+
* ```
|
|
724
|
+
*
|
|
725
|
+
* @example With error (invalid state)
|
|
726
|
+
* ```tsx
|
|
727
|
+
* <InputField
|
|
728
|
+
* label="Password"
|
|
729
|
+
* error="Password must be at least 8 characters."
|
|
730
|
+
* input={{ type: "password", required: true }}
|
|
731
|
+
* />
|
|
732
|
+
* ```
|
|
733
|
+
*
|
|
734
|
+
* @example Controlled
|
|
735
|
+
* ```tsx
|
|
736
|
+
* const [email, setEmail] = React.useState("");
|
|
737
|
+
*
|
|
738
|
+
* <InputField
|
|
739
|
+
* label="Email"
|
|
740
|
+
* input={{
|
|
741
|
+
* type: "email",
|
|
742
|
+
* value: email,
|
|
743
|
+
* onValueChange: setEmail,
|
|
744
|
+
* }}
|
|
745
|
+
* />
|
|
746
|
+
* ```
|
|
747
|
+
*
|
|
748
|
+
* @example Disabled
|
|
749
|
+
* ```tsx
|
|
750
|
+
* <InputField
|
|
751
|
+
* label="Account ID"
|
|
752
|
+
* helperText="This value cannot be changed."
|
|
753
|
+
* input={{ value: "ACC-12345", disabled: true }}
|
|
754
|
+
* />
|
|
755
|
+
* ```
|
|
756
|
+
*
|
|
757
|
+
* @example Read-only
|
|
758
|
+
* ```tsx
|
|
759
|
+
* <InputField
|
|
760
|
+
* label="Account created"
|
|
761
|
+
* input={{ value: "January 15, 2026", readOnly: true }}
|
|
762
|
+
* />
|
|
763
|
+
* ```
|
|
764
|
+
*
|
|
765
|
+
* @example Custom describedBy (merge with internal helper/error)
|
|
766
|
+
* ```tsx
|
|
767
|
+
* <InputField
|
|
768
|
+
* ariaDescribedBy="my-extra-help"
|
|
769
|
+
* label="API Key"
|
|
770
|
+
* helperText="Your key is stored securely."
|
|
771
|
+
* input={{ type: "password" }}
|
|
772
|
+
* />
|
|
773
|
+
*
|
|
774
|
+
* <div id="my-extra-help">This can be regenerated from your settings.</div>
|
|
775
|
+
* ```
|
|
776
|
+
*/
|
|
777
|
+
declare function InputField(props: InputFieldProps): React.ReactElement;
|
|
778
|
+
|
|
779
|
+
export { Button, type ButtonProps, CancelButton, type CancelButtonProps, Checkbox, CheckboxField, type CheckboxFieldProps, type CheckboxProps, CreateButton, type CreateButtonProps, DangerButton, type DangerButtonProps, Divider, type DividerProps, H1, type H1Props, H2, type H2Props, H3, type H3Props, Icon, type IconProps, Input, InputField, type InputFieldProps, type InputProps, LinkButton, type LinkButtonProps, MarwesProvider, type MarwesProviderProps, Paragraph, type ParagraphProps, PrimaryButton, type PrimaryButtonProps, SecondaryButton, type SecondaryButtonProps, SubmitButton, type SubmitButtonProps, TextButton, type TextButtonProps, useRenderKitDebug, useSystem, useTheme };
|