@wix/react-component-schema 1.4.0 → 1.6.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/editor-react-types.d.ts +408 -0
- package/dist/index.d.ts +230 -0
- package/package.json +7 -2
- package/src/__snapshots__/index.test.ts.snap +642 -0
- package/src/editor-react-types.ts +20 -0
- package/src/index.test.ts +5 -0
- package/src/index.ts +1 -0
- package/vite.config.ts +38 -2
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
declare module '@wix/editor-react-types' {
|
|
2
|
+
import type { ReactElement } from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Accessibility attributes.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* import type { A11y } from '@wix/editor-react-types';
|
|
10
|
+
*
|
|
11
|
+
* interface MyComponentProps {
|
|
12
|
+
* a11y?: A11y;
|
|
13
|
+
* }
|
|
14
|
+
*
|
|
15
|
+
* const MyComponent = ({ a11y }: MyComponentProps) => (
|
|
16
|
+
* <div
|
|
17
|
+
* tabIndex={a11y?.tabIndex}
|
|
18
|
+
* role={a11y?.role}
|
|
19
|
+
* aria-label={a11y?.ariaLabel}
|
|
20
|
+
* />
|
|
21
|
+
* );
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export interface A11y {
|
|
25
|
+
/** The `tabindex` attribute. Controls the component's position in keyboard focus order. */
|
|
26
|
+
tabIndex?: number;
|
|
27
|
+
/** The `aria-level` attribute. Defines the hierarchical level of a component within a structure. */
|
|
28
|
+
ariaLevel?: number;
|
|
29
|
+
/** The `aria-expanded` attribute. Indicates whether a collapsible component is expanded or collapsed. */
|
|
30
|
+
ariaExpanded?: boolean | 'false' | 'true';
|
|
31
|
+
/** The `aria-disabled` attribute. Indicates that the component is perceivable but disabled. */
|
|
32
|
+
ariaDisabled?: boolean | 'false' | 'true';
|
|
33
|
+
/** The `aria-atomic` attribute. Indicates whether assistive technologies should present the entire region as a whole. */
|
|
34
|
+
ariaAtomic?: boolean | 'false' | 'true';
|
|
35
|
+
/** The `aria-hidden` attribute. Hides the component from assistive technologies. */
|
|
36
|
+
ariaHidden?: boolean | 'false' | 'true';
|
|
37
|
+
/** The `aria-busy` attribute. Indicates the component is being modified and assistive technologies should wait. */
|
|
38
|
+
ariaBusy?: boolean | 'false' | 'true';
|
|
39
|
+
/** Whether the component supports multiline input. */
|
|
40
|
+
multiline?: boolean;
|
|
41
|
+
/** The `aria-autocomplete` attribute. Indicates the type of autocomplete behavior for an input. */
|
|
42
|
+
ariaAutocomplete?: 'none' | 'inline' | 'list' | 'both';
|
|
43
|
+
/** The `aria-pressed` attribute. Indicates the current "pressed" state of a toggle button. */
|
|
44
|
+
ariaPressed?: boolean | 'false' | 'mixed' | 'true';
|
|
45
|
+
/** The `aria-haspopup` attribute. Indicates the availability and type of an interactive popup component. */
|
|
46
|
+
ariaHaspopup?: boolean | 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog';
|
|
47
|
+
/** The `aria-relevant` attribute. Indicates what notifications the user agent will trigger when the accessibility tree is modified. */
|
|
48
|
+
ariaRelevant?: 'additions' | 'additions text' | 'all' | 'removals' | 'text';
|
|
49
|
+
/** The `role` attribute. Defines the semantic role of the component. */
|
|
50
|
+
role?: string;
|
|
51
|
+
/** The `aria-live` attribute. Indicates that the component will be updated and describes the types of updates. */
|
|
52
|
+
ariaLive?: 'off' | 'assertive' | 'polite';
|
|
53
|
+
/** The `aria-current` attribute. Indicates the component that represents the current item within a container or set. */
|
|
54
|
+
ariaCurrent?: boolean | 'false' | 'true' | 'page' | 'step' | 'location' | 'date' | 'time';
|
|
55
|
+
/** The `aria-label` attribute. Defines a string value that labels the component. */
|
|
56
|
+
ariaLabel?: string;
|
|
57
|
+
/** The `aria-roledescription` attribute. Defines a human-readable description for the role of the component. */
|
|
58
|
+
ariaRoledescription?: string;
|
|
59
|
+
/** The `aria-describedby` attribute. Identifies the element that describes this component. */
|
|
60
|
+
ariaDescribedby?: string;
|
|
61
|
+
/** The `aria-labelledby` attribute. Identifies the element that labels this component. */
|
|
62
|
+
ariaLabelledby?: string;
|
|
63
|
+
/** The `aria-errormessage` attribute. Identifies the element that provides an error message for this component. */
|
|
64
|
+
ariaErrormessage?: string;
|
|
65
|
+
/** The `aria-owns` attribute. Identifies a component to define a visual, functional, or contextual parent/child relationship. */
|
|
66
|
+
ariaOwns?: string;
|
|
67
|
+
/** The `aria-controls` attribute. Identifies the element whose contents or presence are controlled by this component. */
|
|
68
|
+
ariaControls?: string;
|
|
69
|
+
/** The HTML tag to render the component as (e.g. `'h1'`, `'button'`). */
|
|
70
|
+
tag?: string;
|
|
71
|
+
/** The `aria-multiline` attribute. Indicates whether a text box accepts multiple lines of input. */
|
|
72
|
+
ariaMultiline?: boolean | 'false' | 'true';
|
|
73
|
+
/** The `aria-invalid` attribute. Indicates the entered value does not conform to the expected format. */
|
|
74
|
+
ariaInvalid?: boolean | 'false' | 'true' | 'grammar' | 'spelling';
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** An adaptive streaming video source (HLS or DASH). */
|
|
78
|
+
type AdaptiveVideoSource = {
|
|
79
|
+
/** The adaptive streaming format. */
|
|
80
|
+
format: 'hls' | 'dash';
|
|
81
|
+
/** The video URI. */
|
|
82
|
+
uri: string;
|
|
83
|
+
/** The fully resolved video URL. */
|
|
84
|
+
url: string;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* An audio track from Wix Media.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```tsx
|
|
92
|
+
* import type { Audio } from '@wix/editor-react-types';
|
|
93
|
+
*
|
|
94
|
+
* interface MyComponentProps {
|
|
95
|
+
* audio?: Audio;
|
|
96
|
+
* }
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
export type Audio = {
|
|
100
|
+
/** The fully resolved audio URL. */
|
|
101
|
+
url: string;
|
|
102
|
+
/** The audio artist name. */
|
|
103
|
+
artist?: string;
|
|
104
|
+
/** The audio track title. */
|
|
105
|
+
title?: string;
|
|
106
|
+
/** The audio duration in seconds. */
|
|
107
|
+
duration?: number;
|
|
108
|
+
/** The audio file name. */
|
|
109
|
+
name?: string;
|
|
110
|
+
/** All available audio sources at different quality levels and formats. */
|
|
111
|
+
audio?: Array<AudioSource>;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
/** A single audio source file at a specific quality and format. */
|
|
115
|
+
type AudioSource = {
|
|
116
|
+
/** The audio bitrate in kbps. */
|
|
117
|
+
audioBitrate: number;
|
|
118
|
+
/** The audio format (e.g. `'mp3'`, `'ogg'`). */
|
|
119
|
+
format: string;
|
|
120
|
+
/** The audio quality label. */
|
|
121
|
+
quality: string;
|
|
122
|
+
/** The fully resolved audio URL. */
|
|
123
|
+
url: string;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
type Crop = Point & {
|
|
127
|
+
width: number;
|
|
128
|
+
height: number;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* The text direction of the component.
|
|
133
|
+
* Maps to the HTML `dir` attribute.
|
|
134
|
+
* - `'ltr'` — left to right.
|
|
135
|
+
* - `'rtl'` — right to left.
|
|
136
|
+
* - `'auto'` — determined by content.
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```tsx
|
|
140
|
+
* import type { Direction } from '@wix/editor-react-types';
|
|
141
|
+
*
|
|
142
|
+
* interface MyComponentProps {
|
|
143
|
+
* direction?: Direction;
|
|
144
|
+
* }
|
|
145
|
+
*
|
|
146
|
+
* const MyComponent = ({ direction = 'ltr' }: MyComponentProps) => (
|
|
147
|
+
* <div dir={direction}>...</div>
|
|
148
|
+
* );
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
export type Direction = 'rtl' | 'ltr' | 'auto';
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* An image from Wix Media.
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```tsx
|
|
158
|
+
* import type { Image } from '@wix/editor-react-types';
|
|
159
|
+
*
|
|
160
|
+
* interface MyComponentProps {
|
|
161
|
+
* image?: Image;
|
|
162
|
+
* }
|
|
163
|
+
*
|
|
164
|
+
* const MyComponent = ({ image }: MyComponentProps) => (
|
|
165
|
+
* <img src={image?.url} alt={image?.alt} />
|
|
166
|
+
* );
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
export type Image = {
|
|
170
|
+
/** The image URI. */
|
|
171
|
+
uri?: string;
|
|
172
|
+
/** The image URL. */
|
|
173
|
+
url: string;
|
|
174
|
+
/** The image file name. */
|
|
175
|
+
name?: string;
|
|
176
|
+
/** The image height in pixels. */
|
|
177
|
+
height?: number;
|
|
178
|
+
/** The image width in pixels. */
|
|
179
|
+
width?: number;
|
|
180
|
+
/** Whether the image is animated (e.g. GIF). */
|
|
181
|
+
animated?: boolean;
|
|
182
|
+
/** The crop region applied to the image. */
|
|
183
|
+
crop?: Crop;
|
|
184
|
+
/** The image quality, as a percentage from 0 to 100. */
|
|
185
|
+
quality?: number;
|
|
186
|
+
/** The image alt text for accessibility. */
|
|
187
|
+
alt?: string;
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* A link to a URL, used for navigation within components.
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* ```tsx
|
|
195
|
+
* import type { Link } from '@wix/editor-react-types';
|
|
196
|
+
*
|
|
197
|
+
* interface MyComponentProps {
|
|
198
|
+
* link?: Link;
|
|
199
|
+
* }
|
|
200
|
+
* ```
|
|
201
|
+
*/
|
|
202
|
+
export type Link = {
|
|
203
|
+
/** The link URL. */
|
|
204
|
+
href?: string;
|
|
205
|
+
/**
|
|
206
|
+
* Where this link should open.
|
|
207
|
+
* - `'_self'` — opens in the same page.
|
|
208
|
+
* - `'_blank'` — opens in a new tab.
|
|
209
|
+
*/
|
|
210
|
+
target?: LinkTarget;
|
|
211
|
+
/** The `rel` attribute of the link. Accepts LinkRel values separated by a space. */
|
|
212
|
+
rel?: string;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
type LinkTarget = '_self' | '_blank';
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* A local date string in ISO-8601 extended format (`YYYY-MM-DD`).
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* ```tsx
|
|
222
|
+
* import type { LocalDate } from '@wix/editor-react-types';
|
|
223
|
+
*
|
|
224
|
+
* interface MyComponentProps {
|
|
225
|
+
* startDate?: LocalDate; // e.g. '2024-03-15'
|
|
226
|
+
* }
|
|
227
|
+
* ```
|
|
228
|
+
*/
|
|
229
|
+
export type LocalDate = string;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* A local time string in ISO-8601 extended format (`hh:mm[:ss][.sss]`).
|
|
233
|
+
*
|
|
234
|
+
* @example
|
|
235
|
+
* ```tsx
|
|
236
|
+
* import type { LocalTime } from '@wix/editor-react-types';
|
|
237
|
+
*
|
|
238
|
+
* interface MyComponentProps {
|
|
239
|
+
* openingTime?: LocalTime; // e.g. '09:00'
|
|
240
|
+
* }
|
|
241
|
+
* ```
|
|
242
|
+
*/
|
|
243
|
+
export type LocalTime = string;
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* A single item in a menu, optionally containing nested sub-items.
|
|
247
|
+
*/
|
|
248
|
+
type MenuItem = {
|
|
249
|
+
/** A unique identifier for the menu item. */
|
|
250
|
+
id: string;
|
|
251
|
+
/** The display label shown to the user. */
|
|
252
|
+
label: string;
|
|
253
|
+
/** The navigation link for this menu item. */
|
|
254
|
+
link?: Link;
|
|
255
|
+
/** An optional container element rendered alongside the menu item. */
|
|
256
|
+
container?: ReactElement;
|
|
257
|
+
/** Nested child menu items, for building multi-level menus. */
|
|
258
|
+
items?: Array<MenuItem>;
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* A list of menu items.
|
|
263
|
+
*
|
|
264
|
+
* @example
|
|
265
|
+
* ```tsx
|
|
266
|
+
* import type { MenuItems } from '@wix/editor-react-types';
|
|
267
|
+
*
|
|
268
|
+
* interface MyComponentProps {
|
|
269
|
+
* items?: MenuItems;
|
|
270
|
+
* }
|
|
271
|
+
* ```
|
|
272
|
+
*/
|
|
273
|
+
export type MenuItems = Array<MenuItem>;
|
|
274
|
+
|
|
275
|
+
type Point = {
|
|
276
|
+
x: number;
|
|
277
|
+
y: number;
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Rich text content with resolved links.
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* ```tsx
|
|
285
|
+
* import type { RichText } from '@wix/editor-react-types';
|
|
286
|
+
*
|
|
287
|
+
* interface MyComponentProps {
|
|
288
|
+
* description?: RichText;
|
|
289
|
+
* }
|
|
290
|
+
*
|
|
291
|
+
* const MyComponent = ({ description }: MyComponentProps) => (
|
|
292
|
+
* <div>
|
|
293
|
+
* {description?.html}
|
|
294
|
+
* {description?.linkList.map((link) => (
|
|
295
|
+
* <a key={link.href} href={link.href}>{link.href}</a>
|
|
296
|
+
* ))}
|
|
297
|
+
* </div>
|
|
298
|
+
* );
|
|
299
|
+
* ```
|
|
300
|
+
*/
|
|
301
|
+
export type RichText = {
|
|
302
|
+
/** The original rich text content. */
|
|
303
|
+
text: string;
|
|
304
|
+
/** The HTML content with all links resolved. */
|
|
305
|
+
html: string;
|
|
306
|
+
/** All links present in the rich text content. */
|
|
307
|
+
linkList: Array<Link>;
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* A vector art (SVG) asset from Wix Media.
|
|
312
|
+
*
|
|
313
|
+
* @example
|
|
314
|
+
* ```tsx
|
|
315
|
+
* import type { VectorArt } from '@wix/editor-react-types';
|
|
316
|
+
*
|
|
317
|
+
* interface MyComponentProps {
|
|
318
|
+
* icon?: VectorArt;
|
|
319
|
+
* }
|
|
320
|
+
* ```
|
|
321
|
+
*/
|
|
322
|
+
export type VectorArt = {
|
|
323
|
+
/** The SVG URI. */
|
|
324
|
+
uri: string;
|
|
325
|
+
/** The SVG `viewBox` attribute value. */
|
|
326
|
+
viewBox: string;
|
|
327
|
+
/** The SVG content box dimensions. */
|
|
328
|
+
contentBox: string;
|
|
329
|
+
/** A map of color IDs to their resolved color values, for themeable SVGs. */
|
|
330
|
+
colors: Record<string, string>;
|
|
331
|
+
/**
|
|
332
|
+
* The SVG content type, which determines how colors and theming are applied.
|
|
333
|
+
* - `'shape'` — a simple monochromatic shape.
|
|
334
|
+
* - `'color'` — a multi-color SVG.
|
|
335
|
+
* - `'tint'` — a single-color tintable SVG.
|
|
336
|
+
* - `'ugc'` — user-generated content.
|
|
337
|
+
* - `'textpath'` — text along a path.
|
|
338
|
+
*/
|
|
339
|
+
contentType: 'shape' | 'color' | 'tint' | 'ugc' | 'textpath';
|
|
340
|
+
/** The raw SVG markup. */
|
|
341
|
+
svgContent: string;
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* A video from Wix Media, including all available sources and quality levels.
|
|
346
|
+
*
|
|
347
|
+
* @example
|
|
348
|
+
* ```tsx
|
|
349
|
+
* import type { Video } from '@wix/editor-react-types';
|
|
350
|
+
*
|
|
351
|
+
* interface MyComponentProps {
|
|
352
|
+
* video?: Video;
|
|
353
|
+
* }
|
|
354
|
+
* ```
|
|
355
|
+
*/
|
|
356
|
+
export type Video = {
|
|
357
|
+
/** The original video URI. */
|
|
358
|
+
uri: string;
|
|
359
|
+
/** All available quality-level sources for progressive playback. */
|
|
360
|
+
sources: Array<VideoSource>;
|
|
361
|
+
/** Adaptive streaming sources (HLS/DASH) for streaming playback. */
|
|
362
|
+
adaptiveSources: Array<AdaptiveVideoSource>;
|
|
363
|
+
/** Whether the video contains an audio track. */
|
|
364
|
+
hasAudio: boolean;
|
|
365
|
+
/** The video frame rate in frames per second. */
|
|
366
|
+
fps: number;
|
|
367
|
+
/** A poster image to display before the video plays. */
|
|
368
|
+
poster?: Image;
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
/** A set of video files for a specific quality level. */
|
|
372
|
+
type VideoSource = {
|
|
373
|
+
/** The video quality level. */
|
|
374
|
+
quality: '1080p' | '720p' | '480p' | '360p';
|
|
375
|
+
/** The video width in pixels at this quality level. */
|
|
376
|
+
width: number;
|
|
377
|
+
/** The video height in pixels at this quality level. */
|
|
378
|
+
height: number;
|
|
379
|
+
/** The available file types for this quality level. */
|
|
380
|
+
types: Array<VideoSourceType>;
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
/** A single video file format for a given quality level. */
|
|
384
|
+
type VideoSourceType = {
|
|
385
|
+
/** The video format. */
|
|
386
|
+
format: 'mp4' | 'mp4-luminance';
|
|
387
|
+
/** The video URI. */
|
|
388
|
+
uri: string;
|
|
389
|
+
/** The fully resolved video URL. */
|
|
390
|
+
url: string;
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* A URL with an `http` or `https` scheme.
|
|
395
|
+
*
|
|
396
|
+
* @example
|
|
397
|
+
* ```tsx
|
|
398
|
+
* import type { WebUrl } from '@wix/editor-react-types';
|
|
399
|
+
*
|
|
400
|
+
* interface MyComponentProps {
|
|
401
|
+
* website?: WebUrl;
|
|
402
|
+
* }
|
|
403
|
+
* ```
|
|
404
|
+
*/
|
|
405
|
+
export type WebUrl = string;
|
|
406
|
+
|
|
407
|
+
export { }
|
|
408
|
+
}
|