@wistia/ui 0.21.7 → 0.21.8-beta.6afbcd24.72472cd

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
@@ -3,17 +3,11 @@ import * as react from 'react';
3
3
  import { ReactNode, LegacyRef, MutableRefObject, RefCallback, Dispatch, SetStateAction, RefObject, ComponentPropsWithoutRef, JSX, ComponentPropsWithRef, AnchorHTMLAttributes, MouseEvent, ReactElement, ElementType, ChangeEvent, PropsWithChildren, InputHTMLAttributes, Ref, SyntheticEvent, ComponentProps, CSSProperties, HTMLAttributes, ForwardRefExoticComponent, RefAttributes, TdHTMLAttributes, ThHTMLAttributes } from 'react';
4
4
  import { UseFilePickerConfig, FilePickerReturnTypes, ExtractContentTypeFromConfig, useImperativeFilePickerConfig, ImperativeFilePickerReturnTypes } from 'use-file-picker/types';
5
5
  export * from 'use-file-picker/types';
6
- import { CollapsibleContentProps as CollapsibleContentProps$1 } from '@radix-ui/react-collapsible';
7
6
  import { Color } from 'culori/fn';
8
7
  import * as Ariakit from '@ariakit/react';
9
8
  import * as styled_components from 'styled-components';
10
9
  import { Schema } from 'yup';
11
- import { HoverCardContentProps } from '@radix-ui/react-hover-card';
12
10
  import ReactMarkdown from 'react-markdown';
13
- import { DropdownMenuContentProps, DropdownMenuItemProps, DropdownMenuRadioGroupProps, DropdownMenuRadioItemProps, DropdownMenuCheckboxItemProps } from '@radix-ui/react-dropdown-menu';
14
- import { PopoverContentProps } from '@radix-ui/react-popover';
15
- import { ToggleGroupSingleProps } from '@radix-ui/react-toggle-group';
16
- import { TabsProps as TabsProps$1, TabsContentProps as TabsContentProps$1, TabsListProps as TabsListProps$1, TabsTriggerProps as TabsTriggerProps$1 } from '@radix-ui/react-tabs';
17
11
  export { FileAmountLimitValidator, FileSizeValidator, FileTypeValidator, ImageDimensionsValidator, PersistentFileAmountLimitValidator } from 'use-file-picker/validators';
18
12
 
