@wistia/ui 0.0.22 → 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.d.mts CHANGED
@@ -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](/?path=/docs/components-icon--docs)
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](/?path=/docs/components-icon--docs)
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
@@ -617,6 +643,44 @@ declare const FormField: {
617
643
  displayName: string;
618
644
  };
619
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
+
620
684
  type ExtendedProps<Props = Record<string, unknown>, OverrideProps = Record<string, unknown>> = Omit<Props, keyof OverrideProps> & OverrideProps;
621
685
  type ElementType = JSXElementConstructor<any> | keyof JSX.IntrinsicElements;
622
686
  type PropsOf<C extends ElementType> = JSX.LibraryManagedAttributes<C, ComponentPropsWithoutRef<C>>;
@@ -1764,42 +1828,4 @@ declare const WistiaLogo: {
1764
1828
  displayName: string;
1765
1829
  };
1766
1830
 
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 };
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 };