@wistia/ui 0.6.25 → 0.6.26

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
@@ -97,6 +97,9 @@ type UseKeyOptions = {
97
97
  };
98
98
  declare const useKey: (key: KeyFilter, eventHandler: EventHandler, { eventName, eventTarget, eventOptions }?: UseKeyOptions) => void;
99
99
 
100
+ type SetItemType = Storage['setItem'];
101
+ declare const useLocalStorage: <T, _>(key: Parameters<SetItemType>[0], initialValue: T, storage?: Storage) => [T | undefined, (newValue: T) => void, () => void];
102
+
100
103
  type MediaQueryBooleans = {
101
104
  isXlAndUp: boolean;
102
105
  isLgAndUp: boolean;
@@ -2925,4 +2928,4 @@ declare const WistiaLogo: {
2925
2928
  displayName: string;
2926
2929
  };
2927
2930
 
2928
- 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, 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, WistiaLogo, colorSchemeOptions, copyToClipboard, dateTime, ellipsisFlexParentStyle, ellipsisStyle, iconSizeMap, mq, useActiveMq, useAriaLive, useBoolean, useFormState, useKey, useMq, useToast, useWindowSize };
2931
+ 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, 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, WistiaLogo, colorSchemeOptions, copyToClipboard, dateTime, ellipsisFlexParentStyle, ellipsisStyle, iconSizeMap, mq, useActiveMq, useAriaLive, useBoolean, useFormState, useKey, useLocalStorage, useMq, useToast, useWindowSize };
package/dist/index.d.ts CHANGED
@@ -97,6 +97,9 @@ type UseKeyOptions = {
97
97
  };
98
98
  declare const useKey: (key: KeyFilter, eventHandler: EventHandler, { eventName, eventTarget, eventOptions }?: UseKeyOptions) => void;
99
99
 
