@wistia/ui 0.0.21 → 0.0.23
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.cjs +1827 -1281
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +345 -177
- package/dist/index.d.ts +345 -177
- package/dist/index.mjs +1682 -1145
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -11
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { ReactNode, ComponentPropsWithoutRef, JSX, ComponentPropsWithRef, MouseEvent, ChangeEvent, JSXElementConstructor, ElementType as ElementType$1 } from 'react';
|
|
3
|
+
import { ReactNode, ComponentPropsWithoutRef, JSX, ComponentPropsWithRef, MouseEvent, ChangeEvent, ForwardedRef, Ref, JSXElementConstructor, ElementType as ElementType$1 } from 'react';
|
|
4
4
|
import { LinkProps as LinkProps$1 } from 'react-router-dom';
|
|
5
5
|
import * as styled_components from 'styled-components';
|
|
6
6
|
import { DropdownMenuContentProps, DropdownMenuItemProps, DropdownMenuRadioGroupProps, DropdownMenuRadioItemProps, DropdownMenuCheckboxItemProps } from '@radix-ui/react-dropdown-menu';
|
|
@@ -47,6 +47,202 @@ declare const useMq: () => MediaQueryBooleans;
|
|
|
47
47
|
type MediaQueryLabels = keyof MediaQueryBooleans;
|
|
48
48
|
declare const useActiveMq: () => MediaQueryLabels[];
|
|
49
49
|
|
|
50
|
+
declare const colorSchemeOptions: readonly ["inherit", "default", "info", "success", "warning", "error", "blue", "green", "orange", "pink", "purple", "yellow", "vendor-hubspot", "vendor-marketo", "vendor-pardot"];
|
|
51
|
+
type ColorSchemeTypes = (typeof colorSchemeOptions)[number];
|
|
52
|
+
type ColorSchemeWrapperProps = ComponentPropsWithoutRef<'div'> & {
|
|
53
|
+
/**
|
|
54
|
+
* The color scheme to apply
|
|
55
|
+
*/
|
|
56
|
+
colorScheme: ColorSchemeTypes;
|
|
57
|
+
/**
|
|
58
|
+
* Children
|
|
59
|
+
*/
|
|
60
|
+
children: ReactNode;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* A wrapper to apply a color scheme to its children.
|
|
64
|
+
*/
|
|
65
|
+
declare const ColorSchemeWrapper: {
|
|
66
|
+
({ colorScheme, children, ...otherProps }: ColorSchemeWrapperProps): JSX.Element;
|
|
67
|
+
displayName: string;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
type ButtonVariants = 'ghost' | 'outline' | 'soft' | 'solid';
|
|
71
|
+
|
|
72
|
+
type LinkTypes = 'default' | 'email' | 'external' | 'phone';
|
|
73
|
+
type BaseProps = {
|
|
74
|
+
/**
|
|
75
|
+
* A Promise to invoke before navigating to location.
|
|
76
|
+
* _Caution: if used with `external` type prop a new window will **not** be opened_
|
|
77
|
+
*/
|
|
78
|
+
beforeAction?: (() => Promise<void>) | (() => void);
|
|
79
|
+
/**
|
|
80
|
+
* Text that appears inside of the link
|
|
81
|
+
*
|
|
82
|
+
* @type ReactNode
|
|
83
|
+
*/
|
|
84
|
+
children: ReactNode;
|
|
85
|
+
/**
|
|
86
|
+
* Set the color scheme of the button
|
|
87
|
+
* TODO - link to a color scheme page
|
|
88
|
+
*/
|
|
89
|
+
colorScheme?: ColorSchemeTypes;
|
|
90
|
+
/**
|
|
91
|
+
* Disables the link
|
|
92
|
+
*/
|
|
93
|
+
disabled?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Type of link to display
|
|
96
|
+
*
|
|
97
|
+
* * `email` creates a mailto
|
|
98
|
+
* * `phone` creates a telephone number
|
|
99
|
+
* * `external` will open links in a new window
|
|
100
|
+
*/
|
|
101
|
+
type?: LinkTypes | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* Whether the link should be underlined
|
|
104
|
+
*/
|
|
105
|
+
underline?: boolean;
|
|
106
|
+
};
|
|
107
|
+
type LinkAsLinkProps = BaseProps & ComponentPropsWithRef<'a'> & Omit<LinkProps$1, 'to'> & {
|
|
108
|
+
href: string | undefined;
|
|
109
|
+
type?: LinkTypes;
|
|
110
|
+
};
|
|
111
|
+
type LinkAsButtonProps = BaseProps & ComponentPropsWithRef<'button'> & {
|
|
112
|
+
href?: never;
|
|
113
|
+
type?: 'button' | 'reset' | 'submit';
|
|
114
|
+
};
|
|
115
|
+
type LinkProps = LinkAsButtonProps | LinkAsLinkProps;
|
|
116
|
+
/**
|
|
117
|
+
* Links are used for navigation. If no `href` is supplied, a button that is visually styled to apper as a link
|
|
118
|
+
* is used. If used in a react-router context, their [Link](https://reactrouter.com/en/main/components/link). component is used, otherwise a native a tag.
|
|
119
|
+
* This means in addition to its own props, `Link` can use props from `react-router-dom`'s `Link` component. View their documentation [here](https://reactrouter.com/en/main/components/link).
|
|
120
|
+
* The one prop we ignore from react-router is `to`. We use `href` instead and map it under the hood.
|
|
121
|
+
*
|
|
122
|
+
*/
|
|
123
|
+
declare const Link: react.ForwardRefExoticComponent<(Omit<LinkAsLinkProps, "ref"> | Omit<LinkAsButtonProps, "ref">) & react.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
|
|
124
|
+
|
|
125
|
+
type Breakpoints = 'isLgAndDown' | 'isLgAndUp' | 'isMdAndDown' | 'isMdAndUp' | 'isSmAndDown' | 'isSmAndUp' | 'isXlAndDown' | 'isXlAndUp' | 'isXsAndDown' | 'isXsAndUp';
|
|
126
|
+
type AtLeastOneBreakpoint<T, U = {
|
|
127
|
+
[K in keyof T]: Pick<T, K>;
|
|
128
|
+
}> = Partial<T> & U[keyof U];
|
|
129
|
+
type ResponsiveObject<T> = AtLeastOneBreakpoint<Record<Breakpoints, T>> & {
|
|
130
|
+
base: T;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
type ButtonSizes = 'lg' | 'md' | 'sm' | 'xl';
|
|
134
|
+
type BaseButtonProps = {
|
|
135
|
+
/**
|
|
136
|
+
* Text that appears inside of the button
|
|
137
|
+
*
|
|
138
|
+
* @type ReactNode
|
|
139
|
+
*/
|
|
140
|
+
children?: ReactNode;
|
|
141
|
+
/**
|
|
142
|
+
* Set the color scheme of the button
|
|
143
|
+
* TODO - link to a color scheme page
|
|
144
|
+
*/
|
|
145
|
+
colorScheme?: ColorSchemeTypes;
|
|
146
|
+
/**
|
|
147
|
+
* Disables the button
|
|
148
|
+
*/
|
|
149
|
+
disabled?: boolean;
|
|
150
|
+
/**
|
|
151
|
+
* Show a spinner when the button is in a loading state
|
|
152
|
+
*/
|
|
153
|
+
isLoading?: boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Icon to display on the left side of the button, Must be an instance of [Icon](?path=/docs/components-icon--docs)
|
|
156
|
+
*/
|
|
157
|
+
leftIcon?: JSX.Element | undefined;
|
|
158
|
+
/**
|
|
159
|
+
* Callback function invoked when the button is clicked
|
|
160
|
+
*
|
|
161
|
+
* @type (event: MouseEvent) => void
|
|
162
|
+
*/
|
|
163
|
+
onClick?: ((event: MouseEvent) => void) | undefined;
|
|
164
|
+
/**
|
|
165
|
+
* @ignore
|
|
166
|
+
* Force a button into a particular css state (for debugging)
|
|
167
|
+
*/
|
|
168
|
+
forceState?: 'active' | 'focus' | 'hover' | undefined;
|
|
169
|
+
/**
|
|
170
|
+
* If true, the button will fill its container
|
|
171
|
+
*
|
|
172
|
+
* @type boolean | ResponsiveObject<boolean>
|
|
173
|
+
*/
|
|
174
|
+
fullWidth?: ResponsiveObject<boolean> | boolean;
|
|
175
|
+
/**
|
|
176
|
+
* Provides a button without any styling (useful for wrapping another element)
|
|
177
|
+
*/
|
|
178
|
+
unstyled?: boolean;
|
|
179
|
+
/**
|
|
180
|
+
* Icon to display on the right side of the button, Must be an instance of [Icon](?path=/docs/components-icon--docs)
|
|
181
|
+
*/
|
|
182
|
+
rightIcon?: JSX.Element | undefined;
|
|
183
|
+
/**
|
|
184
|
+
* The size of button to display. Can be used as a [responsive prop](/docs/ui-docs-responsive-props--docs)
|
|
185
|
+
*/
|
|
186
|
+
size?: ButtonSizes | ResponsiveObject<ButtonSizes>;
|
|
187
|
+
/**
|
|
188
|
+
* A visual style for the button
|
|
189
|
+
*/
|
|
190
|
+
variant?: ButtonVariants;
|
|
191
|
+
};
|
|
192
|
+
type ButtonAsLinkProps = BaseButtonProps & ComponentPropsWithRef<'a'> & {
|
|
193
|
+
href: string | undefined;
|
|
194
|
+
children: ReactNode;
|
|
195
|
+
/**
|
|
196
|
+
* This just allows pathrough to beforeAction for link
|
|
197
|
+
* @ignore
|
|
198
|
+
*/
|
|
199
|
+
beforeAction?: (() => Promise<void>) | (() => void);
|
|
200
|
+
/**
|
|
201
|
+
* This just allows pathrough to beforeAction for link
|
|
202
|
+
* @ignore
|
|
203
|
+
*/
|
|
204
|
+
type?: LinkTypes;
|
|
205
|
+
};
|
|
206
|
+
type ButtonAsButtonProps = BaseButtonProps & ComponentPropsWithRef<'button'> & {
|
|
207
|
+
href?: never;
|
|
208
|
+
type?: 'button' | 'reset' | 'submit';
|
|
209
|
+
children: ReactNode;
|
|
210
|
+
};
|
|
211
|
+
type ButtonProps = ButtonAsButtonProps | ButtonAsLinkProps;
|
|
212
|
+
/**
|
|
213
|
+
* Button component is used to trigger an action or event,
|
|
214
|
+
* such as submitting a form, opening a Dialog, canceling an
|
|
215
|
+
* action, or performing a delete operation. It replaces the HTML `<button>` element,
|
|
216
|
+
* unless an `href` attribute is passed, in which it will render an `<a>` element.
|
|
217
|
+
*/
|
|
218
|
+
declare const Button: react.ForwardRefExoticComponent<(Omit<ButtonAsLinkProps, "ref"> | Omit<ButtonAsButtonProps, "ref">) & react.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
|
|
219
|
+
|
|
220
|
+
type ToastProps = ComponentPropsWithoutRef<'div'> & {
|
|
221
|
+
/**
|
|
222
|
+
* Action can be undefined (default dismiss button), a Button component or false to hide the dismiss button
|
|
223
|
+
*/
|
|
224
|
+
action?: React.ReactElement<typeof Button> | undefined;
|
|
225
|
+
/**
|
|
226
|
+
* Set the [color scheme](../?path=/docs/docs-color-schemes--docs) of the `Toast`
|
|
227
|
+
*/
|
|
228
|
+
colorScheme?: ColorSchemeTypes | undefined;
|
|
229
|
+
/**
|
|
230
|
+
* Optional `Icon` component to use. Must be an instance of [Icon](/?path=/docs/components-icon--docs)
|
|
231
|
+
*/
|
|
232
|
+
icon?: JSX.Element | undefined;
|
|
233
|
+
/**
|
|
234
|
+
* The message displayed in the toast
|
|
235
|
+
*/
|
|
236
|
+
message: JSX.Element | string;
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
type Position = 'bottom-center' | 'bottom-left' | 'bottom-right' | 'top-center' | 'top-left' | 'top-right';
|
|
240
|
+
type UseToastProps = ToastProps & {
|
|
241
|
+
position?: Position;
|
|
242
|
+
duration?: number;
|
|
243
|
+
};
|
|
244
|
+
declare const useToast: () => (({ message, icon, colorScheme, action, position, duration, }: UseToastProps) => void);
|
|
245
|
+
|
|
50
246
|
declare const useWindowSize: (interval?: number) => {
|
|
51
247
|
width: number;
|
|
52
248
|
height: number;
|
|
@@ -90,26 +286,6 @@ declare const Avatar: {
|
|
|
90
286
|
displayName: string;
|
|
91
287
|
};
|
|
92
288
|
|
|
93
|
-
declare const colorSchemeOptions: readonly ["inherit", "default", "info", "success", "warning", "error", "blue", "green", "orange", "pink", "purple", "yellow", "vendor-hubspot", "vendor-marketo", "vendor-pardot"];
|
|
94
|
-
type ColorSchemeTypes = (typeof colorSchemeOptions)[number];
|
|
95
|
-
type ColorSchemeWrapperProps = ComponentPropsWithoutRef<'div'> & {
|
|
96
|
-
/**
|
|
97
|
-
* The color scheme to apply
|
|
98
|
-
*/
|
|
99
|
-
colorScheme: ColorSchemeTypes;
|
|
100
|
-
/**
|
|
101
|
-
* Children
|
|
102
|
-
*/
|
|
103
|
-
children: ReactNode;
|
|
104
|
-
};
|
|
105
|
-
/**
|
|
106
|
-
* A wrapper to apply a color scheme to its children.
|
|
107
|
-
*/
|
|
108
|
-
declare const ColorSchemeWrapper: {
|
|
109
|
-
({ colorScheme, children, ...otherProps }: ColorSchemeWrapperProps): JSX.Element;
|
|
110
|
-
displayName: string;
|
|
111
|
-
};
|
|
112
|
-
|
|
113
289
|
type BadgeProps = ComponentPropsWithoutRef<'div'> & {
|
|
114
290
|
/**
|
|
115
291
|
* Set the color scheme of the `Badge`
|
|
@@ -117,7 +293,7 @@ type BadgeProps = ComponentPropsWithoutRef<'div'> & {
|
|
|
117
293
|
*/
|
|
118
294
|
colorScheme?: ColorSchemeTypes;
|
|
119
295
|
/**
|
|
120
|
-
* The `Icon` component to use. Must be an instance of [Icon](
|
|
296
|
+
* The `Icon` component to use. Must be an instance of [Icon](../?path=/docs/components-icon--docs)
|
|
121
297
|
*/
|
|
122
298
|
icon?: JSX.Element;
|
|
123
299
|
/**
|
|
@@ -135,7 +311,7 @@ declare const Badge: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProp
|
|
|
135
311
|
*/
|
|
136
312
|
colorScheme?: ColorSchemeTypes;
|
|
137
313
|
/**
|
|
138
|
-
* The `Icon` component to use. Must be an instance of [Icon](
|
|
314
|
+
* The `Icon` component to use. Must be an instance of [Icon](../?path=/docs/components-icon--docs)
|
|
139
315
|
*/
|
|
140
316
|
icon?: JSX.Element;
|
|
141
317
|
/**
|
|
@@ -261,156 +437,6 @@ declare const Box: {
|
|
|
261
437
|
displayName: string;
|
|
262
438
|
};
|
|
263
439
|
|
|
264
|
-
type ButtonVariants = 'ghost' | 'outline' | 'soft' | 'solid';
|
|
265
|
-
|
|
266
|
-
type LinkTypes = 'default' | 'email' | 'external' | 'phone';
|
|
267
|
-
type BaseProps = {
|
|
268
|
-
/**
|
|
269
|
-
* A Promise to invoke before navigating to location.
|
|
270
|
-
* _Caution: if used with `external` type prop a new window will **not** be opened_
|
|
271
|
-
*/
|
|
272
|
-
beforeAction?: (() => Promise<void>) | (() => void);
|
|
273
|
-
/**
|
|
274
|
-
* Text that appears inside of the link
|
|
275
|
-
*
|
|
276
|
-
* @type ReactNode
|
|
277
|
-
*/
|
|
278
|
-
children: ReactNode;
|
|
279
|
-
/**
|
|
280
|
-
* Set the color scheme of the button
|
|
281
|
-
* TODO - link to a color scheme page
|
|
282
|
-
*/
|
|
283
|
-
colorScheme?: ColorSchemeTypes;
|
|
284
|
-
/**
|
|
285
|
-
* Disables the link
|
|
286
|
-
*/
|
|
287
|
-
disabled?: boolean;
|
|
288
|
-
/**
|
|
289
|
-
* Type of link to display
|
|
290
|
-
*
|
|
291
|
-
* * `email` creates a mailto
|
|
292
|
-
* * `phone` creates a telephone number
|
|
293
|
-
* * `external` will open links in a new window
|
|
294
|
-
*/
|
|
295
|
-
type?: LinkTypes | undefined;
|
|
296
|
-
/**
|
|
297
|
-
* Whether the link should be underlined
|
|
298
|
-
*/
|
|
299
|
-
underline?: boolean;
|
|
300
|
-
};
|
|
301
|
-
type LinkAsLinkProps = BaseProps & ComponentPropsWithRef<'a'> & Omit<LinkProps$1, 'to'> & {
|
|
302
|
-
href: string | undefined;
|
|
303
|
-
type?: LinkTypes;
|
|
304
|
-
};
|
|
305
|
-
type LinkAsButtonProps = BaseProps & ComponentPropsWithRef<'button'> & {
|
|
306
|
-
href?: never;
|
|
307
|
-
type?: 'button' | 'reset' | 'submit';
|
|
308
|
-
};
|
|
309
|
-
type LinkProps = LinkAsButtonProps | LinkAsLinkProps;
|
|
310
|
-
/**
|
|
311
|
-
* Links are used for navigation. If no `href` is supplied, a button that is visually styled to apper as a link
|
|
312
|
-
* is used. If used in a react-router context, their [Link](https://reactrouter.com/en/main/components/link). component is used, otherwise a native a tag.
|
|
313
|
-
* This means in addition to its own props, `Link` can use props from `react-router-dom`'s `Link` component. View their documentation [here](https://reactrouter.com/en/main/components/link).
|
|
314
|
-
* The one prop we ignore from react-router is `to`. We use `href` instead and map it under the hood.
|
|
315
|
-
*
|
|
316
|
-
*/
|
|
317
|
-
declare const Link: react.ForwardRefExoticComponent<(Omit<LinkAsLinkProps, "ref"> | Omit<LinkAsButtonProps, "ref">) & react.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
|
|
318
|
-
|
|
319
|
-
type Breakpoints = 'isLgAndDown' | 'isLgAndUp' | 'isMdAndDown' | 'isMdAndUp' | 'isSmAndDown' | 'isSmAndUp' | 'isXlAndDown' | 'isXlAndUp' | 'isXsAndDown' | 'isXsAndUp';
|
|
320
|
-
type AtLeastOneBreakpoint<T, U = {
|
|
321
|
-
[K in keyof T]: Pick<T, K>;
|
|
322
|
-
}> = Partial<T> & U[keyof U];
|
|
323
|
-
type ResponsiveObject<T> = AtLeastOneBreakpoint<Record<Breakpoints, T>> & {
|
|
324
|
-
base: T;
|
|
325
|
-
};
|
|
326
|
-
|
|
327
|
-
type ButtonSizes = 'lg' | 'md' | 'sm' | 'xl';
|
|
328
|
-
type BaseButtonProps = {
|
|
329
|
-
/**
|
|
330
|
-
* Text that appears inside of the button
|
|
331
|
-
*
|
|
332
|
-
* @type ReactNode
|
|
333
|
-
*/
|
|
334
|
-
children?: ReactNode;
|
|
335
|
-
/**
|
|
336
|
-
* Set the color scheme of the button
|
|
337
|
-
* TODO - link to a color scheme page
|
|
338
|
-
*/
|
|
339
|
-
colorScheme?: ColorSchemeTypes;
|
|
340
|
-
/**
|
|
341
|
-
* Disables the button
|
|
342
|
-
*/
|
|
343
|
-
disabled?: boolean;
|
|
344
|
-
/**
|
|
345
|
-
* Show a spinner when the button is in a loading state
|
|
346
|
-
*/
|
|
347
|
-
isLoading?: boolean;
|
|
348
|
-
/**
|
|
349
|
-
* Icon to display on the left side of the button, Must be an instance of [Icon](?path=/docs/components-icon--docs)
|
|
350
|
-
*/
|
|
351
|
-
leftIcon?: JSX.Element | undefined;
|
|
352
|
-
/**
|
|
353
|
-
* Callback function invoked when the button is clicked
|
|
354
|
-
*
|
|
355
|
-
* @type (event: MouseEvent) => void
|
|
356
|
-
*/
|
|
357
|
-
onClick?: ((event: MouseEvent) => void) | undefined;
|
|
358
|
-
/**
|
|
359
|
-
* @ignore
|
|
360
|
-
* Force a button into a particular css state (for debugging)
|
|
361
|
-
*/
|
|
362
|
-
forceState?: 'active' | 'focus' | 'hover' | undefined;
|
|
363
|
-
/**
|
|
364
|
-
* If true, the button will fill its container
|
|
365
|
-
*
|
|
366
|
-
* @type boolean | ResponsiveObject<boolean>
|
|
367
|
-
*/
|
|
368
|
-
fullWidth?: ResponsiveObject<boolean> | boolean;
|
|
369
|
-
/**
|
|
370
|
-
* Provides a button without any styling (useful for wrapping another element)
|
|
371
|
-
*/
|
|
372
|
-
unstyled?: boolean;
|
|
373
|
-
/**
|
|
374
|
-
* Icon to display on the right side of the button, Must be an instance of [Icon](?path=/docs/components-icon--docs)
|
|
375
|
-
*/
|
|
376
|
-
rightIcon?: JSX.Element | undefined;
|
|
377
|
-
/**
|
|
378
|
-
* The size of button to display. Can be used as a [responsive prop](/docs/ui-docs-responsive-props--docs)
|
|
379
|
-
*/
|
|
380
|
-
size?: ButtonSizes | ResponsiveObject<ButtonSizes>;
|
|
381
|
-
/**
|
|
382
|
-
* A visual style for the button
|
|
383
|
-
*/
|
|
384
|
-
variant?: ButtonVariants;
|
|
385
|
-
};
|
|
386
|
-
type ButtonAsLinkProps = BaseButtonProps & ComponentPropsWithRef<'a'> & {
|
|
387
|
-
href: string | undefined;
|
|
388
|
-
children: ReactNode;
|
|
389
|
-
/**
|
|
390
|
-
* This just allows pathrough to beforeAction for link
|
|
391
|
-
* @ignore
|
|
392
|
-
*/
|
|
393
|
-
beforeAction?: (() => Promise<void>) | (() => void);
|
|
394
|
-
/**
|
|
395
|
-
* This just allows pathrough to beforeAction for link
|
|
396
|
-
* @ignore
|
|
397
|
-
*/
|
|
398
|
-
type?: LinkTypes;
|
|
399
|
-
};
|
|
400
|
-
type ButtonAsButtonProps = BaseButtonProps & ComponentPropsWithRef<'button'> & {
|
|
401
|
-
href?: never;
|
|
402
|
-
type?: 'button' | 'reset' | 'submit';
|
|
403
|
-
children: ReactNode;
|
|
404
|
-
};
|
|
405
|
-
type ButtonProps = ButtonAsButtonProps | ButtonAsLinkProps;
|
|
406
|
-
/**
|
|
407
|
-
* Button component is used to trigger an action or event,
|
|
408
|
-
* such as submitting a form, opening a Dialog, canceling an
|
|
409
|
-
* action, or performing a delete operation. It replaces the HTML `<button>` element,
|
|
410
|
-
* unless an `href` attribute is passed, in which it will render an `<a>` element.
|
|
411
|
-
*/
|
|
412
|
-
declare const Button: react.ForwardRefExoticComponent<(Omit<ButtonAsLinkProps, "ref"> | Omit<ButtonAsButtonProps, "ref">) & react.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
|
|
413
|
-
|
|
414
440
|
type ButtonGroupProps = ComponentPropsWithoutRef<'div'> & {
|
|
415
441
|
/**
|
|
416
442
|
* Align buttons to the left or right of their container
|
|
@@ -515,6 +541,146 @@ declare const Ellipsis: {
|
|
|
515
541
|
displayName: string;
|
|
516
542
|
};
|
|
517
543
|
|
|
544
|
+
type ActionCallback<T> = (data: T, nextData: T) => Promise<T> | T;
|
|
545
|
+
type Action = (data: FormData | null) => Promise<void>;
|
|
546
|
+
type FormActionState<T> = [{
|
|
547
|
+
data: T;
|
|
548
|
+
error: Error | null;
|
|
549
|
+
}, Action, boolean];
|
|
550
|
+
declare const useFormState: <T extends object>(action: ActionCallback<T>, initialData?: Partial<T>) => FormActionState<T>;
|
|
551
|
+
|
|
552
|
+
type ValidationCallback<T> = (data: T) => FormErrors<T>;
|
|
553
|
+
type FormWithLabelledByProps = {
|
|
554
|
+
'aria-label'?: never;
|
|
555
|
+
/**
|
|
556
|
+
* The id of the element that labels the form. Typically a heading.
|
|
557
|
+
*/
|
|
558
|
+
'aria-labelledby': string;
|
|
559
|
+
};
|
|
560
|
+
type FormWithLabelProps = {
|
|
561
|
+
/**
|
|
562
|
+
* Accessible name of the form. Use this only when a visible label is not possible. If the form has a title or heading, use `aria-labelledby` instead.
|
|
563
|
+
*/
|
|
564
|
+
'aria-label': string;
|
|
565
|
+
'aria-labelledby'?: never;
|
|
566
|
+
};
|
|
567
|
+
type FormErrors<T> = Partial<{
|
|
568
|
+
[K in keyof T]: string[] | string;
|
|
569
|
+
}>;
|
|
570
|
+
type FormProps<T> = Omit<ComponentPropsWithoutRef<'form'>, 'action' | 'aria-label' | 'aria-labelledby' | 'children'> & {
|
|
571
|
+
/**
|
|
572
|
+
* The action to be performed when the form is submitted. It can be asynchronous.
|
|
573
|
+
*/
|
|
574
|
+
action?: Action;
|
|
575
|
+
/**
|
|
576
|
+
* The form elements used in the form
|
|
577
|
+
*/
|
|
578
|
+
children: ReactNode;
|
|
579
|
+
/**
|
|
580
|
+
* An object that providesd errors for the form fields. This is created by `useFormState` and passed along to `FormField`s.
|
|
581
|
+
*/
|
|
582
|
+
errors?: FormErrors<T>;
|
|
583
|
+
/**
|
|
584
|
+
* If true, fills the entire container
|
|
585
|
+
*/
|
|
586
|
+
fullWidth?: boolean;
|
|
587
|
+
/**
|
|
588
|
+
* The function for handling validation.
|
|
589
|
+
*/
|
|
590
|
+
validate?: ValidationCallback<T>;
|
|
591
|
+
/**
|
|
592
|
+
* An object that provides valuesfor the form fields. This is typically the `state.data` value from `useFormState` and passed along to `FormField`s.
|
|
593
|
+
*/
|
|
594
|
+
values?: T;
|
|
595
|
+
} & (FormWithLabelledByProps | FormWithLabelProps);
|
|
596
|
+
/**
|
|
597
|
+
* x
|
|
598
|
+
*/
|
|
599
|
+
declare const FormComponent: {
|
|
600
|
+
<T>({ children, action, values, validate, fullWidth, ...props }: FormProps<T>, forwardedRef?: Ref<HTMLFormElement>): JSX.Element;
|
|
601
|
+
displayName: string;
|
|
602
|
+
};
|
|
603
|
+
declare const Form: <T>(props: FormProps<T> & {
|
|
604
|
+
ref?: ForwardedRef<HTMLUListElement>;
|
|
605
|
+
}) => ReturnType<typeof FormComponent>;
|
|
606
|
+
|
|
607
|
+
type FormErrorSummaryProps = {
|
|
608
|
+
description: string;
|
|
609
|
+
};
|
|
610
|
+
declare const FormErrorSummary: ({ description }: FormErrorSummaryProps) => react_jsx_runtime.JSX.Element | null;
|
|
611
|
+
|
|
612
|
+
type FormFieldProps = ComponentPropsWithoutRef<'div'> & {
|
|
613
|
+
/**
|
|
614
|
+
* This should be a single child that is a valid form field (or can pretend to be one).
|
|
615
|
+
*/
|
|
616
|
+
children: JSX.Element;
|
|
617
|
+
/**
|
|
618
|
+
* Valid label text
|
|
619
|
+
*/
|
|
620
|
+
label: ReactNode;
|
|
621
|
+
/**
|
|
622
|
+
* If an id isn't supplied, one is generated internally.
|
|
623
|
+
*/
|
|
624
|
+
id?: string;
|
|
625
|
+
/**
|
|
626
|
+
* Will show an error message and put the child input into an invalid state
|
|
627
|
+
*/
|
|
628
|
+
error?: ReactNode;
|
|
629
|
+
/**
|
|
630
|
+
* The name attribute of the field. It will map to the form data passed into `useFormState`.
|
|
631
|
+
*/
|
|
632
|
+
name: string;
|
|
633
|
+
/**
|
|
634
|
+
* A value that overrides the basic value. This should pair with `onChange`.
|
|
635
|
+
*/
|
|
636
|
+
value?: string;
|
|
637
|
+
};
|
|
638
|
+
/**
|
|
639
|
+
* Component description goes here
|
|
640
|
+
*/
|
|
641
|
+
declare const FormField: {
|
|
642
|
+
({ children, label, name, error, value, ...props }: FormFieldProps): JSX.Element;
|
|
643
|
+
displayName: string;
|
|
644
|
+
};
|
|
645
|
+
|
|
646
|
+
type FormGroupProps = Omit<ComponentPropsWithoutRef<'fieldset'>, 'onChange'> & {
|
|
647
|
+
children: ReactNode;
|
|
648
|
+
label?: ReactNode;
|
|
649
|
+
};
|
|
650
|
+
/**
|
|
651
|
+
* For grouping like form elements together.
|
|
652
|
+
*/
|
|
653
|
+
declare const FormGroup: {
|
|
654
|
+
({ children, label, ...props }: FormGroupProps): JSX.Element;
|
|
655
|
+
displayName: string;
|
|
656
|
+
};
|
|
657
|
+
|
|
658
|
+
type RadioGroupProps = FormGroupProps & {
|
|
659
|
+
onChange?: ((event: ChangeEvent<HTMLInputElement>) => void) | undefined;
|
|
660
|
+
value?: string | undefined;
|
|
661
|
+
name?: string | undefined;
|
|
662
|
+
};
|
|
663
|
+
/**
|
|
664
|
+
* For grouping like form elements togtether. Can serve as a checkbox
|
|
665
|
+
*/
|
|
666
|
+
declare const RadioGroup: {
|
|
667
|
+
({ children, name, onChange, value, ...props }: RadioGroupProps): JSX.Element;
|
|
668
|
+
displayName: string;
|
|
669
|
+
};
|
|
670
|
+
|
|
671
|
+
type CheckboxGroupProps = FormGroupProps & {
|
|
672
|
+
onChange?: ((event: ChangeEvent<HTMLInputElement>) => void) | undefined;
|
|
673
|
+
value?: string | undefined;
|
|
674
|
+
name?: string | undefined;
|
|
675
|
+
};
|
|
676
|
+
/**
|
|
677
|
+
* For grouping like form elements togtether. Can serve as a checkbox
|
|
678
|
+
*/
|
|
679
|
+
declare const CheckboxGroup: {
|
|
680
|
+
({ children, name, onChange, value, ...props }: CheckboxGroupProps): JSX.Element;
|
|
681
|
+
displayName: string;
|
|
682
|
+
};
|
|
683
|
+
|
|
518
684
|
type ExtendedProps<Props = Record<string, unknown>, OverrideProps = Record<string, unknown>> = Omit<Props, keyof OverrideProps> & OverrideProps;
|
|
519
685
|
type ElementType = JSXElementConstructor<any> | keyof JSX.IntrinsicElements;
|
|
520
686
|
type PropsOf<C extends ElementType> = JSX.LibraryManagedAttributes<C, ComponentPropsWithoutRef<C>>;
|
|
@@ -1366,6 +1532,8 @@ declare const RadioMenuItem: {
|
|
|
1366
1532
|
};
|
|
1367
1533
|
|
|
1368
1534
|
type CheckboxMenuItemProps = DropdownMenuCheckboxItemProps & MenuItemButtonProps & {
|
|
1535
|
+
/** Callback to fire when the checked status changes */
|
|
1536
|
+
onCheckedChange: (checked: boolean) => void;
|
|
1369
1537
|
/**
|
|
1370
1538
|
* an [Icon](?path=/docs/components-icon--docs) to use as the indicator that the radio item is selected
|
|
1371
1539
|
*/
|
|
@@ -1388,7 +1556,7 @@ type CheckboxMenuItemProps = DropdownMenuCheckboxItemProps & MenuItemButtonProps
|
|
|
1388
1556
|
ref?: never;
|
|
1389
1557
|
};
|
|
1390
1558
|
declare const CheckboxMenuItem: {
|
|
1391
|
-
({ onSelect, checked, onCheckedChange,
|
|
1559
|
+
({ onSelect, checked, onCheckedChange, ...props }: CheckboxMenuItemProps): react_jsx_runtime.JSX.Element;
|
|
1392
1560
|
displayName: string;
|
|
1393
1561
|
};
|
|
1394
1562
|
|
|
@@ -1404,7 +1572,7 @@ type RadioProps = ComponentPropsWithoutRef<'input'> & {
|
|
|
1404
1572
|
/**
|
|
1405
1573
|
* Indicates that there is an error with the input
|
|
1406
1574
|
*/
|
|
1407
|
-
|
|
1575
|
+
'aria-invalid'?: boolean;
|
|
1408
1576
|
/**
|
|
1409
1577
|
* Provides an ID for the input
|
|
1410
1578
|
*/
|
|
@@ -1447,7 +1615,7 @@ declare const Radio: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProp
|
|
|
1447
1615
|
/**
|
|
1448
1616
|
* Indicates that there is an error with the input
|
|
1449
1617
|
*/
|
|
1450
|
-
|
|
1618
|
+
'aria-invalid'?: boolean;
|
|
1451
1619
|
/**
|
|
1452
1620
|
* Provides an ID for the input
|
|
1453
1621
|
*/
|
|
@@ -1660,4 +1828,4 @@ declare const WistiaLogo: {
|
|
|
1660
1828
|
displayName: string;
|
|
1661
1829
|
};
|
|
1662
1830
|
|
|
1663
|
-
export { Avatar, type AvatarInstanceType, type AvatarProps, Badge, type BadgeProps, Box, type BoxProps, Button, ButtonGroup, type ButtonProps, Checkbox, CheckboxMenuItem, type ColorSchemeTypes, ColorSchemeWrapper, type ColorSchemeWrapperProps, Divider, Ellipsis, Heading, type HeadingProps, Icon, IconButton, type IconButtonProps, type IconNameType, Label, type LabelProps, Link, type LinkProps, Menu, MenuItem, MenuItemDescription, MenuItemLabel, MenuLabel, MenuRadioGroup, Radio, RadioMenuItem, type RadioProps, ScreenReaderOnly, Stack, SubMenu, Tag, type TagProps, Text, type TextProps, Tooltip, type TooltipProps, UIProvider, WistiaLogo, colorSchemeOptions, copyToClipboard, ellipsisFlexParentStyle, ellipsisStyle, iconSizeMap, mq, useActiveMq, useAriaLive, useMq, useWindowSize };
|
|
1831
|
+
export { Avatar, type AvatarInstanceType, type AvatarProps, Badge, type BadgeProps, Box, type BoxProps, Button, ButtonGroup, type ButtonProps, Checkbox, CheckboxGroup, CheckboxMenuItem, type ColorSchemeTypes, ColorSchemeWrapper, type ColorSchemeWrapperProps, Divider, Ellipsis, Form, FormErrorSummary, FormField, type FormFieldProps, FormGroup, type FormGroupProps, type FormProps, Heading, type HeadingProps, Icon, IconButton, type IconButtonProps, type IconNameType, Label, type LabelProps, Link, type LinkProps, Menu, MenuItem, MenuItemDescription, MenuItemLabel, MenuLabel, MenuRadioGroup, Radio, RadioGroup, RadioMenuItem, type RadioProps, ScreenReaderOnly, Stack, SubMenu, Tag, type TagProps, Text, type TextProps, Tooltip, type TooltipProps, UIProvider, WistiaLogo, colorSchemeOptions, copyToClipboard, ellipsisFlexParentStyle, ellipsisStyle, iconSizeMap, mq, useActiveMq, useAriaLive, useFormState, useMq, useToast, useWindowSize };
|