@unlayer/react-elements 0.1.10 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,7 @@
1
1
  import * as React$1 from 'react';
2
2
  import React__default from 'react';
3
+ import { ColumnValues } from '@unlayer/types/containers/column';
4
+ export { ColumnValues } from '@unlayer/types/containers/column';
3
5
  import { ButtonValues } from '@unlayer/types/tools/button';
4
6
  export { ButtonValues } from '@unlayer/types/tools/button';
5
7
  import { DividerValues } from '@unlayer/types/tools/divider';
@@ -22,8 +24,6 @@ import { VideoValues } from '@unlayer/types/tools/video';
22
24
  export { VideoValues } from '@unlayer/types/tools/video';
23
25
  import { RowValues } from '@unlayer/types/containers/row';
24
26
  export { RowValues } from '@unlayer/types/containers/row';
25
- import { ColumnValues } from '@unlayer/types/containers/column';
26
- export { ColumnValues } from '@unlayer/types/containers/column';
27
27
  import { BodyValues } from '@unlayer/types/containers/body';
28
28
  export { BodyValues } from '@unlayer/types/containers/body';
29
29
  import * as react_jsx_runtime from 'react/jsx-runtime';
@@ -243,20 +243,13 @@ type SemanticProps$1<T, TChildren = any> = FlattenObjectProps<T> & {
243
243
  /**
244
244
  * Type Definitions
245
245
  *
246
- * Re-exports shared types from @unlayer-internal/shared-elements
247
- * and defines React-specific component prop types.
246
+ * Re-exports the canonical value types from @unlayer-internal/shared-elements
247
+ * and defines the agent-friendly input types components build their props from.
248
+ *
249
+ * Each component's prop type (ButtonProps, HeadingProps, …) lives next to its
250
+ * component — these are just the shared building blocks they share.
248
251
  */
249
252
 
250
- /**
251
- * Public props for item components.
252
- * Includes semantic flat props, children, values escape hatch,
253
- * className, style, and mode. Excludes internal threading props.
254
- */
255
- type ItemProps<TValues> = SemanticProps$1<TValues, React.ReactNode> & {
256
- className?: string;
257
- style?: React.CSSProperties;
258
- mode?: "web" | "email" | "document";
259
- };
260
253
  /** fontFamily accepts a ready stack object or a bare family-name string. */
261
254
  type FontFamilyInput = {
262
255
  label: string;
@@ -266,9 +259,20 @@ type FontFamilyInput = {
266
259
  type FontWeightInput = number | `${number}` | "normal" | "bold" | "lighter" | "bolder";
267
260
  /** A CSS size: a number (treated as px) or a string ("24px", "50%", "1.5em"). */
268
261
  type SizeInput = number | (string & {});
262
+ /**
263
+ * The `border` object, agent-friendly. The canonical type pins each per-side
264
+ * `*Width` to `${number}px`, so a literal like "1px" type-checks inline but a
265
+ * factored-out object widens "1px" to `string` and stops compiling — exactly the
266
+ * reusable-divider pattern authors reach for. Relax the `*Width` fields to
267
+ * SizeInput (the runtime accepts any CSS string), derived from the canonical
268
+ * shape so it tracks the schema instead of duplicating it.
269
+ */
270
+ type BorderInput = {
271
+ [K in keyof NonNullable<ColumnValues["border"]>]?: K extends `${string}Width` ? SizeInput : NonNullable<ColumnValues["border"]>[K];
272
+ };
269
273
  /** Heading levels (h1–h6). */
270
274
  type HeadingLevel = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
271
- /** Shared text/style props, agent-friendly (replace the loose `any` flat keys). */
275
+ /** Shared text/style inputs, agent-friendly. */
272
276
  type TextStyleProps = {
273
277
  fontFamily?: FontFamilyInput;
274
278
  fontWeight?: FontWeightInput;
@@ -287,64 +291,6 @@ type ImageSrcInput = string | {
287
291
  maxWidth?: SizeInput;
288
292
  [key: string]: unknown;
289
293
  };
290
- /** Button component props */
291
- type ButtonProps = Omit<ItemProps<ButtonValues>, keyof TextStyleProps | "width"> & TextStyleProps & {
292
- /** Display width — a number/px pins the button; "100%" makes it full-width. */
293
- width?: SizeInput;
294
- };
295
- /** Heading component props */
296
- type HeadingProps = Omit<ItemProps<HeadingValues>, keyof TextStyleProps | "headingType"> & TextStyleProps & {
297
- /** Heading level h1–h6. */
298
- headingType?: HeadingLevel;
299
- /** Alias for `headingType`. */
300
- level?: HeadingLevel;
301
- /** Heading text (or use children). */
302
- text?: string;
303
- };
304
- /** Divider component props */
305
- type DividerProps = ItemProps<DividerValues>;
306
- /** HTML component props */
307
- type HtmlProps = ItemProps<HtmlValues>;
308
- /** Paragraph component props */
309
- type ParagraphProps = Omit<ItemProps<ParagraphValues>, keyof TextStyleProps> & TextStyleProps & {
310
- /** Plain-text content (or use `html` for inline formatting, or children). */
311
- text?: string;
312
- };
313
- /** Image component props — supports `alt` shorthand for `altText`. */
314
- type ImageProps = Omit<ItemProps<ImageValues>, "src" | "width" | "maxWidth"> & {
315
- /** Alt text (alias for altText) */
316
- alt?: string;
317
- /** Image URL string, or the value object `{ url, width?, maxWidth?, ... }`. */
318
- src?: ImageSrcInput;
319
- /** Display width — number/px pins the image; "50%" sets a percentage width. */
320
- width?: SizeInput;
321
- /** Display width as a CSS value ("50%", "300px"). */
322
- maxWidth?: SizeInput;
323
- };
324
- /** Social component props — supports `icons` shorthand array. */
325
- type SocialProps = ItemProps<SocialValues> & {
326
- /** Social icons shorthand */
327
- icons?: SocialIcon[];
328
- /** Icon shape */
329
- iconType?: "circle" | "rounded" | "squared";
330
- };
331
- /** Menu component props — supports `items` shorthand array. */
332
- type MenuProps = ItemProps<MenuValues> & {
333
- /** Menu items shorthand */
334
- items?: MenuItem[];
335
- };
336
- /** Table component props — supports `headers` + `data` shorthands. */
337
- type TableProps = ItemProps<TableValues> & {
338
- /** Column headers */
339
- headers?: string[];
340
- /** Row data as 2D array */
341
- data?: string[][];
342
- };
343
- /** Video component props — supports `videoUrl` shorthand. */
344
- type VideoProps = ItemProps<VideoValues> & {
345
- /** YouTube/Vimeo URL (auto-parsed) */
346
- videoUrl?: string;
347
- };
348
294
 
349
295
  /**
350
296
  * Universal Component Factory
@@ -391,10 +337,22 @@ type SemanticProps<T> = SemanticProps$1<T, React.ReactNode>;
391
337
  * Button semantic props — agent-friendly text/style types (replacing the loose
392
338
  * `any` flat props) plus a CSS-style `width` (number/px pins; "100%" full-width).
393
339
  */
394
- type ButtonSemanticProps = Omit<SemanticProps<ButtonValues>, keyof TextStyleProps | "width"> & TextStyleProps & {
340
+ type ButtonSemanticProps = Omit<SemanticProps<ButtonValues>, keyof TextStyleProps | "width" | "padding" | "borderRadius" | "border"> & TextStyleProps & {
395
341
  /** Display width — a number/px pins the button; "100%" makes it full-width. */
396
342
  width?: SizeInput;
343
+ /** Inner padding — a number (→ px) or CSS string ("14px 28px"). */
344
+ padding?: SizeInput;
345
+ /** Corner radius — a number (→ px) or CSS string ("8px", "500px"). */
346
+ borderRadius?: SizeInput;
347
+ /** Per-side border object (width fields accept a number/px string). */
348
+ border?: BorderInput;
397
349
  };
350
+ /**
351
+ * Button Component Props
352
+ * Automatically provides autocomplete for ALL properties (flat and nested)
353
+ */
354
+ interface ButtonProps extends ItemComponentProps<ButtonSemanticProps> {
355
+ }
398
356
  /**
399
357
  * Button - Universal SSR/Client Component with Automatic Semantic Props
400
358
  *
@@ -434,6 +392,12 @@ type ButtonSemanticProps = Omit<SemanticProps<ButtonValues>, keyof TextStyleProp
434
392
  */
435
393
  declare const Button: React$1.FC<ItemComponentProps<ButtonSemanticProps>>;
436
394
 
395
+ type DividerSemanticProps = Omit<SemanticProps<DividerValues>, "border"> & {
396
+ /** Per-side border object (width fields accept a number/px string). */
397
+ border?: BorderInput;
398
+ };
399
+ interface DividerProps extends ItemComponentProps<DividerSemanticProps> {
400
+ }
437
401
  /**
438
402
  * Divider - Universal SSR/Client Component with Automatic Semantic Props
439
403
  *
@@ -450,7 +414,7 @@ declare const Button: React$1.FC<ItemComponentProps<ButtonSemanticProps>>;
450
414
  * }} />
451
415
  * ```
452
416
  */
453
- declare const Divider: React$1.FC<ItemComponentProps<SemanticProps<DividerValues>>>;
417
+ declare const Divider: React$1.FC<ItemComponentProps<DividerSemanticProps>>;
454
418
 
455
419
  /**
456
420
  * Heading semantic props — agent-friendly text/style types (replacing the loose
@@ -464,6 +428,12 @@ type HeadingSemanticProps = Omit<SemanticProps<HeadingValues>, keyof TextStylePr
464
428
  /** Heading text (or use children). */
465
429
  text?: string;
466
430
  };
431
+ /**
432
+ * Heading Component Props
433
+ * Automatically provides autocomplete for ALL properties (flat and nested)
434
+ */
435
+ interface HeadingProps extends ItemComponentProps<HeadingSemanticProps> {
436
+ }
467
437
  /**
468
438
  * Heading - Universal SSR/Client Component with Semantic Props API
469
439
  *
@@ -486,6 +456,8 @@ type HeadingSemanticProps = Omit<SemanticProps<HeadingValues>, keyof TextStylePr
486
456
  */
487
457
  declare const Heading: React$1.FC<ItemComponentProps<HeadingSemanticProps>>;
488
458
 
459
+ interface HtmlProps extends ItemComponentProps<SemanticProps<HtmlValues>> {
460
+ }
489
461
  /**
490
462
  * Html - Universal SSR/Client Component for custom HTML with Automatic Semantic Props
491
463
  *
@@ -516,6 +488,8 @@ type ImageSemanticProps = Omit<SemanticProps<ImageValues>, "src" | "width" | "ma
516
488
  /** Display width as a CSS value ("50%", "300px"). */
517
489
  maxWidth?: SizeInput;
518
490
  };
491
+ interface ImageProps extends ItemComponentProps<ImageSemanticProps> {
492
+ }
519
493
  /**
520
494
  * Image - Renders an image element.
521
495
  *
@@ -534,10 +508,14 @@ type ImageSemanticProps = Omit<SemanticProps<ImageValues>, "src" | "width" | "ma
534
508
  */
535
509
  declare const Image: React$1.FC<ItemComponentProps<ImageSemanticProps>>;
536
510
 
537
- type MenuSemanticProps = SemanticProps<MenuValues> & {
511
+ type MenuSemanticProps = Omit<SemanticProps<MenuValues>, "padding" | "fontFamily" | "fontWeight" | "fontSize" | "letterSpacing"> & Omit<TextStyleProps, "color" | "lineHeight"> & {
538
512
  /** Menu items shorthand */
539
513
  items?: MenuItem[];
514
+ /** Inner padding — a number (→ px) or CSS string. */
515
+ padding?: SizeInput;
540
516
  };
517
+ interface MenuProps extends ItemComponentProps<MenuSemanticProps> {
518
+ }
541
519
  /**
542
520
  * Menu - Renders a navigation menu.
543
521
  *
@@ -567,6 +545,12 @@ type ParagraphSemanticProps = Omit<SemanticProps<ParagraphValues>, keyof TextSty
567
545
  /** Plain-text content (or use `html` for inline formatting, or children). */
568
546
  text?: string;
569
547
  };
548
+ /**
549
+ * Paragraph Component Props
550
+ * Automatically provides autocomplete for ALL properties (flat and nested)
551
+ */
552
+ interface ParagraphProps extends ItemComponentProps<ParagraphSemanticProps> {
553
+ }
570
554
  /**
571
555
  * Paragraph - Universal SSR/Client Component with Semantic Props API
572
556
  *
@@ -595,6 +579,10 @@ type SocialSemanticProps = SemanticProps<SocialValues> & {
595
579
  /** Icon shape */
596
580
  iconType?: "circle" | "rounded" | "squared";
597
581
  };
582
+ interface SocialProps extends Omit<ItemComponentProps<SemanticProps<SocialValues>>, "icons"> {
583
+ icons?: SocialIcon[] | SocialValues["icons"];
584
+ iconType?: "circle" | "rounded" | "squared";
585
+ }
598
586
  /**
599
587
  * Social - Renders social-media icon links.
600
588
  *
@@ -615,12 +603,24 @@ type SocialSemanticProps = SemanticProps<SocialValues> & {
615
603
  */
616
604
  declare const Social: React$1.FC<ItemComponentProps<SocialSemanticProps>>;
617
605
 
618
- type TableSemanticProps = SemanticProps<TableValues> & {
606
+ type TableSemanticProps = Omit<SemanticProps<TableValues>, "padding" | "border"> & {
619
607
  /** Column headers as string[] */
620
608
  headers?: string[];
621
609
  /** Row data as 2D string array */
622
610
  data?: string[][];
611
+ /** Inner padding — a number (→ px) or CSS string. */
612
+ padding?: SizeInput;
613
+ /** Per-side border object (width fields accept a number/px string). */
614
+ border?: BorderInput;
623
615
  };
616
+ interface TableProps extends Omit<ItemComponentProps<Omit<SemanticProps<TableValues>, "padding" | "border">>, "headers" | "data"> {
617
+ headers?: string[];
618
+ data?: string[][];
619
+ /** Inner padding — a number (→ px) or CSS string. */
620
+ padding?: SizeInput;
621
+ /** Per-side border object (width fields accept a number/px string). */
622
+ border?: BorderInput;
623
+ }
624
624
  /**
625
625
  * Table - Renders a data table.
626
626
  *
@@ -649,6 +649,9 @@ type VideoSemanticProps = SemanticProps<VideoValues> & {
649
649
  /** YouTube/Vimeo URL (auto-parsed) */
650
650
  videoUrl?: string;
651
651
  };
652
+ interface VideoProps extends ItemComponentProps<SemanticProps<VideoValues>> {
653
+ videoUrl?: string;
654
+ }
652
655
  /**
653
656
  * Video - Renders an embedded video player (YouTube/Vimeo).
654
657
  *
@@ -683,7 +686,7 @@ type RowProps = Omit<SemanticProps<RowValues>, "padding"> & {
683
686
  };
684
687
  declare const Row: React__default.FC<RowProps>;
685
688
 
686
- type ColumnProps = Omit<SemanticProps<ColumnValues>, "padding"> & {
689
+ type ColumnProps = Omit<SemanticProps<ColumnValues>, "padding" | "border" | "borderRadius"> & {
687
690
  children?: React__default.ReactNode;
688
691
  index?: number;
689
692
  cells?: number[];
@@ -694,12 +697,17 @@ type ColumnProps = Omit<SemanticProps<ColumnValues>, "padding"> & {
694
697
  style?: React__default.CSSProperties;
695
698
  /** Padding — a CSS string ("0 24px", "10px") or a number (px). */
696
699
  padding?: SizeInput;
700
+ /** Corner radius — a number (→ px) or CSS string ("8px"). */
701
+ borderRadius?: SizeInput;
702
+ /** Per-side border object (great for hairline dividers). Width fields accept
703
+ * a number/px string; reuse it as a factored-out const without `as const`. */
704
+ border?: BorderInput;
697
705
  /** @internal - Unlayer config threaded from UnlayerProvider via Body/Row */
698
706
  _config?: UnlayerConfig;
699
707
  };
700
708
  declare const Column: React__default.FC<ColumnProps>;
701
709
 
702
- type BodyProps = Omit<SemanticProps<BodyValues>, "padding"> & {
710
+ type BodyProps = Omit<SemanticProps<BodyValues>, "padding" | "borderRadius"> & {
703
711
  children?: React__default.ReactNode;
704
712
  mode?: RenderMode;
705
713
  className?: string;
@@ -711,6 +719,8 @@ type BodyProps = Omit<SemanticProps<BodyValues>, "padding"> & {
711
719
  previewText?: string;
712
720
  /** Padding — a CSS string ("0 48px", "20px") or a number (px). */
713
721
  padding?: SizeInput;
722
+ /** Corner radius — a number (→ px) or CSS string ("8px"). */
723
+ borderRadius?: SizeInput;
714
724
  };
715
725
  /**
716
726
  * Body - Universal Server/Client Component
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import * as React$1 from 'react';
2
2
  import React__default from 'react';
3
+ import { ColumnValues } from '@unlayer/types/containers/column';
4
+ export { ColumnValues } from '@unlayer/types/containers/column';
3
5
  import { ButtonValues } from '@unlayer/types/tools/button';
4
6
  export { ButtonValues } from '@unlayer/types/tools/button';
5
7
  import { DividerValues } from '@unlayer/types/tools/divider';
@@ -22,8 +24,6 @@ import { VideoValues } from '@unlayer/types/tools/video';
22
24
  export { VideoValues } from '@unlayer/types/tools/video';
23
25
  import { RowValues } from '@unlayer/types/containers/row';
24
26
  export { RowValues } from '@unlayer/types/containers/row';
25
- import { ColumnValues } from '@unlayer/types/containers/column';
26
- export { ColumnValues } from '@unlayer/types/containers/column';
27
27
  import { BodyValues } from '@unlayer/types/containers/body';
28
28
  export { BodyValues } from '@unlayer/types/containers/body';
29
29
  import * as react_jsx_runtime from 'react/jsx-runtime';
@@ -243,20 +243,13 @@ type SemanticProps$1<T, TChildren = any> = FlattenObjectProps<T> & {
243
243
  /**
244
244
  * Type Definitions
245
245
  *
246
- * Re-exports shared types from @unlayer-internal/shared-elements
247
- * and defines React-specific component prop types.
246
+ * Re-exports the canonical value types from @unlayer-internal/shared-elements
247
+ * and defines the agent-friendly input types components build their props from.
248
+ *
249
+ * Each component's prop type (ButtonProps, HeadingProps, …) lives next to its
250
+ * component — these are just the shared building blocks they share.
248
251
  */
249
252
 
250
- /**
251
- * Public props for item components.
252
- * Includes semantic flat props, children, values escape hatch,
253
- * className, style, and mode. Excludes internal threading props.
254
- */
255
- type ItemProps<TValues> = SemanticProps$1<TValues, React.ReactNode> & {
256
- className?: string;
257
- style?: React.CSSProperties;
258
- mode?: "web" | "email" | "document";
259
- };
260
253
  /** fontFamily accepts a ready stack object or a bare family-name string. */
261
254
  type FontFamilyInput = {
262
255
  label: string;
@@ -266,9 +259,20 @@ type FontFamilyInput = {
266
259
  type FontWeightInput = number | `${number}` | "normal" | "bold" | "lighter" | "bolder";
267
260
  /** A CSS size: a number (treated as px) or a string ("24px", "50%", "1.5em"). */
268
261
  type SizeInput = number | (string & {});
262
+ /**
263
+ * The `border` object, agent-friendly. The canonical type pins each per-side
264
+ * `*Width` to `${number}px`, so a literal like "1px" type-checks inline but a
265
+ * factored-out object widens "1px" to `string` and stops compiling — exactly the
266
+ * reusable-divider pattern authors reach for. Relax the `*Width` fields to
267
+ * SizeInput (the runtime accepts any CSS string), derived from the canonical
268
+ * shape so it tracks the schema instead of duplicating it.
269
+ */
270
+ type BorderInput = {
271
+ [K in keyof NonNullable<ColumnValues["border"]>]?: K extends `${string}Width` ? SizeInput : NonNullable<ColumnValues["border"]>[K];
272
+ };
269
273
  /** Heading levels (h1–h6). */
270
274
  type HeadingLevel = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
271
- /** Shared text/style props, agent-friendly (replace the loose `any` flat keys). */
275
+ /** Shared text/style inputs, agent-friendly. */
272
276
  type TextStyleProps = {
273
277
  fontFamily?: FontFamilyInput;
274
278
  fontWeight?: FontWeightInput;
@@ -287,64 +291,6 @@ type ImageSrcInput = string | {
287
291
  maxWidth?: SizeInput;
288
292
  [key: string]: unknown;
289
293
  };
290
- /** Button component props */
291
- type ButtonProps = Omit<ItemProps<ButtonValues>, keyof TextStyleProps | "width"> & TextStyleProps & {
292
- /** Display width — a number/px pins the button; "100%" makes it full-width. */
293
- width?: SizeInput;
294
- };
295
- /** Heading component props */
296
- type HeadingProps = Omit<ItemProps<HeadingValues>, keyof TextStyleProps | "headingType"> & TextStyleProps & {
297
- /** Heading level h1–h6. */
298
- headingType?: HeadingLevel;
299
- /** Alias for `headingType`. */
300
- level?: HeadingLevel;
301
- /** Heading text (or use children). */
302
- text?: string;
303
- };
304
- /** Divider component props */
305
- type DividerProps = ItemProps<DividerValues>;
306
- /** HTML component props */
307
- type HtmlProps = ItemProps<HtmlValues>;
308
- /** Paragraph component props */
309
- type ParagraphProps = Omit<ItemProps<ParagraphValues>, keyof TextStyleProps> & TextStyleProps & {
310
- /** Plain-text content (or use `html` for inline formatting, or children). */
311
- text?: string;
312
- };
313
- /** Image component props — supports `alt` shorthand for `altText`. */
314
- type ImageProps = Omit<ItemProps<ImageValues>, "src" | "width" | "maxWidth"> & {
315
- /** Alt text (alias for altText) */
316
- alt?: string;
317
- /** Image URL string, or the value object `{ url, width?, maxWidth?, ... }`. */
318
- src?: ImageSrcInput;
319
- /** Display width — number/px pins the image; "50%" sets a percentage width. */
320
- width?: SizeInput;
321
- /** Display width as a CSS value ("50%", "300px"). */
322
- maxWidth?: SizeInput;
323
- };
324
- /** Social component props — supports `icons` shorthand array. */
325
- type SocialProps = ItemProps<SocialValues> & {
326
- /** Social icons shorthand */
327
- icons?: SocialIcon[];
328
- /** Icon shape */
329
- iconType?: "circle" | "rounded" | "squared";
330
- };
331
- /** Menu component props — supports `items` shorthand array. */
332
- type MenuProps = ItemProps<MenuValues> & {
333
- /** Menu items shorthand */
334
- items?: MenuItem[];
335
- };
336
- /** Table component props — supports `headers` + `data` shorthands. */
337
- type TableProps = ItemProps<TableValues> & {
338
- /** Column headers */
339
- headers?: string[];
340
- /** Row data as 2D array */
341
- data?: string[][];
342
- };
343
- /** Video component props — supports `videoUrl` shorthand. */
344
- type VideoProps = ItemProps<VideoValues> & {
345
- /** YouTube/Vimeo URL (auto-parsed) */
346
- videoUrl?: string;
347
- };
348
294
 
349
295
  /**
350
296
  * Universal Component Factory
@@ -391,10 +337,22 @@ type SemanticProps<T> = SemanticProps$1<T, React.ReactNode>;
391
337
  * Button semantic props — agent-friendly text/style types (replacing the loose
392
338
  * `any` flat props) plus a CSS-style `width` (number/px pins; "100%" full-width).
393
339
  */
394
- type ButtonSemanticProps = Omit<SemanticProps<ButtonValues>, keyof TextStyleProps | "width"> & TextStyleProps & {
340
+ type ButtonSemanticProps = Omit<SemanticProps<ButtonValues>, keyof TextStyleProps | "width" | "padding" | "borderRadius" | "border"> & TextStyleProps & {
395
341
  /** Display width — a number/px pins the button; "100%" makes it full-width. */
396
342
  width?: SizeInput;
343
+ /** Inner padding — a number (→ px) or CSS string ("14px 28px"). */
344
+ padding?: SizeInput;
345
+ /** Corner radius — a number (→ px) or CSS string ("8px", "500px"). */
346
+ borderRadius?: SizeInput;
347
+ /** Per-side border object (width fields accept a number/px string). */
348
+ border?: BorderInput;
397
349
  };
350
+ /**
351
+ * Button Component Props
352
+ * Automatically provides autocomplete for ALL properties (flat and nested)
353
+ */
354
+ interface ButtonProps extends ItemComponentProps<ButtonSemanticProps> {
355
+ }
398
356
  /**
399
357
  * Button - Universal SSR/Client Component with Automatic Semantic Props
400
358
  *
@@ -434,6 +392,12 @@ type ButtonSemanticProps = Omit<SemanticProps<ButtonValues>, keyof TextStyleProp
434
392
  */
435
393
  declare const Button: React$1.FC<ItemComponentProps<ButtonSemanticProps>>;
436
394
 
395
+ type DividerSemanticProps = Omit<SemanticProps<DividerValues>, "border"> & {
396
+ /** Per-side border object (width fields accept a number/px string). */
397
+ border?: BorderInput;
398
+ };
399
+ interface DividerProps extends ItemComponentProps<DividerSemanticProps> {
400
+ }
437
401
  /**
438
402
  * Divider - Universal SSR/Client Component with Automatic Semantic Props
439
403
  *
@@ -450,7 +414,7 @@ declare const Button: React$1.FC<ItemComponentProps<ButtonSemanticProps>>;
450
414
  * }} />
451
415
  * ```
452
416
  */
453
- declare const Divider: React$1.FC<ItemComponentProps<SemanticProps<DividerValues>>>;
417
+ declare const Divider: React$1.FC<ItemComponentProps<DividerSemanticProps>>;
454
418
 
455
419
  /**
456
420
  * Heading semantic props — agent-friendly text/style types (replacing the loose
@@ -464,6 +428,12 @@ type HeadingSemanticProps = Omit<SemanticProps<HeadingValues>, keyof TextStylePr
464
428
  /** Heading text (or use children). */
465
429
  text?: string;
466
430
  };
431
+ /**
432
+ * Heading Component Props
433
+ * Automatically provides autocomplete for ALL properties (flat and nested)
434
+ */
435
+ interface HeadingProps extends ItemComponentProps<HeadingSemanticProps> {
436
+ }
467
437
  /**
468
438
  * Heading - Universal SSR/Client Component with Semantic Props API
469
439
  *
@@ -486,6 +456,8 @@ type HeadingSemanticProps = Omit<SemanticProps<HeadingValues>, keyof TextStylePr
486
456
  */
487
457
  declare const Heading: React$1.FC<ItemComponentProps<HeadingSemanticProps>>;
488
458
 
459
+ interface HtmlProps extends ItemComponentProps<SemanticProps<HtmlValues>> {
460
+ }
489
461
  /**
490
462
  * Html - Universal SSR/Client Component for custom HTML with Automatic Semantic Props
491
463
  *
@@ -516,6 +488,8 @@ type ImageSemanticProps = Omit<SemanticProps<ImageValues>, "src" | "width" | "ma
516
488
  /** Display width as a CSS value ("50%", "300px"). */
517
489
  maxWidth?: SizeInput;
518
490
  };
491
+ interface ImageProps extends ItemComponentProps<ImageSemanticProps> {
492
+ }
519
493
  /**
520
494
  * Image - Renders an image element.
521
495
  *
@@ -534,10 +508,14 @@ type ImageSemanticProps = Omit<SemanticProps<ImageValues>, "src" | "width" | "ma
534
508
  */
535
509
  declare const Image: React$1.FC<ItemComponentProps<ImageSemanticProps>>;
536
510
 
537
- type MenuSemanticProps = SemanticProps<MenuValues> & {
511
+ type MenuSemanticProps = Omit<SemanticProps<MenuValues>, "padding" | "fontFamily" | "fontWeight" | "fontSize" | "letterSpacing"> & Omit<TextStyleProps, "color" | "lineHeight"> & {
538
512
  /** Menu items shorthand */
539
513
  items?: MenuItem[];
514
+ /** Inner padding — a number (→ px) or CSS string. */
515
+ padding?: SizeInput;
540
516
  };
517
+ interface MenuProps extends ItemComponentProps<MenuSemanticProps> {
518
+ }
541
519
  /**
542
520
  * Menu - Renders a navigation menu.
543
521
  *
@@ -567,6 +545,12 @@ type ParagraphSemanticProps = Omit<SemanticProps<ParagraphValues>, keyof TextSty
567
545
  /** Plain-text content (or use `html` for inline formatting, or children). */
568
546
  text?: string;
569
547
  };
548
+ /**
549
+ * Paragraph Component Props
550
+ * Automatically provides autocomplete for ALL properties (flat and nested)
551
+ */
552
+ interface ParagraphProps extends ItemComponentProps<ParagraphSemanticProps> {
553
+ }
570
554
  /**
571
555
  * Paragraph - Universal SSR/Client Component with Semantic Props API
572
556
  *
@@ -595,6 +579,10 @@ type SocialSemanticProps = SemanticProps<SocialValues> & {
595
579
  /** Icon shape */
596
580
  iconType?: "circle" | "rounded" | "squared";
597
581
  };
582
+ interface SocialProps extends Omit<ItemComponentProps<SemanticProps<SocialValues>>, "icons"> {
583
+ icons?: SocialIcon[] | SocialValues["icons"];
584
+ iconType?: "circle" | "rounded" | "squared";
585
+ }
598
586
  /**
599
587
  * Social - Renders social-media icon links.
600
588
  *
@@ -615,12 +603,24 @@ type SocialSemanticProps = SemanticProps<SocialValues> & {
615
603
  */
616
604
  declare const Social: React$1.FC<ItemComponentProps<SocialSemanticProps>>;
617
605
 
618
- type TableSemanticProps = SemanticProps<TableValues> & {
606
+ type TableSemanticProps = Omit<SemanticProps<TableValues>, "padding" | "border"> & {
619
607
  /** Column headers as string[] */
620
608
  headers?: string[];
621
609
  /** Row data as 2D string array */
622
610
  data?: string[][];
611
+ /** Inner padding — a number (→ px) or CSS string. */
612
+ padding?: SizeInput;
613
+ /** Per-side border object (width fields accept a number/px string). */
614
+ border?: BorderInput;
623
615
  };
616
+ interface TableProps extends Omit<ItemComponentProps<Omit<SemanticProps<TableValues>, "padding" | "border">>, "headers" | "data"> {
617
+ headers?: string[];
618
+ data?: string[][];
619
+ /** Inner padding — a number (→ px) or CSS string. */
620
+ padding?: SizeInput;
621
+ /** Per-side border object (width fields accept a number/px string). */
622
+ border?: BorderInput;
623
+ }
624
624
  /**
625
625
  * Table - Renders a data table.
626
626
  *
@@ -649,6 +649,9 @@ type VideoSemanticProps = SemanticProps<VideoValues> & {
649
649
  /** YouTube/Vimeo URL (auto-parsed) */
650
650
  videoUrl?: string;
651
651
  };
652
+ interface VideoProps extends ItemComponentProps<SemanticProps<VideoValues>> {
653
+ videoUrl?: string;
654
+ }
652
655
  /**
653
656
  * Video - Renders an embedded video player (YouTube/Vimeo).
654
657
  *
@@ -683,7 +686,7 @@ type RowProps = Omit<SemanticProps<RowValues>, "padding"> & {
683
686
  };
684
687
  declare const Row: React__default.FC<RowProps>;
685
688
 
686
- type ColumnProps = Omit<SemanticProps<ColumnValues>, "padding"> & {
689
+ type ColumnProps = Omit<SemanticProps<ColumnValues>, "padding" | "border" | "borderRadius"> & {
687
690
  children?: React__default.ReactNode;
688
691
  index?: number;
689
692
  cells?: number[];
@@ -694,12 +697,17 @@ type ColumnProps = Omit<SemanticProps<ColumnValues>, "padding"> & {
694
697
  style?: React__default.CSSProperties;
695
698
  /** Padding — a CSS string ("0 24px", "10px") or a number (px). */
696
699
  padding?: SizeInput;
700
+ /** Corner radius — a number (→ px) or CSS string ("8px"). */
701
+ borderRadius?: SizeInput;
702
+ /** Per-side border object (great for hairline dividers). Width fields accept
703
+ * a number/px string; reuse it as a factored-out const without `as const`. */
704
+ border?: BorderInput;
697
705
  /** @internal - Unlayer config threaded from UnlayerProvider via Body/Row */
698
706
  _config?: UnlayerConfig;
699
707
  };
700
708
  declare const Column: React__default.FC<ColumnProps>;
701
709
 
702
- type BodyProps = Omit<SemanticProps<BodyValues>, "padding"> & {
710
+ type BodyProps = Omit<SemanticProps<BodyValues>, "padding" | "borderRadius"> & {
703
711
  children?: React__default.ReactNode;
704
712
  mode?: RenderMode;
705
713
  className?: string;
@@ -711,6 +719,8 @@ type BodyProps = Omit<SemanticProps<BodyValues>, "padding"> & {
711
719
  previewText?: string;
712
720
  /** Padding — a CSS string ("0 48px", "20px") or a number (px). */
713
721
  padding?: SizeInput;
722
+ /** Corner radius — a number (→ px) or CSS string ("8px"). */
723
+ borderRadius?: SizeInput;
714
724
  };
715
725
  /**
716
726
  * Body - Universal Server/Client Component
package/dist/index.js CHANGED
@@ -1546,6 +1546,29 @@ function getDisplayName2(element) {
1546
1546
  const type = element.type;
1547
1547
  return type?.displayName || type?.name;
1548
1548
  }
1549
+ var VALID_ROOTS = /* @__PURE__ */ new Set(["Body", "Email", "Page", "Document"]);
1550
+ function unwrapRoot(element) {
1551
+ let current = element;
1552
+ for (let depth = 0; depth < 10; depth++) {
1553
+ const name = getDisplayName2(current);
1554
+ if (name && VALID_ROOTS.has(name)) break;
1555
+ const type = current.type;
1556
+ const isPlainFunctionComponent = typeof type === "function" && !type.prototype?.isReactComponent;
1557
+ if (!isPlainFunctionComponent) break;
1558
+ let produced;
1559
+ try {
1560
+ produced = type({ ...current.props });
1561
+ } catch (cause) {
1562
+ const detail = cause instanceof Error ? cause.message : String(cause);
1563
+ throw new Error(
1564
+ `[Unlayer] renderToJson: could not unwrap <${name || "wrapper"}>. A wrapper must be a plain component that synchronously returns a root (<Email>, <Page>, <Document>, or <Body>) and uses no React hooks. Pass the root element directly \u2014 e.g. renderToJson(<Email>\u2026</Email>). (${detail})`
1565
+ );
1566
+ }
1567
+ if (!React.isValidElement(produced)) break;
1568
+ current = produced;
1569
+ }
1570
+ return current;
1571
+ }
1549
1572
  function collectChildren2(node) {
1550
1573
  const result = [];
1551
1574
  React.Children.forEach(node, (child) => {
@@ -1762,9 +1785,9 @@ function renderRowToJson(element) {
1762
1785
  return processRow(element, counters);
1763
1786
  }
1764
1787
  function renderToJson(element) {
1788
+ element = unwrapRoot(element);
1765
1789
  const displayName = getDisplayName2(element);
1766
- const validRoots = /* @__PURE__ */ new Set(["Body", "Email", "Page", "Document"]);
1767
- if (!displayName || !validRoots.has(displayName)) {
1790
+ if (!displayName || !VALID_ROOTS.has(displayName)) {
1768
1791
  throw new Error(
1769
1792
  `[Unlayer] renderToJson: Root element must be <Body>, <Email>, <Page>, or <Document>, but got <${displayName || "unknown"}>. Wrap your content: <Body><Row><Column>...</Column></Row></Body>`
1770
1793
  );