@wistia/ui 0.4.10-beta.ec177e4f.e232e9c → 0.4.10

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 { ReactNode, Dispatch, SetStateAction, ComponentPropsWithoutRef, JSX, ComponentPropsWithRef, MouseEvent, ChangeEvent, ForwardedRef, Ref, ElementType, InputHTMLAttributes, RefObject, ForwardRefExoticComponent, RefAttributes } from 'react';
3
+ import { ReactNode, Dispatch, SetStateAction, ComponentPropsWithoutRef, JSX, ComponentPropsWithRef, MouseEvent, ChangeEvent, ForwardedRef, Ref, JSXElementConstructor, ElementType as ElementType$1, InputHTMLAttributes, RefObject, ForwardRefExoticComponent, RefAttributes } 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';
@@ -528,95 +528,10 @@ type BoxProps = ComponentPropsWithoutRef<'div'> & {
528
528
  /**
529
529
  * Box is a layout container using [CSS Flexbox](https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Flexbox).
530
530
  */
531
- declare const Box: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
532
- /**
533
- * Specifies how the browser distributes space between and around
534
- * items along the cross-axis of their container; has no effect on
535
- * single line flexible boxes
536
- */
537
- alignContent?: AlignContentType;
538
- /**
539
- * Specifies how the browser distributes space between and around
540
- * items along the cross-axis of their container; the difference
541
- * to the alignContent prop is that alignItems specifies the
542
- * alignment of the items within the current container's line,
543
- * whereas alignContent specifies the alignment of the lines themselves
544
- */
545
- alignItems?: AlignItemsType;
546
- /**
547
- * Specifies how the browser aligns items of the current line, overriding the
548
- * alignItems value of parent; if any of the item's cross-axis margin is set to auto,
549
- * then alignSelf is ignored
550
- *
551
- * *Note: only works for nested `<Box />`*
552
- */
553
- alignSelf?: AlignSelfType;
554
- /**
555
- * Specifies the initial main size of an item
556
- *
557
- * *Note: only works for nested `<Box />`*
558
- */
559
- basis?: string;
560
- /**
561
- * Pass an arbitrary child node
562
- */
563
- children?: ReactNode;
564
- /**
565
- * Specifies the main axis of the container
566
- */
567
- direction?: DirectionType;
568
- /**
569
- * Specifies whether the width and/or height should fill the container
570
- */
571
- fill?: FillType;
572
- /**
573
- * Specifies whether the width and/or height should fill the viewport
574
- */
575
- fillViewport?: FillType;
576
- /**
577
- * Specifies the gaps (gutters) between rows and columns
578
- */
579
- gap?: Gap | Spacings;
580
- /**
581
- * Specifies what amount of space inside the flex container the item should take up
582
- *
583
- * *Note: only works for nested `<Box />`*
584
- */
585
- grow?: number | string;
586
- /**
587
- * @ignore
588
- * Used internally to track if a Box is a child of another Box component
589
- */
590
- hasBoxParent?: boolean;
591
- /**
592
- * Make Layout behave like an inline element but still lay out its content according to flexbox model
593
- */
594
- inline?: boolean;
595
- /**
596
- * Specifies how the browser distributes space between and around
597
- * items along the main axis of their container
598
- */
599
- justifyContent?: JustifyContentType;
600
- /**
601
- * Specifies the order used to lay out an item in its container. Items within the same
602
- * container are rendered in ascending order according to their order values.
603
- * Elements with the _same_ order value are rendered in the order in which they appear in code
604
- *
605
- * *Note: only works for nested `<Box />`*
606
- */
607
- order?: number | "inherit" | "initial" | "unset";
608
- /**
609
- * Specifies how items will shrink inside the container when the default size of
610
- * items is larger than their container
611
- *
612
- * *Note: only works for nested `<Box />`*
613
- */
614
- shrink?: number;
615
- /**
616
- * Specifies whether items are forced into a single line or can be wrapped onto multiple lines
617
- */
618
- wrapItems?: boolean;
619
- } & react.RefAttributes<HTMLDivElement>>;
531
+ declare const Box: {
532
+ ({ alignContent, alignItems, alignSelf, basis, children, direction, fill, fillViewport, gap, grow, hasBoxParent, inline, justifyContent, order, shrink, wrapItems, ...otherProps }: BoxProps): JSX.Element;
533
+ displayName: string;
534
+ };
620
535
 
