@wistia/ui 0.4.2-beta.b0f2a31f.4eb4d62 → 0.4.2
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.cjs +94 -106
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +2 -11
- package/dist/index.d.ts +2 -11
- package/dist/index.mjs +17 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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 { ReactNode,
|
|
3
|
+
import { ReactNode, ComponentPropsWithoutRef, JSX, ComponentPropsWithRef, MouseEvent, ChangeEvent, ForwardedRef, Ref, JSXElementConstructor, ElementType as ElementType$1, InputHTMLAttributes, RefObject } from 'react';
|
|
4
4
|
import { LinkProps as LinkProps$1 } from 'react-router-dom';
|
|
5
5
|
import * as styled_components from 'styled-components';
|
|
6
6
|
import { DropdownMenuContentProps, DropdownMenuItemProps, DropdownMenuRadioGroupProps, DropdownMenuRadioItemProps, DropdownMenuCheckboxItemProps } from '@radix-ui/react-dropdown-menu';
|
|
@@ -31,15 +31,6 @@ declare const mq: {
|
|
|
31
31
|
xlAndDown: () => string;
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
type UseBooleanReturn = [
|
|
35
|
-
boolean,
|
|
36
|
-
() => void,
|
|
37
|
-
() => void,
|
|
38
|
-
() => void,
|
|
39
|
-
Dispatch<SetStateAction<boolean>>
|
|
40
|
-
];
|
|
41
|
-
declare const useBoolean: (initialValue?: boolean) => UseBooleanReturn;
|
|
42
|
-
|
|
43
34
|
type MediaQueryBooleans = {
|
|
44
35
|
isXlAndUp: boolean;
|
|
45
36
|
isLgAndUp: boolean;
|
|
@@ -2148,4 +2139,4 @@ type BreadcrumbProps = {
|
|
|
2148
2139
|
};
|
|
2149
2140
|
declare const Breadcrumb: ({ icon, href, children }: BreadcrumbProps) => react_jsx_runtime.JSX.Element;
|
|
2150
2141
|
|
|
2151
|
-
export { ActionButton, type ActionButtonProps, Avatar, type AvatarInstanceType, type AvatarProps, Badge, type BadgeProps, Box, type BoxProps, Breadcrumb, Breadcrumbs, type BreadcrumbsProps, Button, ButtonGroup, type ButtonProps, Card, type CardProps, 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, Input, type InputProps, Label, type LabelProps, Link, type LinkProps, Menu, MenuItem, MenuItemDescription, MenuItemLabel, MenuLabel, MenuRadioGroup, Modal, type ModalProps, 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,
|
|
2142
|
+
export { ActionButton, type ActionButtonProps, Avatar, type AvatarInstanceType, type AvatarProps, Badge, type BadgeProps, Box, type BoxProps, Breadcrumb, Breadcrumbs, type BreadcrumbsProps, Button, ButtonGroup, type ButtonProps, Card, type CardProps, 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, Input, type InputProps, Label, type LabelProps, Link, type LinkProps, Menu, MenuItem, MenuItemDescription, MenuItemLabel, MenuLabel, MenuRadioGroup, Modal, type ModalProps, 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 };
|
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 { ReactNode,
|
|
3
|
+
import { ReactNode, ComponentPropsWithoutRef, JSX, ComponentPropsWithRef, MouseEvent, ChangeEvent, ForwardedRef, Ref, JSXElementConstructor, ElementType as ElementType$1, InputHTMLAttributes, RefObject } from 'react';
|
|
4
4
|
import { LinkProps as LinkProps$1 } from 'react-router-dom';
|
|
5
5
|
import * as styled_components from 'styled-components';
|
|
6
6
|
import { DropdownMenuContentProps, DropdownMenuItemProps, DropdownMenuRadioGroupProps, DropdownMenuRadioItemProps, DropdownMenuCheckboxItemProps } from '@radix-ui/react-dropdown-menu';
|
|
@@ -31,15 +31,6 @@ declare const mq: {
|
|
|
31
31
|
xlAndDown: () => string;
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
type UseBooleanReturn = [
|
|
35
|
-
boolean,
|
|
36
|
-
() => void,
|
|
37
|
-
() => void,
|
|
38
|
-
() => void,
|
|
39
|
-
Dispatch<SetStateAction<boolean>>
|
|
40
|
-
];
|
|
41
|
-
declare const useBoolean: (initialValue?: boolean) => UseBooleanReturn;
|
|
42
|
-
|
|
43
34
|
type MediaQueryBooleans = {
|
|
44
35
|
isXlAndUp: boolean;
|
|
45
36
|
isLgAndUp: boolean;
|
|
@@ -2148,4 +2139,4 @@ type BreadcrumbProps = {
|
|
|
2148
2139
|
};
|
|
2149
2140
|
declare const Breadcrumb: ({ icon, href, children }: BreadcrumbProps) => react_jsx_runtime.JSX.Element;
|
|
2150
2141
|
|
|
2151
|
-
export { ActionButton, type ActionButtonProps, Avatar, type AvatarInstanceType, type AvatarProps, Badge, type BadgeProps, Box, type BoxProps, Breadcrumb, Breadcrumbs, type BreadcrumbsProps, Button, ButtonGroup, type ButtonProps, Card, type CardProps, 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, Input, type InputProps, Label, type LabelProps, Link, type LinkProps, Menu, MenuItem, MenuItemDescription, MenuItemLabel, MenuLabel, MenuRadioGroup, Modal, type ModalProps, 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,
|
|
2142
|
+
export { ActionButton, type ActionButtonProps, Avatar, type AvatarInstanceType, type AvatarProps, Badge, type BadgeProps, Box, type BoxProps, Breadcrumb, Breadcrumbs, type BreadcrumbsProps, Button, ButtonGroup, type ButtonProps, Card, type CardProps, 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, Input, type InputProps, Label, type LabelProps, Link, type LinkProps, Menu, MenuItem, MenuItemDescription, MenuItemLabel, MenuLabel, MenuRadioGroup, Modal, type ModalProps, 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 };
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v0.4.2
|
|
3
|
+
* @license @wistia/ui v0.4.2
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -1467,21 +1467,11 @@ var mq = {
|
|
|
1467
1467
|
xlAndDown
|
|
1468
1468
|
};
|
|
1469
1469
|
|
|
1470
|
-
// src/hooks/useBoolean/useBoolean.ts
|
|
1471
|
-
import { useState as useState2, useCallback as useCallback2 } from "react";
|
|
1472
|
-
var useBoolean = (initialValue = false) => {
|
|
1473
|
-
const [value, setValue] = useState2(initialValue);
|
|
1474
|
-
const toggle = useCallback2(() => setValue((val) => !val), []);
|
|
1475
|
-
const setTrue = useCallback2(() => setValue(true), []);
|
|
1476
|
-
const setFalse = useCallback2(() => setValue(false), []);
|
|
1477
|
-
return [value, toggle, setTrue, setFalse, setValue];
|
|
1478
|
-
};
|
|
1479
|
-
|
|
1480
1470
|
// src/hooks/useMq/useMq.ts
|
|
1481
1471
|
import { isBoolean } from "@wistia/type-guards";
|
|
1482
1472
|
|
|
1483
1473
|
// src/hooks/useWindowSize/useWindowSize.ts
|
|
1484
|
-
import { useState as
|
|
1474
|
+
import { useState as useState2, useLayoutEffect } from "react";
|
|
1485
1475
|
import { debounce } from "throttle-debounce";
|
|
1486
1476
|
|
|
1487
1477
|
// src/private/helpers/isClient/isClient.ts
|
|
@@ -1489,7 +1479,7 @@ var isClient = () => typeof window !== "undefined" && typeof document !== "undef
|
|
|
1489
1479
|
|
|
1490
1480
|
// src/hooks/useWindowSize/useWindowSize.ts
|
|
1491
1481
|
var useWindowSize = (interval = 0) => {
|
|
1492
|
-
const [dimensions, setDimensions] =
|
|
1482
|
+
const [dimensions, setDimensions] = useState2({
|
|
1493
1483
|
width: isClient() ? window.innerWidth : 0,
|
|
1494
1484
|
height: isClient() ? window.innerHeight : 0
|
|
1495
1485
|
});
|
|
@@ -1545,7 +1535,7 @@ var useActiveMq = () => {
|
|
|
1545
1535
|
};
|
|
1546
1536
|
|
|
1547
1537
|
// src/hooks/useToast/useToast.tsx
|
|
1548
|
-
import { useCallback as
|
|
1538
|
+
import { useCallback as useCallback2 } from "react";
|
|
1549
1539
|
import { toast as sonnerToast } from "sonner";
|
|
1550
1540
|
|
|
1551
1541
|
// src/private/components/Toast/Toast.tsx
|
|
@@ -1807,7 +1797,7 @@ Toast.displayName = "Toast";
|
|
|
1807
1797
|
// src/hooks/useToast/useToast.tsx
|
|
1808
1798
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1809
1799
|
var useToast = () => {
|
|
1810
|
-
return
|
|
1800
|
+
return useCallback2(
|
|
1811
1801
|
({ message, action, colorScheme, icon, position = "bottom-left", duration = 3e3 }) => {
|
|
1812
1802
|
sonnerToast.custom(
|
|
1813
1803
|
() => {
|
|
@@ -5665,7 +5655,7 @@ var ActionButton = forwardRef3(
|
|
|
5665
5655
|
ActionButton.displayName = "ActionButton";
|
|
5666
5656
|
|
|
5667
5657
|
// src/components/Avatar/Avatar.tsx
|
|
5668
|
-
import { useState as
|
|
5658
|
+
import { useState as useState3, useMemo as useMemo3 } from "react";
|
|
5669
5659
|
import { isNil as isNil6 } from "@wistia/type-guards";
|
|
5670
5660
|
import styled8 from "styled-components";
|
|
5671
5661
|
|
|
@@ -5796,7 +5786,7 @@ var Avatar = ({
|
|
|
5796
5786
|
onImageLoad,
|
|
5797
5787
|
...otherProps
|
|
5798
5788
|
}) => {
|
|
5799
|
-
const [imageLoadState, setImageLoadState] =
|
|
5789
|
+
const [imageLoadState, setImageLoadState] = useState3(null);
|
|
5800
5790
|
const handleImageLoad = () => {
|
|
5801
5791
|
setImageLoadState("loaded");
|
|
5802
5792
|
onImageLoad?.("image");
|
|
@@ -6505,7 +6495,7 @@ var Divider = ({
|
|
|
6505
6495
|
Divider.displayName = "Divider";
|
|
6506
6496
|
|
|
6507
6497
|
// src/components/Form/Form.tsx
|
|
6508
|
-
import { forwardRef as forwardRef8, useRef as useRef2, useMemo as useMemo4, createContext as createContext2, useState as
|
|
6498
|
+
import { forwardRef as forwardRef8, useRef as useRef2, useMemo as useMemo4, createContext as createContext2, useState as useState4, useId as useId2 } from "react";
|
|
6509
6499
|
import styled19 from "styled-components";
|
|
6510
6500
|
import { isNotUndefined as isNotUndefined4, isUndefined as isUndefined3 } from "@wistia/type-guards";
|
|
6511
6501
|
|
|
@@ -6553,8 +6543,8 @@ var FormContext = createContext2({
|
|
|
6553
6543
|
formId: ""
|
|
6554
6544
|
});
|
|
6555
6545
|
var FormComponent = ({ children, action, values = {}, validate, fullWidth = false, ...props }, forwardedRef) => {
|
|
6556
|
-
const [errors, setErrors] =
|
|
6557
|
-
const [hasSubmitted, setHasSubmitted] =
|
|
6546
|
+
const [errors, setErrors] = useState4({});
|
|
6547
|
+
const [hasSubmitted, setHasSubmitted] = useState4(false);
|
|
6558
6548
|
const innerRef = useRef2();
|
|
6559
6549
|
const ref = forwardedRef ?? innerRef;
|
|
6560
6550
|
const autoId = useId2();
|
|
@@ -6630,12 +6620,12 @@ FormComponent.displayName = "Form";
|
|
|
6630
6620
|
var Form = forwardRef8(FormComponent);
|
|
6631
6621
|
|
|
6632
6622
|
// src/components/Form/useFormState.tsx
|
|
6633
|
-
import { useCallback as
|
|
6623
|
+
import { useCallback as useCallback3, useState as useState5 } from "react";
|
|
6634
6624
|
var useFormState = (action, initialData = {}) => {
|
|
6635
|
-
const [data, setData] =
|
|
6636
|
-
const [isPending, setIsPending] =
|
|
6637
|
-
const [error, setError] =
|
|
6638
|
-
const formAction =
|
|
6625
|
+
const [data, setData] = useState5(initialData);
|
|
6626
|
+
const [isPending, setIsPending] = useState5(false);
|
|
6627
|
+
const [error, setError] = useState5(null);
|
|
6628
|
+
const formAction = useCallback3(
|
|
6639
6629
|
async (nextFormData) => {
|
|
6640
6630
|
if (nextFormData === null) {
|
|
6641
6631
|
setData(initialData);
|
|
@@ -7444,7 +7434,7 @@ var MenuLabel = ({ children, ...props }) => {
|
|
|
7444
7434
|
MenuLabel.displayName = "MenuLabel";
|
|
7445
7435
|
|
|
7446
7436
|
// src/components/Menu/SubMenu.tsx
|
|
7447
|
-
import { useState as
|
|
7437
|
+
import { useState as useState6 } from "react";
|
|
7448
7438
|
import styled29 from "styled-components";
|
|
7449
7439
|
import {
|
|
7450
7440
|
DropdownMenuPortal as DropdownMenuPortal2,
|
|
@@ -7625,7 +7615,7 @@ var SubMenu = ({
|
|
|
7625
7615
|
...props
|
|
7626
7616
|
}) => {
|
|
7627
7617
|
const { isSmAndUp } = useMq();
|
|
7628
|
-
const [isExpanded, setIsExpanded] =
|
|
7618
|
+
const [isExpanded, setIsExpanded] = useState6(false);
|
|
7629
7619
|
return isSmAndUp ? /* @__PURE__ */ jsxs15(DropdownMenuSub, { onOpenChange, children: [
|
|
7630
7620
|
/* @__PURE__ */ jsxs15(SubMenuTrigger, { ...props, children: [
|
|
7631
7621
|
/* @__PURE__ */ jsx189(MenuItemLabel, { children: label }),
|
|
@@ -8682,7 +8672,6 @@ export {
|
|
|
8682
8672
|
mq,
|
|
8683
8673
|
useActiveMq,
|
|
8684
8674
|
useAriaLive,
|
|
8685
|
-
useBoolean,
|
|
8686
8675
|
useFormState,
|
|
8687
8676
|
useMq,
|
|
8688
8677
|
useToast,
|