@safe-ugc-ui/react 0.5.1 → 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/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as react from 'react';
2
3
  import { CSSProperties, ReactNode } from 'react';
3
4
  import { UGCCard } from '@safe-ugc-ui/types';
4
5
 
@@ -60,7 +61,7 @@ interface UGCContainerProps {
60
61
  * Security isolation wrapper for UGC content.
61
62
  * All UGC card renderings should be wrapped in this container.
62
63
  */
63
- declare function UGCContainer({ children, style }: UGCContainerProps): react_jsx_runtime.JSX.Element;
64
+ declare const UGCContainer: react.ForwardRefExoticComponent<UGCContainerProps & react.RefAttributes<HTMLDivElement>>;
64
65
 
65
66
  interface BoxProps {
66
67
  style?: CSSProperties;
@@ -83,8 +84,15 @@ interface ColumnProps {
83
84
  }
84
85
  declare function Column({ style, hoverStyle, children }: ColumnProps): react_jsx_runtime.JSX.Element;
85
86
 
87
+ interface TextSpan {
88
+ text: string;
89
+ style?: CSSProperties;
90
+ }
86
91
  interface TextComponentProps {
87
- content: string;
92
+ content?: string;
93
+ spans?: TextSpan[];
94
+ maxLines?: number;
95
+ truncate?: 'ellipsis' | 'clip';
88
96
  style?: CSSProperties;
89
97
  hoverStyle?: CSSProperties;
90
98
  }
@@ -92,7 +100,7 @@ interface TextComponentProps {
92
100
  * Renders text content safely. NEVER uses dangerouslySetInnerHTML.
93
101
  * All content is rendered as text nodes via React's built-in escaping.
94
102
  */
95
- declare function Text({ content, style, hoverStyle }: TextComponentProps): react_jsx_runtime.JSX.Element;
103
+ declare function Text({ content, spans, maxLines, truncate, style, hoverStyle, }: TextComponentProps): react_jsx_runtime.JSX.Element;
96
104
 
97
105
  interface ImageComponentProps {
98
106
  src: string;
@@ -208,11 +216,40 @@ interface ToggleProps {
208
216
  }
209
217
  declare function Toggle({ value, onToggle, onAction, disabled, style, hoverStyle }: ToggleProps): react_jsx_runtime.JSX.Element;
210
218
 
219
+ interface AccordionItem {
220
+ id: string;
221
+ label: string;
222
+ content?: ReactNode;
223
+ disabled?: boolean;
224
+ }
225
+ interface AccordionProps {
226
+ items: AccordionItem[];
227
+ allowMultiple?: boolean;
228
+ defaultExpanded?: string[];
229
+ style?: CSSProperties;
230
+ hoverStyle?: CSSProperties;
231
+ }
232
+ declare function Accordion({ items, allowMultiple, defaultExpanded, style, hoverStyle, }: AccordionProps): react_jsx_runtime.JSX.Element;
233
+
234
+ interface TabsItem {
235
+ id: string;
236
+ label: string;
237
+ content?: ReactNode;
238
+ disabled?: boolean;
239
+ }
240
+ interface TabsProps {
241
+ tabs: TabsItem[];
242
+ defaultTab?: string;
243
+ style?: CSSProperties;
244
+ hoverStyle?: CSSProperties;
245
+ }
246
+ declare function Tabs({ tabs, defaultTab, style, hoverStyle, }: TabsProps): react_jsx_runtime.JSX.Element;
247
+
211
248
  /**
212
249
  * @safe-ugc-ui/react --- Node Renderer
213
250
  *
214
251
  * Recursive renderer that maps UGC node types to React components.
215
- * Supports all 16 component types, for-loop rendering, style reference merge,
252
+ * Supports all currently implemented component types, for-loop rendering, style reference merge,
216
253
  * and runtime limits pre-check.
217
254
  *
218
255
  * For each node:
@@ -240,6 +277,8 @@ interface RenderContext {
240
277
  assets: AssetMap;
241
278
  locals?: Record<string, unknown>;
242
279
  cardStyles?: Record<string, Record<string, unknown>>;
280
+ fragments?: Record<string, unknown>;
281
+ fragmentStack?: string[];
243
282
  iconResolver?: (name: string) => ReactNode;
244
283
  onAction?: (type: string, actionId: string, payload?: unknown) => void;
245
284
  onError?: (errors: Array<{
@@ -248,6 +287,9 @@ interface RenderContext {
248
287
  path: string;
249
288
  }>) => void;
250
289
  limits: RuntimeLimits;
290
+ responsive: {
291
+ compact: boolean;
292
+ };
251
293
  }
252
294
  /**
253
295
  * Render a single UGC node to a React element.
@@ -272,7 +314,9 @@ declare function renderTree(rootNode: unknown, state: Record<string, unknown>, a
272
314
  code: string;
273
315
  message: string;
274
316
  path: string;
275
- }>) => void): ReactNode;
317
+ }>) => void, responsive?: {
318
+ compact: boolean;
319
+ }, fragments?: Record<string, unknown>): ReactNode;
276
320
 
277
321
  /**
278
322
  * @safe-ugc-ui/react — State Resolver
@@ -325,4 +369,4 @@ declare function resolveValue(value: unknown, state: Record<string, unknown>, lo
325
369
  */
326
370
  declare function mapStyle(style: Record<string, unknown> | undefined, state: Record<string, unknown>, locals?: Record<string, unknown>): CSSProperties;
327
371
 
328
- export { type AssetMap, Avatar, Badge, Box, Button, Chip, Column, Divider, Grid, Icon, Image, ProgressBar, type RenderContext, Row, type RuntimeLimits, Spacer, Stack, Text, Toggle, UGCContainer, UGCRenderer, type UGCRendererProps, mapStyle, renderNode, renderTree, resolveAsset, resolveRef, resolveValue };
372
+ export { Accordion, type AssetMap, Avatar, Badge, Box, Button, Chip, Column, Divider, Grid, Icon, Image, ProgressBar, type RenderContext, Row, type RuntimeLimits, Spacer, Stack, Tabs, Text, Toggle, UGCContainer, UGCRenderer, type UGCRendererProps, mapStyle, renderNode, renderTree, resolveAsset, resolveRef, resolveValue };