@wistia/ui 0.6.37 → 0.6.38-beta.6e33df45.29fe2a2

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;
@@ -2319,12 +2322,13 @@ type PopoverProps = ContentProps & PopoverControlProps & {
2319
2322
  * If true, the popover will use the unstyled Content component instead of StyledContent
2320
2323
  */
2321
2324
  unstyled?: boolean;
2325
+ colorScheme?: ColorSchemeTypes;
2322
2326
  };
2323
2327
  /**
2324
2328
  * Displays rich content in a portal, triggered by a button.
2325
2329
  */
2326
2330
  declare const Popover: {
2327
- ({ children, trigger, isOpen, hideCloseButton, onOpenChange, unstyled, ...props }: PopoverProps): JSX.Element;
2331
+ ({ children, trigger, isOpen, hideCloseButton, onOpenChange, unstyled, colorScheme, ...props }: PopoverProps): JSX.Element;
2328
2332
  displayName: string;
2329
2333
  };
2330
2334
 
@@ -3028,4 +3032,4 @@ declare const WistiaLogo: {
3028
3032
  displayName: string;
3029
3033
  };
3030
3034
 
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 };
3035
+ 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;
@@ -2319,12 +2322,13 @@ type PopoverProps = ContentProps & PopoverControlProps & {
2319
2322
  * If true, the popover will use the unstyled Content component instead of StyledContent
2320
2323
  */
2321
2324
  unstyled?: boolean;
2325
+ colorScheme?: ColorSchemeTypes;
2322
2326
  };
2323
2327
  /**
2324
2328
  * Displays rich content in a portal, triggered by a button.
2325
2329
  */
2326
2330
  declare const Popover: {
2327
- ({ children, trigger, isOpen, hideCloseButton, onOpenChange, unstyled, ...props }: PopoverProps): JSX.Element;
2331
+ ({ children, trigger, isOpen, hideCloseButton, onOpenChange, unstyled, colorScheme, ...props }: PopoverProps): JSX.Element;
2328
2332
  displayName: string;
2329
2333
  };
2330
2334
 
@@ -3028,4 +3032,4 @@ declare const WistiaLogo: {
3028
3032
  displayName: string;
3029
3033
  };
3030
3034
 
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 };
3035
+ 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-beta.6e33df45.29fe2a2
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(() => {
@@ -10391,6 +10420,7 @@ var getControlProps = (isOpen, onOpenChange) => {
10391
10420
  // src/components/Popover/Popover.tsx
10392
10421
  import { jsx as jsx244, jsxs as jsxs31 } from "react/jsx-runtime";
10393
10422
  var StyledContent2 = styled48(Content2)`
10423
+ ${({ $colorScheme }) => getColorScheme($colorScheme)};
10394
10424
  ${({ $unstyled }) => !$unstyled && css29`
10395
10425
  border-radius: var(--wui-border-radius-02);
10396
10426
  padding: var(--wui-space-04);
@@ -10413,6 +10443,7 @@ var Popover = ({
10413
10443
  hideCloseButton = false,
10414
10444
  onOpenChange,
10415
10445
  unstyled = false,
10446
+ colorScheme = "inherit",
10416
10447
  ...props
10417
10448
  }) => {
10418
10449
  return /* @__PURE__ */ jsxs31(Root2, { ...getControlProps(isOpen, onOpenChange), children: [
@@ -10420,6 +10451,7 @@ var Popover = ({
10420
10451
  /* @__PURE__ */ jsx244(Portal, { children: /* @__PURE__ */ jsxs31(
10421
10452
  StyledContent2,
10422
10453
  {
10454
+ $colorScheme: colorScheme,
10423
10455
  sideOffset: 8,
10424
10456
  ...props,
10425
10457
  $unstyled: unstyled,
@@ -10829,7 +10861,7 @@ var SegmentedControl = forwardRef20(
10829
10861
  SegmentedControl.displayName = "SegmentedControl";
10830
10862
 
10831
10863
  // src/components/SegmentedControl/SegmentedControlItem.tsx
10832
- import { forwardRef as forwardRef21, useEffect as useEffect6, useRef as useRef9 } from "react";
10864
+ import { forwardRef as forwardRef21, useEffect as useEffect7, useRef as useRef9 } from "react";
10833
10865
  import styled53, { css as css32 } from "styled-components";
10834
10866
  import { Item as ToggleGroupItem } from "@radix-ui/react-toggle-group";
10835
10867
  import { isNotNil as isNotNil22 } from "@wistia/type-guards";
@@ -10874,6 +10906,7 @@ var segmentedControlItemStyles = css32`
10874
10906
  &[data-state='active'] {
10875
10907
  color: var(--wui-color-text-selected);
10876
10908
  cursor: default;
10909
+ transition: none;
10877
10910
 
10878
10911
  svg path {
10879
10912
  fill: var(--wui-color-icon-selected);
@@ -10909,7 +10942,7 @@ var SegmentedControlItem = forwardRef21(
10909
10942
  event.preventDefault();
10910
10943
  }
10911
10944
  };
10912
- useEffect6(() => {
10945
+ useEffect7(() => {
10913
10946
  const buttonElem = buttonRef.current;
10914
10947
  if (!buttonElem) {
10915
10948
  return void 0;
@@ -11477,7 +11510,7 @@ var TabList = ({
11477
11510
  TabList.displayName = "TabList";
11478
11511
 
11479
11512
  // src/components/Tabs/TabItem.tsx
11480
- import { forwardRef as forwardRef25, useEffect as useEffect7, useRef as useRef10 } from "react";
11513
+ import { forwardRef as forwardRef25, useEffect as useEffect8, useRef as useRef10 } from "react";
11481
11514
  import styled66 from "styled-components";
11482
11515
  import { Trigger as RadixTab } from "@radix-ui/react-tabs";
11483
11516
  import { isNotNil as isNotNil23 } from "@wistia/type-guards";
@@ -11509,7 +11542,7 @@ var TabItem = forwardRef25(
11509
11542
  const { setSelectedItemMeasurements } = useSelectedItemMeasurements();
11510
11543
  const buttonRef = useRef10(null);
11511
11544
  const combinedRef = mergeRefs([buttonRef, forwardedRef]);
11512
- useEffect7(() => {
11545
+ useEffect8(() => {
11513
11546
  const buttonElem = buttonRef.current;
11514
11547
  if (!buttonElem) {
11515
11548
  return void 0;
@@ -12112,6 +12145,7 @@ export {
12112
12145
  useLocalStorage,
12113
12146
  useLockBodyScroll,
12114
12147
  useMq,
12148
+ useOnClickOutside,
12115
12149
  useToast,
12116
12150
  useWindowSize
12117
12151
  };