@wistia/ui 0.0.22 → 0.0.24

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.mts CHANGED
@@ -47,6 +47,206 @@ 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
+ * @ignore For use in creating navs - will override any colorScheme prop
55
+ */
56
+ __nav?: boolean;
57
+ /**
58
+ * The color scheme to apply
59
+ */
60
+ colorScheme?: ColorSchemeTypes;
61
+ /**
62
+ * Children
63
+ */
64
+ children: ReactNode;
65
+ };
66
+ /**
67
+ * A wrapper to apply a color scheme to its children.
68
+ */
69
+ declare const ColorSchemeWrapper: {
70
+ ({ __nav, colorScheme, children, ...otherProps }: ColorSchemeWrapperProps): JSX.Element;
71
+ displayName: string;
72
+ };
73
+
74
+ type ButtonVariants = 'ghost' | 'outline' | 'soft' | 'solid';
75
+
76
+ type LinkTypes = 'default' | 'email' | 'external' | 'phone';
77
+ type BaseProps = {
78
+ /**
79
+ * A Promise to invoke before navigating to location.
80
+ * _Caution: if used with `external` type prop a new window will **not** be opened_
81
+ */
82
+ beforeAction?: (() => Promise<void>) | (() => void);
83
+ /**
84
+ * Text that appears inside of the link
85
+ *
86
+ * @type ReactNode
87
+ */
88
+ children: ReactNode;
89
+ /**
90
+ * Set the color scheme of the button
91
+ * TODO - link to a color scheme page
92
+ */
93
+ colorScheme?: ColorSchemeTypes;
94
+ /**
95
+ * Disables the link
96
+ */
97
+ disabled?: boolean;
98
+ /**
99
+ * Type of link to display
100
+ *
101
+ * * `email` creates a mailto
102
+ * * `phone` creates a telephone number
103
+ * * `external` will open links in a new window
104
+ */
105
+ type?: LinkTypes | undefined;
106
+ /**
107
+ * Whether the link should be underlined
108
+ */
109
+ underline?: boolean;
110
+ };
111
+ type LinkAsLinkProps = BaseProps & ComponentPropsWithRef<'a'> & Omit<LinkProps$1, 'to'> & {
112
+ href: string | undefined;
113
+ type?: LinkTypes;
114
+ };
115
+ type LinkAsButtonProps = BaseProps & ComponentPropsWithRef<'button'> & {
116
+ href?: never;
117
+ type?: 'button' | 'reset' | 'submit';
118
+ };
119
+ type LinkProps = LinkAsButtonProps | LinkAsLinkProps;
120
+ /**
121
+ * Links are used for navigation. If no `href` is supplied, a button that is visually styled to apper as a link
122
+ * 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.
123
+ * 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).
124
+ * The one prop we ignore from react-router is `to`. We use `href` instead and map it under the hood.
125
+ *
126
+ */
127
+ declare const Link: react.ForwardRefExoticComponent<(Omit<LinkAsLinkProps, "ref"> | Omit<LinkAsButtonProps, "ref">) & react.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
128
+
129
+ type Breakpoints = 'isLgAndDown' | 'isLgAndUp' | 'isMdAndDown' | 'isMdAndUp' | 'isSmAndDown' | 'isSmAndUp' | 'isXlAndDown' | 'isXlAndUp' | 'isXsAndDown' | 'isXsAndUp';
130
+ type AtLeastOneBreakpoint<T, U = {
131
+ [K in keyof T]: Pick<T, K>;
132
+ }> = Partial<T> & U[keyof U];
133
+ type ResponsiveObject<T> = AtLeastOneBreakpoint<Record<Breakpoints, T>> & {
134
+ base: T;
135
+ };
136
+
137
+ type ButtonSizes = 'lg' | 'md' | 'sm' | 'xl';
138
+ type BaseButtonProps = {
139
+ /**
140
+ * Text that appears inside of the button
141
+ *
142
+ * @type ReactNode
143
+ */
144
+ children?: ReactNode;
145
+ /**
146
+ * Set the color scheme of the button
147
+ * TODO - link to a color scheme page
148
+ */
149
+ colorScheme?: ColorSchemeTypes;
150
+ /**
151
+ * Disables the button
152
+ */
153
+ disabled?: boolean;
154
+ /**
155
+ * Show a spinner when the button is in a loading state
156
+ */
157
+ isLoading?: boolean;
158
+ /**
159
+ * Icon to display on the left side of the button, Must be an instance of [Icon](?path=/docs/components-icon--docs)
160
+ */
161
+ leftIcon?: JSX.Element | undefined;
162
+ /**
163
+ * Callback function invoked when the button is clicked
164
+ *
165
+ * @type (event: MouseEvent) => void
166
+ */
167
+ onClick?: ((event: MouseEvent) => void) | undefined;
168
+ /**
169
+ * @ignore
170
+ * Force a button into a particular css state (for debugging)
171
+ */
172
+ forceState?: 'active' | 'focus' | 'hover' | undefined;
173
+ /**
174
+ * If true, the button will fill its container
175
+ *
176
+ * @type boolean | ResponsiveObject<boolean>
177
+ */
178
+ fullWidth?: ResponsiveObject<boolean> | boolean;
179
+ /**
180
+ * Provides a button without any styling (useful for wrapping another element)
181
+ */
182
+ unstyled?: boolean;
183
+ /**
184
+ * Icon to display on the right side of the button, Must be an instance of [Icon](?path=/docs/components-icon--docs)
185
+ */
186
+ rightIcon?: JSX.Element | undefined;
187
+ /**
188
+ * The size of button to display. Can be used as a [responsive prop](/docs/ui-docs-responsive-props--docs)
189
+ */
190
+ size?: ButtonSizes | ResponsiveObject<ButtonSizes>;
191
+ /**
192
+ * A visual style for the button
193
+ */
194
+ variant?: ButtonVariants;
195
+ };
196
+ type ButtonAsLinkProps = BaseButtonProps & ComponentPropsWithRef<'a'> & {
197
+ href: string | undefined;
198
+ children: ReactNode;
199
+ /**
200
+ * This just allows pathrough to beforeAction for link
201
+ * @ignore
202
+ */
203
+ beforeAction?: (() => Promise<void>) | (() => void);
204
+ /**
205
+ * This just allows pathrough to beforeAction for link
206
+ * @ignore
207
+ */
208
+ type?: LinkTypes;
209
+ };
210
+ type ButtonAsButtonProps = BaseButtonProps & ComponentPropsWithRef<'button'> & {
211
+ href?: never;
212
+ type?: 'button' | 'reset' | 'submit';
213
+ children: ReactNode;
214
+ };
215
+ type ButtonProps = ButtonAsButtonProps | ButtonAsLinkProps;
216
+ /**
217
+ * Button component is used to trigger an action or event,
218
+ * such as submitting a form, opening a Dialog, canceling an
219
+ * action, or performing a delete operation. It replaces the HTML `<button>` element,
220
+ * unless an `href` attribute is passed, in which it will render an `<a>` element.
221
+ */
222
+ declare const Button: react.ForwardRefExoticComponent<(Omit<ButtonAsLinkProps, "ref"> | Omit<ButtonAsButtonProps, "ref">) & react.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
223
+
224
+ type ToastProps = ComponentPropsWithoutRef<'div'> & {
225
+ /**
226
+ * Action can be undefined (default dismiss button), a Button component or false to hide the dismiss button
227
+ */
228
+ action?: React.ReactElement<typeof Button> | undefined;
229
+ /**
230
+ * Set the [color scheme](../?path=/docs/docs-color-schemes--docs) of the `Toast`
231
+ */
232
+ colorScheme?: ColorSchemeTypes | undefined;
233
+ /**
234
+ * Optional `Icon` component to use. Must be an instance of [Icon](/?path=/docs/components-icon--docs)
235
+ */
236
+ icon?: JSX.Element | undefined;
237
+ /**
238
+ * The message displayed in the toast
239
+ */
240
+ message: JSX.Element | string;
241
+ };
242
+
243
+ type Position = 'bottom-center' | 'bottom-left' | 'bottom-right' | 'top-center' | 'top-left' | 'top-right';
244
+ type UseToastProps = ToastProps & {
245
+ position?: Position;
246
+ duration?: number;
247
+ };
248
+ declare const useToast: () => (({ message, icon, colorScheme, action, position, duration, }: UseToastProps) => void);
249
+
50
250
  declare const useWindowSize: (interval?: number) => {
51
251
  width: number;
52
252
  height: number;
@@ -90,26 +290,6 @@ declare const Avatar: {
90
290
  displayName: string;
91
291
  };
92
292
 
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
293
  type BadgeProps = ComponentPropsWithoutRef<'div'> & {
114
294
  /**
115
295
  * Set the color scheme of the `Badge`
@@ -117,7 +297,7 @@ type BadgeProps = ComponentPropsWithoutRef<'div'> & {
117
297
  */
118
298
  colorScheme?: ColorSchemeTypes;
119
299
  /**
120
- * The `Icon` component to use. Must be an instance of [Icon](/?path=/docs/components-icon--docs)
300
+ * The `Icon` component to use. Must be an instance of [Icon](../?path=/docs/components-icon--docs)
121
301
  */
122
302
  icon?: JSX.Element;
123
303
  /**
@@ -135,7 +315,7 @@ declare const Badge: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProp
135
315
  */
136
316
  colorScheme?: ColorSchemeTypes;
137
317
  /**
138
- * The `Icon` component to use. Must be an instance of [Icon](/?path=/docs/components-icon--docs)
318
+ * The `Icon` component to use. Must be an instance of [Icon](../?path=/docs/components-icon--docs)
139
319
  */
140
320
  icon?: JSX.Element;
141
321
  /**
@@ -261,156 +441,6 @@ declare const Box: {
261
441
  displayName: string;
262
442
  };
263
443
 
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
444
  type ButtonGroupProps = ComponentPropsWithoutRef<'div'> & {
415
445
  /**
416
446
  * Align buttons to the left or right of their container
@@ -617,6 +647,44 @@ declare const FormField: {
617
647
  displayName: string;
618
648
  };
619
649
 
650
+ type FormGroupProps = Omit<ComponentPropsWithoutRef<'fieldset'>, 'onChange'> & {
651
+ children: ReactNode;
652
+ label?: ReactNode;
653
+ };
654
+ /**
655
+ * For grouping like form elements together.
656
+ */
657
+ declare const FormGroup: {
658
+ ({ children, label, ...props }: FormGroupProps): JSX.Element;
659
+ displayName: string;
660
+ };
661
+
662
+ type RadioGroupProps = FormGroupProps & {
663
+ onChange?: ((event: ChangeEvent<HTMLInputElement>) => void) | undefined;
664
+ value?: string | undefined;
665
+ name?: string | undefined;
666
+ };
667
+ /**
668
+ * For grouping like form elements togtether. Can serve as a checkbox
669
+ */
670
+ declare const RadioGroup: {
671
+ ({ children, name, onChange, value, ...props }: RadioGroupProps): JSX.Element;
672
+ displayName: string;
673
+ };
674
+
675
+ type CheckboxGroupProps = FormGroupProps & {
676
+ onChange?: ((event: ChangeEvent<HTMLInputElement>) => void) | undefined;
677
+ value?: string | undefined;
678
+ name?: string | undefined;
679
+ };
680
+ /**
681
+ * For grouping like form elements togtether. Can serve as a checkbox
682
+ */
683
+ declare const CheckboxGroup: {
684
+ ({ children, name, onChange, value, ...props }: CheckboxGroupProps): JSX.Element;
685
+ displayName: string;
686
+ };
687
+
620
688
  type ExtendedProps<Props = Record<string, unknown>, OverrideProps = Record<string, unknown>> = Omit<Props, keyof OverrideProps> & OverrideProps;
621
689
  type ElementType = JSXElementConstructor<any> | keyof JSX.IntrinsicElements;
622
690
  type PropsOf<C extends ElementType> = JSX.LibraryManagedAttributes<C, ComponentPropsWithoutRef<C>>;
@@ -1764,42 +1832,4 @@ declare const WistiaLogo: {
1764
1832
  displayName: string;
1765
1833
  };
1766
1834
 
1767
- type FormGroupProps = Omit<ComponentPropsWithoutRef<'fieldset'>, 'onChange'> & {
1768
- children: ReactNode;
1769
- label?: ReactNode;
1770
- };
1771
- /**
1772
- * For grouping like form elements together.
1773
- */
1774
- declare const FormGroup: {
1775
- ({ children, label, ...props }: FormGroupProps): JSX.Element;
1776
- displayName: string;
1777
- };
1778
-
1779
- type RadioGroupProps = FormGroupProps & {
1780
- onChange?: ((event: ChangeEvent<HTMLInputElement>) => void) | undefined;
1781
- value?: string | undefined;
1782
- name?: string | undefined;
1783
- };
1784
- /**
1785
- * For grouping like form elements togtether. Can serve as a checkbox
1786
- */
1787
- declare const RadioGroup: {
1788
- ({ children, name, onChange, value, ...props }: RadioGroupProps): JSX.Element;
1789
- displayName: string;
1790
- };
1791
-
1792
- type CheckboxGroupProps = FormGroupProps & {
1793
- onChange?: ((event: ChangeEvent<HTMLInputElement>) => void) | undefined;
1794
- value?: string | undefined;
1795
- name?: string | undefined;
1796
- };
1797
- /**
1798
- * For grouping like form elements togtether. Can serve as a checkbox
1799
- */
1800
- declare const CheckboxGroup: {
1801
- ({ children, name, onChange, value, ...props }: CheckboxGroupProps): JSX.Element;
1802
- displayName: string;
1803
- };
1804
-
1805
- 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, useWindowSize };
1835
+ 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 };