@wistia/ui 0.6.37 → 0.6.38

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
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as react from 'react';
3
- import react__default, { ReactNode, LegacyRef, MutableRefObject, RefCallback, Dispatch, SetStateAction, ComponentPropsWithoutRef, JSX, ComponentPropsWithRef, MouseEvent, ElementType, ChangeEvent, ForwardedRef, Ref, InputHTMLAttributes, RefObject, ForwardRefExoticComponent, RefAttributes, HTMLAttributes } from 'react';
3
+ import react__default, { ReactNode, LegacyRef, MutableRefObject, RefCallback, Dispatch, SetStateAction, RefObject, ComponentPropsWithoutRef, JSX, ComponentPropsWithRef, MouseEvent, ElementType, ChangeEvent, ForwardedRef, Ref, InputHTMLAttributes, ForwardRefExoticComponent, RefAttributes, HTMLAttributes } from 'react';
4
4
  export * from 'use-file-picker/types';
5
5
  export { useFilePicker, useImperativeFilePicker } from 'use-file-picker';
6
6
  export { FileAmountLimitValidator, FileSizeValidator, FileTypeValidator, ImageDimensionsValidator, PersistentFileAmountLimitValidator } from 'use-file-picker/validators';
@@ -104,6 +104,9 @@ declare const useLocalStorage: <T, _>(key: Parameters<SetItemType>[0], initialVa
104
104
 
105
105
  declare const useLockBodyScroll: (locked: boolean) => void;
106
106
 
107
+ type EventType = 'focusin' | 'focusout' | 'mousedown' | 'mouseup' | 'touchend' | 'touchstart';
108
+ declare const useOnClickOutside: (ref: RefObject<HTMLElement | null | undefined>, handler: (event: Event) => unknown, eventTypes?: EventType | EventType[]) => void;
109
+
107
110
  type MediaQueryBooleans = {
108
111
  isXlAndUp: boolean;
109
112
  isLgAndUp: boolean;
@@ -3028,4 +3031,4 @@ declare const WistiaLogo: {
3028
3031
  displayName: string;
3029
3032
  };
3030
3033
 
3031
- export { ActionButton, type ActionButtonProps, Avatar, type AvatarProps, type AvatarStatus, Badge, type BadgeProps, Box, type BoxProps, Breadcrumb, type BreadcrumbProps, Breadcrumbs, type BreadcrumbsProps, Button, ButtonGroup, type ButtonProps, Card, type CardProps, Center, type CenterProps, Checkbox, CheckboxGroup, CheckboxMenuItem, ClickRegion, type ClickRegionProps, Collapsible, CollapsibleContent, type CollapsibleProps, CollapsibleTrigger, type ColorSchemeTypes, ColorSchemeWrapper, type ColorSchemeWrapperProps, DataCard, type DataCardProps, DataCardTrend, type DataCardTrendProps, DataCards, type DataCardsProps, Divider, EditableHeading, type EditableHeadingProps, Ellipsis, Form, FormErrorSummary, FormField, type FormFieldProps, FormGroup, type FormGroupProps, type FormProps, Heading, type HeadingProps, Icon, IconButton, type IconButtonProps, type IconNameType, Image, type ImageProps, Input, type InputProps, Label, type LabelProps, Link, type LinkProps, Menu, MenuItem, MenuItemDescription, MenuItemLabel, MenuLabel, MenuRadioGroup, Modal, type ModalProps, Popover, type PopoverProps, ProgressBar, type ProgressBarProps, Radio, RadioGroup, RadioMenuItem, type RadioProps, ScreenReaderOnly, SegmentedControl, SegmentedControlItem, type SegmentedControlItemProps, type SegmentedControlProps, Select, SelectOption, SelectOptionGroup, type SelectOptionGroupProps, type SelectOptionProps, type SelectProps, Stack, SubMenu, Switch, type SwitchProps, Tab, type TabProps, Table, TableBody, type TableBodyProps, TableCell, type TableCellProps, TableFooter, type TableFooterProps, TableHead, type TableHeadProps, type TableProps, TableRow, type TableRowProps, Tabs, type TabsProps, Tag, type TagProps, Text, type TextProps, Tooltip, type TooltipProps, UIProvider, type UseToastProps, WistiaLogo, colorSchemeOptions, copyToClipboard, dateTime, ellipsisFlexParentStyle, ellipsisStyle, iconSizeMap, mergeRefs, mq, useActiveMq, useAriaLive, useBoolean, useFormState, useKey, useLocalStorage, useLockBodyScroll, useMq, useToast, useWindowSize };
3034
+ export { ActionButton, type ActionButtonProps, Avatar, type AvatarProps, type AvatarStatus, Badge, type BadgeProps, Box, type BoxProps, Breadcrumb, type BreadcrumbProps, Breadcrumbs, type BreadcrumbsProps, Button, ButtonGroup, type ButtonProps, Card, type CardProps, Center, type CenterProps, Checkbox, CheckboxGroup, CheckboxMenuItem, ClickRegion, type ClickRegionProps, Collapsible, CollapsibleContent, type CollapsibleProps, CollapsibleTrigger, type ColorSchemeTypes, ColorSchemeWrapper, type ColorSchemeWrapperProps, DataCard, type DataCardProps, DataCardTrend, type DataCardTrendProps, DataCards, type DataCardsProps, Divider, EditableHeading, type EditableHeadingProps, Ellipsis, Form, FormErrorSummary, FormField, type FormFieldProps, FormGroup, type FormGroupProps, type FormProps, Heading, type HeadingProps, Icon, IconButton, type IconButtonProps, type IconNameType, Image, type ImageProps, Input, type InputProps, Label, type LabelProps, Link, type LinkProps, Menu, MenuItem, MenuItemDescription, MenuItemLabel, MenuLabel, MenuRadioGroup, Modal, type ModalProps, Popover, type PopoverProps, ProgressBar, type ProgressBarProps, Radio, RadioGroup, RadioMenuItem, type RadioProps, ScreenReaderOnly, SegmentedControl, SegmentedControlItem, type SegmentedControlItemProps, type SegmentedControlProps, Select, SelectOption, SelectOptionGroup, type SelectOptionGroupProps, type SelectOptionProps, type SelectProps, Stack, SubMenu, Switch, type SwitchProps, Tab, type TabProps, Table, TableBody, type TableBodyProps, TableCell, type TableCellProps, TableFooter, type TableFooterProps, TableHead, type TableHeadProps, type TableProps, TableRow, type TableRowProps, Tabs, type TabsProps, Tag, type TagProps, Text, type TextProps, Tooltip, type TooltipProps, UIProvider, type UseToastProps, WistiaLogo, colorSchemeOptions, copyToClipboard, dateTime, ellipsisFlexParentStyle, ellipsisStyle, iconSizeMap, mergeRefs, mq, useActiveMq, useAriaLive, useBoolean, useFormState, useKey, useLocalStorage, useLockBodyScroll, useMq, useOnClickOutside, useToast, useWindowSize };
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 react__default, { ReactNode, LegacyRef, MutableRefObject, RefCallback, Dispatch, SetStateAction, ComponentPropsWithoutRef, JSX, ComponentPropsWithRef, MouseEvent, ElementType, ChangeEvent, ForwardedRef, Ref, InputHTMLAttributes, RefObject, ForwardRefExoticComponent, RefAttributes, HTMLAttributes } from 'react';
3
+ import react__default, { ReactNode, LegacyRef, MutableRefObject, RefCallback, Dispatch, SetStateAction, RefObject, ComponentPropsWithoutRef, JSX, ComponentPropsWithRef, MouseEvent, ElementType, ChangeEvent, ForwardedRef, Ref, InputHTMLAttributes, ForwardRefExoticComponent, RefAttributes, HTMLAttributes } from 'react';
4
4
  export * from 'use-file-picker/types';
5
5
  export { useFilePicker, useImperativeFilePicker } from 'use-file-picker';
6
6
  export { FileAmountLimitValidator, FileSizeValidator, FileTypeValidator, ImageDimensionsValidator, PersistentFileAmountLimitValidator } from 'use-file-picker/validators';
@@ -104,6 +104,9 @@ declare const useLocalStorage: <T, _>(key: Parameters<SetItemType>[0], initialVa
104
104
 
105
105
  declare const useLockBodyScroll: (locked: boolean) => void;
106
106
 
107
+ type EventType = 'focusin' | 'focusout' | 'mousedown' | 'mouseup' | 'touchend' | 'touchstart';
108
+ declare const useOnClickOutside: (ref: RefObject<HTMLElement | null | undefined>, handler: (event: Event) => unknown, eventTypes?: EventType | EventType[]) => void;
109
+
107
110
  type MediaQueryBooleans = {
108
111
  isXlAndUp: boolean;
109
112
  isLgAndUp: boolean;
@@ -3028,4 +3031,4 @@ declare const WistiaLogo: {
3028
3031
  displayName: string;
3029
3032
  };
3030
3033
 
3031
- export { ActionButton, type ActionButtonProps, Avatar, type AvatarProps, type AvatarStatus, Badge, type BadgeProps, Box, type BoxProps, Breadcrumb, type BreadcrumbProps, Breadcrumbs, type BreadcrumbsProps, Button, ButtonGroup, type ButtonProps, Card, type CardProps, Center, type CenterProps, Checkbox, CheckboxGroup, CheckboxMenuItem, ClickRegion, type ClickRegionProps, Collapsible, CollapsibleContent, type CollapsibleProps, CollapsibleTrigger, type ColorSchemeTypes, ColorSchemeWrapper, type ColorSchemeWrapperProps, DataCard, type DataCardProps, DataCardTrend, type DataCardTrendProps, DataCards, type DataCardsProps, Divider, EditableHeading, type EditableHeadingProps, Ellipsis, Form, FormErrorSummary, FormField, type FormFieldProps, FormGroup, type FormGroupProps, type FormProps, Heading, type HeadingProps, Icon, IconButton, type IconButtonProps, type IconNameType, Image, type ImageProps, Input, type InputProps, Label, type LabelProps, Link, type LinkProps, Menu, MenuItem, MenuItemDescription, MenuItemLabel, MenuLabel, MenuRadioGroup, Modal, type ModalProps, Popover, type PopoverProps, ProgressBar, type ProgressBarProps, Radio, RadioGroup, RadioMenuItem, type RadioProps, ScreenReaderOnly, SegmentedControl, SegmentedControlItem, type SegmentedControlItemProps, type SegmentedControlProps, Select, SelectOption, SelectOptionGroup, type SelectOptionGroupProps, type SelectOptionProps, type SelectProps, Stack, SubMenu, Switch, type SwitchProps, Tab, type TabProps, Table, TableBody, type TableBodyProps, TableCell, type TableCellProps, TableFooter, type TableFooterProps, TableHead, type TableHeadProps, type TableProps, TableRow, type TableRowProps, Tabs, type TabsProps, Tag, type TagProps, Text, type TextProps, Tooltip, type TooltipProps, UIProvider, type UseToastProps, WistiaLogo, colorSchemeOptions, copyToClipboard, dateTime, ellipsisFlexParentStyle, ellipsisStyle, iconSizeMap, mergeRefs, mq, useActiveMq, useAriaLive, useBoolean, useFormState, useKey, useLocalStorage, useLockBodyScroll, useMq, useToast, useWindowSize };
3034
+ export { ActionButton, type ActionButtonProps, Avatar, type AvatarProps, type AvatarStatus, Badge, type BadgeProps, Box, type BoxProps, Breadcrumb, type BreadcrumbProps, Breadcrumbs, type BreadcrumbsProps, Button, ButtonGroup, type ButtonProps, Card, type CardProps, Center, type CenterProps, Checkbox, CheckboxGroup, CheckboxMenuItem, ClickRegion, type ClickRegionProps, Collapsible, CollapsibleContent, type CollapsibleProps, CollapsibleTrigger, type ColorSchemeTypes, ColorSchemeWrapper, type ColorSchemeWrapperProps, DataCard, type DataCardProps, DataCardTrend, type DataCardTrendProps, DataCards, type DataCardsProps, Divider, EditableHeading, type EditableHeadingProps, Ellipsis, Form, FormErrorSummary, FormField, type FormFieldProps, FormGroup, type FormGroupProps, type FormProps, Heading, type HeadingProps, Icon, IconButton, type IconButtonProps, type IconNameType, Image, type ImageProps, Input, type InputProps, Label, type LabelProps, Link, type LinkProps, Menu, MenuItem, MenuItemDescription, MenuItemLabel, MenuLabel, MenuRadioGroup, Modal, type ModalProps, Popover, type PopoverProps, ProgressBar, type ProgressBarProps, Radio, RadioGroup, RadioMenuItem, type RadioProps, ScreenReaderOnly, SegmentedControl, SegmentedControlItem, type SegmentedControlItemProps, type SegmentedControlProps, Select, SelectOption, SelectOptionGroup, type SelectOptionGroupProps, type SelectOptionProps, type SelectProps, Stack, SubMenu, Switch, type SwitchProps, Tab, type TabProps, Table, TableBody, type TableBodyProps, TableCell, type TableCellProps, TableFooter, type TableFooterProps, TableHead, type TableHeadProps, type TableProps, TableRow, type TableRowProps, Tabs, type TabsProps, Tag, type TagProps, Text, type TextProps, Tooltip, type TooltipProps, UIProvider, type UseToastProps, WistiaLogo, colorSchemeOptions, copyToClipboard, dateTime, ellipsisFlexParentStyle, ellipsisStyle, iconSizeMap, mergeRefs, mq, useActiveMq, useAriaLive, useBoolean, useFormState, useKey, useLocalStorage, useLockBodyScroll, useMq, useOnClickOutside, useToast, useWindowSize };
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*
3
- * @license @wistia/ui v0.6.37
3
+ * @license @wistia/ui v0.6.38
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -2086,6 +2086,35 @@ var useLockBodyScroll = (locked) => {
2086
2086
  }, [locked]);
2087
2087
  };
2088
2088
 
2089
+ // src/hooks/useOnClickOutside/useOnClickOutside.ts
2090
+ import { useEffect as useEffect3 } from "react";
2091
+ var useOnClickOutside = (ref, handler, eventTypes = ["mousedown", "touchend"]) => {
2092
+ useEffect3(() => {
2093
+ const listener = (event) => {
2094
+ if (!ref.current || ref.current.contains(event.target)) {
2095
+ return;
2096
+ }
2097
+ handler(event);
2098
+ };
2099
+ if (Array.isArray(eventTypes)) {
2100
+ eventTypes.forEach((eventType) => {
2101
+ document.addEventListener(eventType, listener);
2102
+ });
2103
+ } else {
2104
+ document.addEventListener(eventTypes, listener);
2105
+ }
2106
+ return () => {
2107
+ if (Array.isArray(eventTypes)) {
2108
+ eventTypes.forEach((eventType) => {
2109
+ document.removeEventListener(eventType, listener);
2110
+ });
2111
+ } else {
2112
+ document.removeEventListener(eventTypes, listener);
2113
+ }
2114
+ };
2115
+ }, [ref, handler, eventTypes]);
2116
+ };
2117
+
2089
2118
  // src/hooks/useMq/useMq.ts
2090
2119
  import { isBoolean } from "@wistia/type-guards";
2091
2120
 
@@ -6995,7 +7024,7 @@ var ActionButton = forwardRef3(
6995
7024
  ActionButton.displayName = "ActionButton";
6996
7025
 
6997
7026
  // src/components/Avatar/Avatar.tsx
6998
- import { useState as useState5, useMemo as useMemo3, useEffect as useEffect3 } from "react";
7027
+ import { useState as useState5, useMemo as useMemo3, useEffect as useEffect4 } from "react";
6999
7028
  import { isNil as isNil8 } from "@wistia/type-guards";
7000
7029
  import styled8 from "styled-components";
7001
7030
 
@@ -7128,7 +7157,7 @@ var Avatar = ({
7128
7157
  ...otherProps
7129
7158
  }) => {
7130
7159
  const [imageLoadState, setImageLoadState] = useState5("loading");
7131
- useEffect3(() => {
7160
+ useEffect4(() => {
7132
7161
  setImageLoadState("loading");
7133
7162
  }, [imageUrl]);
7134
7163
  const handleImageLoad = () => {
@@ -7927,9 +7956,9 @@ var Checkbox = forwardRef7(
7927
7956
  Checkbox.displayName = "Checkbox";
7928
7957
 
7929
7958
  // src/components/ClickRegion/ClickRegion.tsx
7930
- import { Children as Children3, cloneElement as cloneElement3, useCallback as useCallback5, useEffect as useEffect4 } from "react";
7959
+ import { Children as Children3, cloneElement as cloneElement3, useCallback as useCallback5, useEffect as useEffect5 } from "react";
7931
7960
  var ClickRegion = ({ children, targetRef }) => {
7932
- useEffect4(() => {
7961
+ useEffect5(() => {
7933
7962
  if (targetRef.current && targetRef.current.tagName === "A") {
7934
7963
  targetRef.current.setAttribute("data-click-region-target-link", "");
7935
7964
  } else if (targetRef.current && targetRef.current.tagName === "BUTTON") {
@@ -10180,14 +10209,14 @@ import styled45 from "styled-components";
10180
10209
  import { Content as DialogContent } from "@radix-ui/react-dialog";
10181
10210
 
10182
10211
  // src/private/hooks/useFocusRestore/useFocusRestore.ts
10183
- import { useRef as useRef8, useEffect as useEffect5 } from "react";
10212
+ import { useRef as useRef8, useEffect as useEffect6 } from "react";
10184
10213
  import { isNotNil as isNotNil18 } from "@wistia/type-guards";
10185
10214
  var useFocusRestore = () => {
10186
10215
  const previouslyFocusedRef = useRef8(null);
10187
- useEffect5(() => {
10216
+ useEffect6(() => {
10188
10217
  previouslyFocusedRef.current = document.activeElement;
10189
10218
  }, []);
10190
- useEffect5(() => {
10219
+ useEffect6(() => {
10191
10220
  return () => {
10192
10221
  if (isNotNil18(previouslyFocusedRef.current)) {
10193
10222
  setTimeout(() => {
@@ -10829,7 +10858,7 @@ var SegmentedControl = forwardRef20(
10829
10858
  SegmentedControl.displayName = "SegmentedControl";
10830
10859
 
10831
10860
  // src/components/SegmentedControl/SegmentedControlItem.tsx
10832
- import { forwardRef as forwardRef21, useEffect as useEffect6, useRef as useRef9 } from "react";
10861
+ import { forwardRef as forwardRef21, useEffect as useEffect7, useRef as useRef9 } from "react";
10833
10862
  import styled53, { css as css32 } from "styled-components";
10834
10863
  import { Item as ToggleGroupItem } from "@radix-ui/react-toggle-group";
10835
10864
  import { isNotNil as isNotNil22 } from "@wistia/type-guards";
@@ -10909,7 +10938,7 @@ var SegmentedControlItem = forwardRef21(
10909
10938
  event.preventDefault();
10910
10939
  }
10911
10940
  };
10912
- useEffect6(() => {
10941
+ useEffect7(() => {
10913
10942
  const buttonElem = buttonRef.current;
10914
10943
  if (!buttonElem) {
10915
10944
  return void 0;
@@ -11477,7 +11506,7 @@ var TabList = ({
11477
11506
  TabList.displayName = "TabList";
11478
11507
 
11479
11508
  // src/components/Tabs/TabItem.tsx
11480
- import { forwardRef as forwardRef25, useEffect as useEffect7, useRef as useRef10 } from "react";
11509
+ import { forwardRef as forwardRef25, useEffect as useEffect8, useRef as useRef10 } from "react";
11481
11510
  import styled66 from "styled-components";
11482
11511
  import { Trigger as RadixTab } from "@radix-ui/react-tabs";
11483
11512
  import { isNotNil as isNotNil23 } from "@wistia/type-guards";
@@ -11509,7 +11538,7 @@ var TabItem = forwardRef25(
11509
11538
  const { setSelectedItemMeasurements } = useSelectedItemMeasurements();
11510
11539
  const buttonRef = useRef10(null);
11511
11540
  const combinedRef = mergeRefs([buttonRef, forwardedRef]);
11512
- useEffect7(() => {
11541
+ useEffect8(() => {
11513
11542
  const buttonElem = buttonRef.current;
11514
11543
  if (!buttonElem) {
11515
11544
  return void 0;
@@ -12112,6 +12141,7 @@ export {
12112
12141
  useLocalStorage,
12113
12142
  useLockBodyScroll,
12114
12143
  useMq,
12144
+ useOnClickOutside,
12115
12145
  useToast,
12116
12146
  useWindowSize
12117
12147
  };