19
13
  type UIProviderProps = {
@@ -1146,7 +1140,7 @@ declare const Checkbox: react.ForwardRefExoticComponent<Omit<Omit<react.Detailed
1146
1140
  /**
1147
1141
  * Callback function invoked when the value changes
1148
1142
  */
1149
- onChange?: (event: ChangeEvent) => unknown;
1143
+ onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
1150
1144
  /**
1151
1145
  * Indicates if the input is required
1152
1146
  */
@@ -1217,7 +1211,7 @@ type CollapsibleTriggerProps = {
1217
1211
  * A trigger element that will toggle the collapsible content.
1218
1212
  * Usually a [Button](?path=/docs/components-button--docs).
1219
1213
  */
1220
- children: ReactNode;
1214
+ children: ReactElement;
1221
1215
  };
1222
1216
  declare const CollapsibleTrigger: ({ children }: CollapsibleTriggerProps) => react_jsx_runtime.JSX.Element;
1223
1217
 
@@ -1505,7 +1499,7 @@ type CollapsibleContentProps = {
1505
1499
  /**
1506
1500
  * The content that will be hidden when `Collapsible` is closed.
1507
1501
  */
1508
- children: CollapsibleContentProps$1['children'];
1502
+ children: ReactNode;
1509
1503
  };
1510
1504
  declare const CollapsibleContent: ({ clamp, children }: CollapsibleContentProps) => react_jsx_runtime.JSX.Element;
1511
1505
 
@@ -2584,6 +2578,7 @@ declare const Form: <T>(props: FormProps<T> & {
2584
2578
  }) => JSX.Element;
2585
2579
 
2586
2580
  type FormErrorSummaryProps = {
2581
+ /** A description to show before the list of form errors */
2587
2582
  description: string;
2588
2583
  };
2589
2584
  declare const FormErrorSummary: ({ description }: FormErrorSummaryProps) => react_jsx_runtime.JSX.Element | null;
@@ -2712,8 +2707,7 @@ type GridProps = ComponentPropsWithoutRef<'div'> & {
2712
2707
  };
2713
2708
  declare const Grid: (<C extends ElementType = "div">(props: PolymorphicComponentProps<C, GridProps>) => react.ReactElement | null) & UnknownRecord;
2714
2709
 
2715
- type ContentProps$1 = Omit<HoverCardContentProps, 'alignOffset' | 'arrowPadding' | 'asChild' | 'collisionPadding' | 'hideWhenDetached' | 'sideOffset'>;
2716
- type PreviewCardProps = ContentProps$1 & {
2710
+ type PreviewCardProps = {
2717
2711
  /**
2718
2712
  * The content of the preview card
2719
2713
  */
@@ -2730,7 +2724,7 @@ type PreviewCardProps = ContentProps$1 & {
2730
2724
  * The [Link](?path=/docs/components-link--docs) that opens the preview card when hovered.
2731
2725
  * Preview cards should only be used on links—do not use on non-interactive elements (e.g. buttons or plain text).
2732
2726
  */
2733
- trigger: JSX.Element;
2727
+ trigger: ReactElement;
2734
2728
  /**
2735
2729
  * If true, the preview card will use the unstyled Content component instead of StyledContent
2736
2730
  */
@@ -2753,12 +2747,20 @@ type PreviewCardProps = ContentProps$1 & {
2753
2747
  * Force the preview card to be open without user interaction (for debugging and CI)
2754
2748
  */
2755
2749
  forceOpen?: boolean;
2750
+ /**
2751
+ * The preferred side of the trigger to render on
2752
+ */
2753
+ side?: 'bottom' | 'left' | 'right' | 'top';
2754
+ /**
2755
+ * The preferred alignment against the trigger
2756
+ */
2757
+ align?: 'center' | 'end' | 'start';
2756
2758
  };
2757
2759
  /**
2758
2760
  * Preview cards reveal content on hover. **Everything in the card must also exist at the destination**—never put information only in the preview. This pattern is for sighted-only, so treat the card as a preview, not a source of truth.
2759
2761
  */
2760
2762
  declare const PreviewCard: {
2761
- ({ children, trigger, maxWidth, maxHeight, unstyled, paddingSize, openDelay, closeDelay, colorScheme, forceOpen, ...props }: PreviewCardProps): JSX.Element;
2763
+ ({ children, trigger, maxWidth, maxHeight, unstyled, paddingSize, openDelay, closeDelay, colorScheme, forceOpen, side, align, ...props }: PreviewCardProps): JSX.Element;
2762
2764
  displayName: string;
2763
2765
  };
2764
2766
 
@@ -3031,10 +3033,6 @@ type MenuProps = MenuControlProps & {
3031
3033
  * The label for the trigger element, this is ignored if `trigger` is defined
3032
3034
  */
3033
3035
  label?: string;
3034
- /**
3035
- * Callback for when the user clicks or focuses outside of the menu
3036
- */
3037
- onInteractOutside?: DropdownMenuContentProps['onInteractOutside'];
3038
3036
  /**
3039
3037
  * The side the menu appears on, relative to the trigger
3040
3038
  */
@@ -3143,7 +3141,7 @@ type MenuItemButtonProps = ButtonProps & {
3143
3141
  unstyled?: never;
3144
3142
  };
3145
3143
 
3146
- declare const MenuItem: react.ForwardRefExoticComponent<(Omit<DropdownMenuItemProps & BaseButtonProps & react.ClassAttributes<HTMLAnchorElement> & react.AnchorHTMLAttributes<HTMLAnchorElement> & {
3144
+ declare const MenuItem: react.ForwardRefExoticComponent<(Omit<BaseButtonProps & react.ClassAttributes<HTMLAnchorElement> & react.AnchorHTMLAttributes<HTMLAnchorElement> & {
3147
3145
  beforeAction?: (() => Promise<void>) | (() => void);
3148
3146
  children: react.ReactNode;
3149
3147
  colorScheme?: ColorSchemeTypes;
@@ -3185,7 +3183,16 @@ declare const MenuItem: react.ForwardRefExoticComponent<(Omit<DropdownMenuItemPr
3185
3183
  * Treats the menu item as a link when provided
3186
3184
  */
3187
3185
  href?: MenuItemButtonProps["href"];
3188
- }, "ref"> | Omit<DropdownMenuItemProps & BaseButtonProps & react.ClassAttributes<HTMLAnchorElement> & react.AnchorHTMLAttributes<HTMLAnchorElement> & {
3186
+ /**
3187
+ * Whether the menu should close when this item is clicked
3188
+ * @default true
3189
+ */
3190
+ closeOnClick?: boolean;
3191
+ /**
3192
+ * Callback when the item is selected
3193
+ */
3194
+ onSelect?: (event: SyntheticEvent) => void;
3195
+ }, "ref"> | Omit<BaseButtonProps & react.ClassAttributes<HTMLAnchorElement> & react.AnchorHTMLAttributes<HTMLAnchorElement> & {
3189
3196
  beforeAction?: (() => Promise<void>) | (() => void);
3190
3197
  children: react.ReactNode;
3191
3198
  colorScheme?: ColorSchemeTypes;
@@ -3221,7 +3228,16 @@ declare const MenuItem: react.ForwardRefExoticComponent<(Omit<DropdownMenuItemPr
3221
3228
  * Treats the menu item as a link when provided
3222
3229
  */
3223
3230
  href?: MenuItemButtonProps["href"];
3224
- }, "ref"> | Omit<DropdownMenuItemProps & BaseButtonProps & react.ClassAttributes<HTMLButtonElement> & react.ButtonHTMLAttributes<HTMLButtonElement> & {
3231
+ /**
3232
+ * Whether the menu should close when this item is clicked
3233
+ * @default true
3234
+ */
3235
+ closeOnClick?: boolean;
3236
+ /**
3237
+ * Callback when the item is selected
3238
+ */
3239
+ onSelect?: (event: SyntheticEvent) => void;
3240
+ }, "ref"> | Omit<BaseButtonProps & react.ClassAttributes<HTMLButtonElement> & react.ButtonHTMLAttributes<HTMLButtonElement> & {
3225
3241
  href?: never;
3226
3242
  type?: "button" | "reset" | "submit";
3227
3243
  children: react.ReactNode;
@@ -3243,6 +3259,15 @@ declare const MenuItem: react.ForwardRefExoticComponent<(Omit<DropdownMenuItemPr
3243
3259
  * Treats the menu item as a link when provided
3244
3260
  */
3245
3261
  href?: MenuItemButtonProps["href"];
3262
+ /**
3263
+ * Whether the menu should close when this item is clicked
3264
+ * @default true
3265
+ */
3266
+ closeOnClick?: boolean;
3267
+ /**
3268
+ * Callback when the item is selected
3269
+ */
3270
+ onSelect?: (event: SyntheticEvent) => void;
3246
3271
  }, "ref">) & react.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
3247
3272
 
3248
3273
  type MenuItemLabelProps = {
@@ -3261,22 +3286,26 @@ type MenuItemDescriptionProps = {
3261
3286
  };
3262
3287
  declare const MenuItemDescription: ({ children }: MenuItemDescriptionProps) => react_jsx_runtime.JSX.Element;
3263
3288
 
3264
- type MenuRadioGroupProps = DropdownMenuRadioGroupProps & {
3289
+ type MenuRadioGroupProps = {
3265
3290
  /**
3266
3291
  * The radio items
3267
3292
  */
3268
3293
  children: ReactNode | ReactNode[];
3269
3294
  /**
3270
- * @ignore
3295
+ * The value of the selected radio item
3271
3296
  */
3272
- asChild?: never;
3297
+ value?: string;
3298
+ /**
3299
+ * Callback when the value changes
3300
+ */
3301
+ onValueChange?: (value: string) => void;
3273
3302
  };
3274
3303
  declare const MenuRadioGroup: {
3275
3304
  ({ children, ...props }: MenuRadioGroupProps): react_jsx_runtime.JSX.Element;
3276
3305
  displayName: string;
3277
3306
  };
3278
3307
 
3279
- type RadioMenuItemProps = DropdownMenuRadioItemProps & MenuItemButtonProps & {
3308
+ type RadioMenuItemProps = MenuItemButtonProps & {
3280
3309
  /**
3281
3310
  * Optional `Icon` to use as the indicator that the radio item is selected. Must be an instance of [Icon](../?path=/docs/components-icon--docs)
3282
3311
  */
@@ -3284,7 +3313,7 @@ type RadioMenuItemProps = DropdownMenuRadioItemProps & MenuItemButtonProps & {
3284
3313
  /**
3285
3314
  * The value of the item
3286
3315
  */
3287
- value: DropdownMenuRadioItemProps['value'];
3316
+ value: string;
3288
3317
  /**
3289
3318
  * @ignore
3290
3319
  */
@@ -3297,13 +3326,17 @@ type RadioMenuItemProps = DropdownMenuRadioItemProps & MenuItemButtonProps & {
3297
3326
  * @ignore
3298
3327
  */
3299
3328
  ref?: never;
3329
+ /**
3330
+ * Callback when the item is selected
3331
+ */
3332
+ onSelect?: (event: SyntheticEvent) => void;
3300
3333
  };
3301
3334
  declare const RadioMenuItem: {
3302
3335
  ({ onSelect, value, indicator, ...props }: RadioMenuItemProps): react_jsx_runtime.JSX.Element;
3303
3336
  displayName: string;
3304
3337
  };
3305
3338
 
3306
- type CheckboxMenuItemProps = DropdownMenuCheckboxItemProps & MenuItemButtonProps & {
3339
+ type CheckboxMenuItemProps = MenuItemButtonProps & {
3307
3340
  /** Callback to fire when the checked status changes */
3308
3341
  onCheckedChange: (checked: boolean) => void;
3309
3342
  /**
@@ -3326,6 +3359,10 @@ type CheckboxMenuItemProps = DropdownMenuCheckboxItemProps & MenuItemButtonProps
3326
3359
  * @ignore
3327
3360
  */
3328
3361
  ref?: never;
3362
+ /**
3363
+ * Callback when the item is selected
3364
+ */
3365
+ onSelect?: (event: SyntheticEvent) => void;
3329
3366
  };
3330
3367
  declare const CheckboxMenuItem: {
3331
3368
  ({ onSelect, checked, onCheckedChange, ...props }: CheckboxMenuItemProps): react_jsx_runtime.JSX.Element;
@@ -3540,8 +3577,7 @@ type UncontrolledPopoverProps = {
3540
3577
  onOpenChange?: never;
3541
3578
  };
3542
3579
  type PopoverControlProps = ControlledPopoverProps | UncontrolledPopoverProps;
3543
- type ContentProps = Omit<PopoverContentProps, 'alignOffset' | 'arrowPadding' | 'asChild' | 'collisionPadding' | 'hideWhenDetached' | 'sideOffset' | 'updatePositionStrategy'>;
3544
- type PopoverProps = ContentProps & PopoverControlProps & {
3580
+ type PopoverProps = PopoverControlProps & {
3545
3581
  /**
3546
3582
  * The content of the popover
3547
3583
  */
@@ -3565,13 +3601,13 @@ type PopoverProps = ContentProps & PopoverControlProps & {
3565
3601
  /**
3566
3602
  * An interactive element. Most commonly a [Button](?path=/docs/components-button--docs) or [IconButton]([Button](?path=/docs/components-iconbutton--docs)).
3567
3603
  */
3568
- trigger: JSX.Element;
3604
+ trigger: ReactElement;
3569
3605
  /**
3570
3606
  * If true, the popover will use the unstyled Content component instead of StyledContent
3571
3607
  */
3572
3608
  unstyled?: boolean;
3573
3609
  /**
3574
- * If true, the popover will use a custom radix arrow to trigger
3610
+ * If true, the popover will use a custom arrow on the trigger
3575
3611
  */
3576
3612
  withArrow?: boolean;
3577
3613
  /**
@@ -3583,12 +3619,20 @@ type PopoverProps = ContentProps & PopoverControlProps & {
3583
3619
  * Inline styles applied to the popover popup
3584
3620
  */
3585
3621
  style?: CSSProperties;
3622
+ /**
3623
+ * The preferred side of the trigger to render on
3624
+ */
3625
+ side?: 'bottom' | 'left' | 'right' | 'top';
3626
+ /**
3627
+ * The preferred alignment against the trigger
3628
+ */
3629
+ align?: 'center' | 'end' | 'start';
3586
3630
  };
3587
3631
  /**
3588
3632
  * Displays rich content in a portal, triggered by a button.
3589
3633
  */
3590
3634
  declare const Popover: {
3591
- ({ children, trigger, isOpen, hideCloseButton, maxWidth, maxHeight, onOpenChange, unstyled, withArrow, isAnimated, colorScheme, style, ...props }: PopoverProps): JSX.Element;
3635
+ ({ children, trigger, isOpen, hideCloseButton, maxWidth, maxHeight, onOpenChange, unstyled, withArrow, isAnimated, colorScheme, style, side, align, ...props }: PopoverProps): JSX.Element;
3592
3636
  displayName: string;
3593
3637
  };
3594
3638
 
@@ -3656,7 +3700,7 @@ type RadioProps = Omit<ComponentPropsWithoutRef<'input'>, 'hideLabel' | 'label'
3656
3700
  /**
3657
3701
  * Callback function invoked when the value changes
3658
3702
  */
3659
- onChange?: (event: ChangeEvent) => unknown;
3703
+ onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
3660
3704
  /**
3661
3705
  * Indicates if the input is required
3662
3706
  */
@@ -3707,7 +3751,7 @@ declare const Radio: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTM
3707
3751
  /**
3708
3752
  * Callback function invoked when the value changes
3709
3753
  */
3710
- onChange?: (event: ChangeEvent) => unknown;
3754
+ onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
3711
3755
  /**
3712
3756
  * Indicates if the input is required
3713
3757
  */
@@ -3925,7 +3969,7 @@ declare const ScrollArea: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDiv
3925
3969
  locked?: boolean;
3926
3970
  } & react.RefAttributes<HTMLDivElement>>;
3927
3971
 
3928
- type SegmentedControlProps = Omit<ToggleGroupSingleProps, 'type'> & {
3972
+ type SegmentedControlProps = {
3929
3973
  /**
3930
3974
  * `SegmentedControlItem`s that will be rendered in grouping
3931
3975
  */
@@ -3954,7 +3998,7 @@ type SegmentedControlProps = Omit<ToggleGroupSingleProps, 'type'> & {
3954
3998
  /**
3955
3999
  * Provides a horizontal set of segments for switching between different values
3956
4000
  */
3957
- declare const SegmentedControl: ForwardRefExoticComponent<RefAttributes<HTMLDivElement> & SegmentedControlProps>;
4001
+ declare const SegmentedControl: ForwardRefExoticComponent<RefAttributes<HTMLDivElement> & SegmentedControlProps & HTMLAttributes<HTMLDivElement>>;
3958
4002
 
3959
4003
  type BaseProps$1 = {
3960
4004
  /**
@@ -4132,7 +4176,7 @@ type SliderProps = Omit<ComponentPropsWithoutRef<'div'>, 'onChange'> & {
4132
4176
  * (e.g. on mouseup, touchend, or keyup). Useful for analytics or
4133
4177
  * expensive operations where only the final value matters.
4134
4178
  */
4135
- onValueCommit?: (value: number[]) => void;
4179
+ onValueCommitted?: (value: number[]) => void;
4136
4180
  /**
4137
4181
  * Value to be added or subtracted on each step
4138
4182
  */
@@ -4144,7 +4188,7 @@ type SliderProps = Omit<ComponentPropsWithoutRef<'div'>, 'onChange'> & {
4144
4188
  value?: number[];
4145
4189
  };
4146
4190
  declare const Slider: {
4147
- ({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, disabled, initialValue, max, min, onChange, onValueCommit, step, value, "data-testid": dataTestId, ...otherProps }: SliderProps): JSX.Element;
4191
+ ({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, disabled, initialValue, max, min, onChange, onValueCommitted, step, value, "data-testid": dataTestId, ...otherProps }: SliderProps): JSX.Element;
4148
4192
  displayName: string;
4149
4193
  };
4150
4194
 
@@ -4262,7 +4306,7 @@ type SwitchProps = Omit<ComponentPropsWithoutRef<'input'>, 'hideLabel' | 'label'
4262
4306
  /**
4263
4307
  * Callback function invoked when the value changes
4264
4308
  */
4265
- onChange?: (event: ChangeEvent) => unknown;
4309
+ onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
4266
4310
  /**
4267
4311
  * Indicates if the input is required
4268
4312
  */
@@ -4312,7 +4356,7 @@ declare const Switch: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHT
4312
4356
  /**
4313
4357
  * Callback function invoked when the value changes
4314
4358
  */
4315
- onChange?: (event: ChangeEvent) => unknown;
4359
+ onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
4316
4360
  /**
4317
4361
  * Indicates if the input is required
4318
4362
  */
@@ -4382,19 +4426,29 @@ type TableRowProps = HTMLAttributes<HTMLTableRowElement> & {
4382
4426
  };
4383
4427
  declare const TableRow: ({ children, ...props }: TableRowProps) => JSX.Element;
4384
4428
 
4385
- type TabsProps = Pick<TabsProps$1, 'children' | 'defaultValue' | 'onValueChange' | 'value'>;
4429
+ type TabsProps = {
4430
+ children?: React.ReactNode;
4431
+ defaultValue?: string;
4432
+ onValueChange?: (value: string) => void;
4433
+ value?: string;
4434
+ };
4386
4435
  declare const Tabs: {
4387
4436
  ({ children, value: valueProp, onValueChange: onValueChangeProp, defaultValue, ...props }: TabsProps): JSX.Element;
4388
4437
  displayName: string;
4389
4438
  };
4390
4439
 
4391
- type TabsContentProps = Pick<TabsContentProps$1, 'children' | 'value'>;
4440
+ type TabsContentProps = {
4441
+ children?: ReactNode;
4442
+ value: string;
4443
+ };
4392
4444
  declare const TabsContent: {
4393
4445
  ({ children, value }: TabsContentProps): JSX.Element;
4394
4446
  displayName: string;
4395
4447
  };
4396
4448
 
4397
- type TabsListProps = Pick<TabsListProps$1, 'aria-label'> & PropsWithChildren<{
4449
+ type TabsListProps = {
4450
+ 'aria-label'?: string;
4451
+ } & PropsWithChildren<{
4398
4452
  fullWidth?: boolean;
4399
4453
  }>;
4400
4454
  declare const TabsList: {
@@ -4402,7 +4456,10 @@ declare const TabsList: {
4402
4456
  displayName: string;
4403
4457
  };
4404
4458
 
4405
- type BaseProps = Pick<TabsTriggerProps$1, 'disabled' | 'value'>;
4459
+ type BaseProps = {
4460
+ disabled?: boolean;
4461
+ value: string;
4462
+ };
4406
4463
  type IconWithLabel = {
4407
4464
  /**
4408
4465
  * The [Icon](?path=/docs/components-icon--docs) component to use, e.g. `<Icon type="favorite" />`