621
536
  type BreadcrumbsProps = ComponentPropsWithoutRef<'div'> & {
622
537
  /**
@@ -978,18 +893,24 @@ declare const CheckboxGroup: {
978
893
  displayName: string;
979
894
  };
980
895
 
981
- type UnknownRecord = Record<string, unknown>;
982
- type PropsOf<Component extends ElementType> = ComponentPropsWithoutRef<Component>;
983
- type ExtendedProps<Props = UnknownRecord, OverrideProps = UnknownRecord> = Omit<Props, keyof OverrideProps> & OverrideProps;
984
- type ComponentProp<Component extends ElementType> = {
985
- renderAs?: Component;
896
+ type ExtendedProps<Props = Record<string, unknown>, OverrideProps = Record<string, unknown>> = Omit<Props, keyof OverrideProps> & OverrideProps;
897
+ type ElementType = JSXElementConstructor<any> | keyof JSX.IntrinsicElements;
898
+ type PropsOf<C extends ElementType> = JSX.LibraryManagedAttributes<C, ComponentPropsWithoutRef<C>>;
899
+ type ComponentProp<C> = {
900
+ /**
901
+ * Render a different element or component
902
+ *
903
+ * @type ElementType | ComponentType
904
+ * @default 'div'
905
+ */
906
+ renderAs?: C;
986
907
  };