100
+ type SetItemType = Storage['setItem'];
101
+ declare const useLocalStorage: <T, _>(key: Parameters<SetItemType>[0], initialValue: T, storage?: Storage) => [T | undefined, (newValue: T) => void, () => void];
102
+
100
103
  type MediaQueryBooleans = {
101
104
  isXlAndUp: boolean;
102
105
  isLgAndUp: boolean;
@@ -2925,4 +2928,4 @@ declare const WistiaLogo: {
2925
2928
  displayName: string;
2926
2929
  };
2927
2930
 
2928
- 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, 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, WistiaLogo, colorSchemeOptions, copyToClipboard, dateTime, ellipsisFlexParentStyle, ellipsisStyle, iconSizeMap, mq, useActiveMq, useAriaLive, useBoolean, useFormState, useKey, useMq, useToast, useWindowSize };
2931
+ 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, 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, WistiaLogo, colorSchemeOptions, copyToClipboard, dateTime, ellipsisFlexParentStyle, ellipsisStyle, iconSizeMap, mq, useActiveMq, useAriaLive, useBoolean, useFormState, useKey, useLocalStorage, useMq, useToast, useWindowSize };
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*
3
- * @license @wistia/ui v0.6.25
3
+ * @license @wistia/ui v0.6.26
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -2033,11 +2033,39 @@ var useKey = (key, eventHandler, { eventName = "keydown", eventTarget, eventOpti
2033
2033
  useEvent(eventName, memoizedEventHandler, eventTarget, eventOptions);
2034
2034
  };
2035
2035
 
2036
+ // src/hooks/useLocalStorage/useLocalStorage.ts
2037
+ import { useState as useState3 } from "react";
2038
+ var useLocalStorage = (key, initialValue, storage = window.localStorage) => {
2039
+ const [storedValue, setStoredValue] = useState3(() => {
2040
+ try {
2041
+ const item = storage.getItem(key);
2042
+ return item !== null && !!item ? JSON.parse(item) : initialValue;
2043
+ } catch (error) {
2044
+ console.log(error);
2045
+ return initialValue;
2046
+ }
2047
+ });
2048
+ const setValue = (value) => {
2049
+ try {
2050
+ const valueToStore = value instanceof Function ? value(storedValue) : value;
2051
+ setStoredValue(valueToStore);
2052
+ storage.setItem(key, JSON.stringify(valueToStore));
2053
+ } catch (error) {
2054
+ console.error(error);
2055
+ }
2056
+ };
2057
+ const removeValue = () => {
2058
+ storage.removeItem(key);
2059
+ setStoredValue(void 0);
2060
+ };
2061
+ return [storedValue, setValue, removeValue];
2062
+ };
2063
+
2036
2064
  // src/hooks/useMq/useMq.ts
2037
2065
  import { isBoolean } from "@wistia/type-guards";
2038
2066
 
2039
2067
  // src/hooks/useWindowSize/useWindowSize.ts
2040
- import { useState as useState3, useLayoutEffect } from "react";
2068
+ import { useState as useState4, useLayoutEffect } from "react";
2041
2069
  import { debounce } from "throttle-debounce";
2042
2070
 
2043
2071
  // src/private/helpers/isClient/isClient.ts
@@ -2045,7 +2073,7 @@ var isClient = () => typeof window !== "undefined" && typeof document !== "undef
2045
2073
 
2046
2074
  // src/hooks/useWindowSize/useWindowSize.ts
2047
2075
  var useWindowSize = (interval = 0) => {
2048
- const [dimensions, setDimensions] = useState3({
2076
+ const [dimensions, setDimensions] = useState4({
2049
2077
  width: isClient() ? window.innerWidth : 0,
2050
2078
  height: isClient() ? window.innerHeight : 0
2051
2079
  });
@@ -6827,7 +6855,7 @@ var ActionButton = forwardRef3(
6827
6855
  ActionButton.displayName = "ActionButton";
6828
6856
 
6829
6857
  // src/components/Avatar/Avatar.tsx
6830
- import { useState as useState4, useMemo as useMemo3, useEffect as useEffect3 } from "react";
6858
+ import { useState as useState5, useMemo as useMemo3, useEffect as useEffect3 } from "react";
6831
6859
  import { isNil as isNil8 } from "@wistia/type-guards";
6832
6860
  import styled8 from "styled-components";
6833
6861
 
@@ -6959,7 +6987,7 @@ var Avatar = ({
6959
6987
  onImageLoad,
6960
6988
  ...otherProps
6961
6989
  }) => {
6962
- const [imageLoadState, setImageLoadState] = useState4("loading");
6990
+ const [imageLoadState, setImageLoadState] = useState5("loading");
6963
6991
  useEffect3(() => {
6964
6992
  setImageLoadState("loading");
6965
6993
  }, [imageUrl]);
@@ -8317,7 +8345,7 @@ Divider.displayName = "Divider";
8317
8345
 
8318
8346
  // src/components/EditableHeading/EditableHeading.tsx
8319
8347
  import styled29, { css as css26 } from "styled-components";
8320
- import { useState as useState5, useRef as useRef4 } from "react";
8348
+ import { useState as useState6, useRef as useRef4 } from "react";
8321
8349
 
8322
8350
  // src/components/Tooltip/Tooltip.tsx
8323
8351
  import {
@@ -8643,10 +8671,10 @@ var EditableHeading = ({
8643
8671
  forceEditing = false,
8644
8672
  editingDisabled = false
8645
8673
  }) => {
8646
- const [isEditing, setIsEditing] = useState5(false);
8647
- const [value, setValue] = useState5(children);
8648
- const [previousValue, setPreviousValue] = useState5(children);
8649
- const [headingHeight, setHeadingHeight] = useState5("60");
8674
+ const [isEditing, setIsEditing] = useState6(false);
8675
+ const [value, setValue] = useState6(children);
8676
+ const [previousValue, setPreviousValue] = useState6(children);
8677
+ const [headingHeight, setHeadingHeight] = useState6("60");
8650
8678
  const headingRef = useRef4(null);
8651
8679
  const handleSetEditing = (editing) => {
8652
8680
  if (editingDisabled) return;
@@ -8733,7 +8761,7 @@ var EditableHeading = ({
8733
8761
  };
8734
8762
 
8735
8763
  // src/components/Form/Form.tsx
8736
- import { forwardRef as forwardRef11, useRef as useRef5, useMemo as useMemo4, createContext as createContext2, useState as useState6, useId as useId2 } from "react";
8764
+ import { forwardRef as forwardRef11, useRef as useRef5, useMemo as useMemo4, createContext as createContext2, useState as useState7, useId as useId2 } from "react";
8737
8765
  import styled31 from "styled-components";
8738
8766
  import { isNotUndefined as isNotUndefined6, isUndefined as isUndefined3 } from "@wistia/type-guards";
8739
8767
 
@@ -8793,8 +8821,8 @@ var FormComponent = ({
8793
8821
  fullWidth = false,
8794
8822
  ...props
8795
8823
  }, forwardedRef) => {
8796
- const [errors, setErrors] = useState6({});
8797
- const [hasSubmitted, setHasSubmitted] = useState6(false);
8824
+ const [errors, setErrors] = useState7({});
8825
+ const [hasSubmitted, setHasSubmitted] = useState7(false);
8798
8826
  const innerRef = useRef5();
8799
8827
  const ref = forwardedRef ?? innerRef;
8800
8828
  const autoId = useId2();
@@ -8871,11 +8899,11 @@ FormComponent.displayName = "Form";
8871
8899
  var Form = forwardRef11(FormComponent);
8872
8900
 
8873
8901
  // src/components/Form/useFormState.tsx
8874
- import { useCallback as useCallback6, useState as useState7 } from "react";
8902
+ import { useCallback as useCallback6, useState as useState8 } from "react";
8875
8903
  var useFormState = (action, initialData = {}) => {
8876
- const [data, setData] = useState7(initialData);
8877
- const [isPending, setIsPending] = useState7(false);
8878
- const [error, setError] = useState7(null);
8904
+ const [data, setData] = useState8(initialData);
8905
+ const [isPending, setIsPending] = useState8(false);
8906
+ const [error, setError] = useState8(null);
8879
8907
  const formAction = useCallback6(
8880
8908
  async (nextFormData) => {
8881
8909
  if (nextFormData === null) {
@@ -9495,7 +9523,7 @@ var MenuLabel = ({ children, ...props }) => {
9495
9523
  MenuLabel.displayName = "MenuLabel";
9496
9524
 
9497
9525
  // src/components/Menu/SubMenu.tsx
9498
- import { useState as useState8 } from "react";
9526
+ import { useState as useState9 } from "react";
9499
9527
  import styled41 from "styled-components";
9500
9528
  import {
9501
9529
  DropdownMenuPortal as DropdownMenuPortal2,
@@ -9681,7 +9709,7 @@ var SubMenu = ({
9681
9709
  ...props
9682
9710
  }) => {
9683
9711
  const { isSmAndUp } = useMq();
9684
- const [isExpanded, setIsExpanded] = useState8(false);
9712
+ const [isExpanded, setIsExpanded] = useState9(false);
9685
9713
  const { compact } = useMenuContext();
9686
9714
  return isSmAndUp ? /* @__PURE__ */ jsxs25(DropdownMenuSub, { onOpenChange, children: [
9687
9715
  /* @__PURE__ */ jsxs25(SubMenuTrigger, { ...props, children: [
@@ -10450,7 +10478,7 @@ import { Root as ToggleGroupRoot } from "@radix-ui/react-toggle-group";
10450
10478
  import { isNil as isNil14 } from "@wistia/type-guards";
10451
10479
 
10452
10480
  // src/components/SegmentedControl/useSelectedItemMeasurements.tsx
10453
- import { createContext as createContext6, useContext as useContext5, useMemo as useMemo8, useState as useState9 } from "react";
10481
+ import { createContext as createContext6, useContext as useContext5, useMemo as useMemo8, useState as useState10 } from "react";
10454
10482
  import { jsx as jsx242 } from "react/jsx-runtime";
10455
10483
  var SelectedItemMeasurementsContext = createContext6(
10456
10484
  null
@@ -10458,7 +10486,7 @@ var SelectedItemMeasurementsContext = createContext6(
10458
10486
  var SelectedItemMeasurementsProvider = ({
10459
10487
  children
10460
10488
  }) => {
10461
- const [selectedItemMeasurements, setSelectedItemMeasurements] = useState9(null);
10489
+ const [selectedItemMeasurements, setSelectedItemMeasurements] = useState10(null);
10462
10490
  const contextValue = useMemo8(
10463
10491
  () => ({
10464
10492
  setSelectedItemMeasurements,
@@ -11193,7 +11221,7 @@ var TableRow = ({ children, ...props }) => {
11193
11221
  };
11194
11222
 
11195
11223
  // src/components/Tabs/Tabs.tsx
11196
- import { forwardRef as forwardRef25, useState as useState10 } from "react";
11224
+ import { forwardRef as forwardRef25, useState as useState11 } from "react";
11197
11225
  import { Root as TabsRoot } from "@radix-ui/react-tabs";
11198
11226
  import { isNotNil as isNotNil24, isNil as isNil15 } from "@wistia/type-guards";
11199
11227
  import styled67 from "styled-components";
@@ -11410,7 +11438,7 @@ var Tabs = forwardRef25(
11410
11438
  ...otherProps
11411
11439
  }, ref) => {
11412
11440
  const tabItems = extractTabItems(children);
11413
- const [internalSelectedValue, setInternalSelectedValue] = useState10(defaultSelectedValue);
11441
+ const [internalSelectedValue, setInternalSelectedValue] = useState11(defaultSelectedValue);
11414
11442
  const modeProps = defaultSelectedValue !== void 0 ? {
11415
11443
  defaultValue: defaultSelectedValue,
11416
11444
  onValueChange: setInternalSelectedValue
@@ -11878,6 +11906,7 @@ export {
11878
11906
  useFormState,
11879
11907
  useImperativeFilePicker,
11880
11908
  useKey,
11909
+ useLocalStorage,
11881
11910
  useMq,
11882
11911
  useToast,
11883
11912
  useWindowSize