987
- /**
988
- * extend the polymorphic component props to always include children
989
- */
990
- type PolymorphicComponentProps<Component extends ElementType, Props = UnknownRecord> = ExtendedProps<PropsOf<Component>, ComponentProp<Component> & Props> & {
991
- children?: ReactNode;
992
- ref?: ComponentPropsWithRef<Component>['ref'];
908
+ type InheritedProps<C extends ElementType, Props = Record<string, unknown>> = ExtendedProps<PropsOf<C>, Props>;
909
+ type PolymorphicRef<C> = C extends ElementType ? ComponentPropsWithRef<C>['ref'] : never;
910
+ type PolymorphicComponentProps<C, Props = Record<string, unknown>> = C extends ElementType ? InheritedProps<C, ComponentProp<C> & Props> & {
911
+ ref?: PolymorphicRef<C>;
912
+ } : Props & {
913
+ renderAs: ElementType;
993
914
  };
994
915
 
995
916
  type AlignmentTypes$1 = 'center' | 'justify' | 'left' | 'right';
@@ -1036,7 +957,7 @@ type HeadingProps = ComponentPropsWithoutRef<typeof DEFAULT_ELEMENT> & {
1036
957
  * Prevents text from being highlighted and copied
1037
958
  */
1038
959
  preventUserSelect?: boolean;
1039
- renderAs?: ElementType;
960
+ renderAs?: ElementType$1;
1040
961
  /**
1041
962
  * The text style to display. This will also affect what element (h1, h2, etc) is rendered, unless the `renderAs` prop is used
1042
963
  */
@@ -1045,9 +966,89 @@ type HeadingProps = ComponentPropsWithoutRef<typeof DEFAULT_ELEMENT> & {
1045
966
  /**
1046
967
  * Displaying heading text, both visually and semantically
1047
968
  */
1048
- declare const Heading: (<C extends ElementType = "h1">(props: PolymorphicComponentProps<C, HeadingProps>) => react.ReactElement | null) & {
1049
- [x: string]: unknown;
1050
- };
969
+ declare const Heading: (<C = "h1">(props: PolymorphicComponentProps<C, HeadingProps>) => react.ReactElement) & Omit<react.FunctionComponent<(Omit<Omit<any, "ref">, "key" | "disabled" | keyof react.HTMLAttributes<HTMLHeadingElement> | "align" | "ellipsis" | "inline" | "colorScheme" | "variant" | "renderAs" | "preventUserSelect"> & {
970
+ renderAs?: any;
971
+ } & Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref"> & {
972
+ /**
973
+ * The horizontal alignment
974
+ * <br />
975
+ * _Note: this only affects block elements_
976
+ */
977
+ align?: AlignmentTypes$1;
978
+ /**
979
+ * The content of the heading
980
+ */
981
+ children: ReactNode;
982
+ /**
983
+ * Sets the [color scheme](../?path=/docs/docs-color-schemes--docs)
984
+ */
985
+ colorScheme?: ColorSchemeTypes;
986
+ /**
987
+ * Styles to text as disabled
988
+ */
989
+ disabled?: boolean;
990
+ /**
991
+ * Attempt to keep the text to a single line by truncating with an ellipsis
992
+ * <br />
993
+ * _Note: this only affects block elements_
994
+ */
995
+ ellipsis?: boolean;
996
+ /**
997
+ * Display the text as inline content
998
+ */
999
+ inline?: boolean;
1000
+ /**
1001
+ * Prevents text from being highlighted and copied
1002
+ */
1003
+ preventUserSelect?: boolean;
1004
+ renderAs?: ElementType$1;
1005
+ /**
1006
+ * The text style to display. This will also affect what element (h1, h2, etc) is rendered, unless the `renderAs` prop is used
1007
+ */
1008
+ variant?: keyof typeof variantStyleMap$1;
1009
+ } & {
1010
+ ref?: any;
1011
+ }) | (Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref"> & {
1012
+ /**
1013
+ * The horizontal alignment
1014
+ * <br />
1015
+ * _Note: this only affects block elements_
1016
+ */
1017
+ align?: AlignmentTypes$1;
1018
+ /**
1019
+ * The content of the heading
1020
+ */
1021
+ children: ReactNode;
1022
+ /**
1023
+ * Sets the [color scheme](../?path=/docs/docs-color-schemes--docs)
1024
+ */
1025
+ colorScheme?: ColorSchemeTypes;
1026
+ /**
1027
+ * Styles to text as disabled
1028
+ */
1029
+ disabled?: boolean;
1030
+ /**
1031
+ * Attempt to keep the text to a single line by truncating with an ellipsis
1032
+ * <br />
1033
+ * _Note: this only affects block elements_
1034
+ */
1035
+ ellipsis?: boolean;
1036
+ /**
1037
+ * Display the text as inline content
1038
+ */
1039
+ inline?: boolean;
1040
+ /**
1041
+ * Prevents text from being highlighted and copied
1042
+ */
1043
+ preventUserSelect?: boolean;
1044
+ renderAs?: ElementType$1;
1045
+ /**
1046
+ * The text style to display. This will also affect what element (h1, h2, etc) is rendered, unless the `renderAs` prop is used
1047
+ */
1048
+ variant?: keyof typeof variantStyleMap$1;
1049
+ } & {
1050
+ renderAs: keyof react.JSX.IntrinsicElements | react.JSXElementConstructor<any>;
1051
+ })>, never> & Record<string, never>;
1051
1052
 
1052
1053
  declare const iconMap: {
1053
1054
  'ab-test': (props: react.SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
@@ -1632,7 +1633,7 @@ type TextProps = ComponentPropsWithoutRef<'div'> & {
1632
1633
  /**
1633
1634
  * This will inherit the jsdoc block from PolymorphicComponent
1634
1635
  */
1635
- renderAs?: ElementType;
1636
+ renderAs?: ElementType$1;
1636
1637
  /**
1637
1638
  * The text style to display
1638
1639
  */
@@ -1641,9 +1642,103 @@ type TextProps = ComponentPropsWithoutRef<'div'> & {
1641
1642
  /**
1642
1643
  * Used for rending paragraphs and inline text.
1643
1644
  */
1644
- declare const Text: (<C extends ElementType = "div">(props: PolymorphicComponentProps<C, TextProps>) => react.ReactElement | null) & {
1645
- [x: string]: unknown;
1646
- };
1645
+ declare const Text: (<C = "div">(props: PolymorphicComponentProps<C, TextProps>) => react.ReactElement) & Omit<react.FunctionComponent<(Omit<Omit<any, "ref">, "key" | "disabled" | keyof react.HTMLAttributes<HTMLDivElement> | "align" | "ellipsis" | "inline" | "colorScheme" | "variant" | "prominence" | "renderAs" | "preventUserSelect"> & {
1646
+ renderAs?: any;
1647
+ } & Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
1648
+ /**
1649
+ * The horizontal alignment
1650
+ * <br />
1651
+ * _Note: this only affects block elements_
1652
+ */
1653
+ align?: AlignmentTypes;
1654
+ /**
1655
+ * The text content
1656
+ */
1657
+ children?: ReactNode | undefined;
1658
+ /**
1659
+ * Sets the [color scheme](../?path=/docs/docs-color-schemes--docs)
1660
+ */
1661
+ colorScheme?: ColorSchemeTypes;
1662
+ /**
1663
+ * Allows user to override default button colors
1664
+ */
1665
+ disabled?: boolean;
1666
+ /**
1667
+ * Attempt to keep the text to a single line by truncating with an ellipsis
1668
+ * <br />
1669
+ * _Note: this only affects block elements_
1670
+ */
1671
+ ellipsis?: boolean;
1672
+ /**
1673
+ * Display the text as inline content
1674
+ */
1675
+ inline?: boolean;
1676
+ /**
1677
+ * Prevents text from being highlighted and copied
1678
+ */
1679
+ preventUserSelect?: boolean;
1680
+ /**
1681
+ * Text prominence affects color. Use 'primary' for main non-interactive text, 'secondary' for supporting text, and 'button' in specific cases where text is used in an interactive component.
1682
+ */
1683
+ prominence?: "button" | "primary" | "secondary";
1684
+ /**
1685
+ * This will inherit the jsdoc block from PolymorphicComponent
1686
+ */
1687
+ renderAs?: ElementType$1;
1688
+ /**
1689
+ * The text style to display
1690
+ */
1691
+ variant?: keyof typeof variantStyleMap | undefined;
1692
+ } & {
1693
+ ref?: any;
1694
+ }) | (Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
1695
+ /**
1696
+ * The horizontal alignment
1697
+ * <br />
1698
+ * _Note: this only affects block elements_
1699
+ */
1700
+ align?: AlignmentTypes;
1701
+ /**
1702
+ * The text content
1703
+ */
1704
+ children?: ReactNode | undefined;
1705
+ /**
1706
+ * Sets the [color scheme](../?path=/docs/docs-color-schemes--docs)
1707
+ */
1708
+ colorScheme?: ColorSchemeTypes;
1709
+ /**
1710
+ * Allows user to override default button colors
1711
+ */
1712
+ disabled?: boolean;
1713
+ /**
1714
+ * Attempt to keep the text to a single line by truncating with an ellipsis
1715
+ * <br />
1716
+ * _Note: this only affects block elements_
1717
+ */
1718
+ ellipsis?: boolean;
1719
+ /**
1720
+ * Display the text as inline content
1721
+ */
1722
+ inline?: boolean;
1723
+ /**
1724
+ * Prevents text from being highlighted and copied
1725
+ */
1726
+ preventUserSelect?: boolean;
1727
+ /**
1728
+ * Text prominence affects color. Use 'primary' for main non-interactive text, 'secondary' for supporting text, and 'button' in specific cases where text is used in an interactive component.
1729
+ */
1730
+ prominence?: "button" | "primary" | "secondary";
1731
+ /**
1732
+ * This will inherit the jsdoc block from PolymorphicComponent
1733
+ */
1734
+ renderAs?: ElementType$1;
1735
+ /**
1736
+ * The text style to display
1737
+ */
1738
+ variant?: keyof typeof variantStyleMap | undefined;
1739
+ } & {
1740
+ renderAs: keyof react.JSX.IntrinsicElements | react.JSXElementConstructor<any>;
1741
+ })>, never> & Record<string, never>;
1647
1742
 
1648
1743
  type MenuItemLabelProps = {
1649
1744
  /**
@@ -2011,15 +2106,19 @@ type StackProps = {
2011
2106
  * The default behavior is `vertical`. Can be a [responsive prop](/docs/ui-docs-responsive-props--docs).
2012
2107
  */
2013
2108
  direction?: 'horizontal' | 'vertical';
2014
- renderAs?: ElementType;
2109
+ renderAs?: ElementType$1;
2015
2110
  };
2016
2111
  /**
2017
2112
  * Used to layout its children in a vertical or horizontal stack. The gap between each item in the stack can be customized.
2018
2113
  * This allows for layouting children in a consistent way without needing to manually add margins or padding.
2019
2114
  */
2020
- declare const Stack: (<C extends ElementType = "div">(props: PolymorphicComponentProps<C, StackProps>) => react.ReactElement | null) & {
2021
- [x: string]: unknown;
2022
- };
2115
+ declare const Stack: (<C = "div">(props: PolymorphicComponentProps<C, StackProps>) => react.ReactElement) & Omit<react.FunctionComponent<(Omit<Omit<any, "ref">, keyof StackProps> & {
2116
+ renderAs?: any;
2117
+ } & StackProps & {
2118
+ ref?: any;
2119
+ }) | (StackProps & {
2120
+ renderAs: keyof react.JSX.IntrinsicElements | react.JSXElementConstructor<any>;
2121
+ })>, never> & Record<string, never>;
2023
2122
 
2024
2123
  type TagProps = ComponentPropsWithoutRef<'div'> & {
2025
2124
  /**