@wistia/ui 0.0.8 → 0.0.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, JSX, ComponentPropsWithoutRef, ComponentPropsWithRef, MouseEvent, JSXElementConstructor, ElementType as ElementType$1 } from 'react';
3
+ import { ReactNode, ComponentPropsWithoutRef, JSX, ComponentPropsWithRef, MouseEvent, JSXElementConstructor, ElementType as ElementType$1 } from 'react';
4
4
  import { LinkProps as LinkProps$1 } from 'react-router-dom';
5
5
  import * as styled_components from 'styled-components';
6
6
 
@@ -56,6 +56,60 @@ type AriaLiveContextType = {
56
56
  };
57
57
  declare const useAriaLive: () => AriaLiveContextType;
58
58
 
59
+ declare const colorSchemeOptions: readonly ["inherit", "default", "info", "success", "warning", "error", "blue", "green", "orange", "pink", "purple", "yellow"];
60
+ type ColorSchemeTypes = (typeof colorSchemeOptions)[number];
61
+ type ColorSchemeWrapperProps = ComponentPropsWithoutRef<'div'> & {
62
+ /**
63
+ * The color scheme to apply
64
+ */
65
+ colorScheme: ColorSchemeTypes;
66
+ /**
67
+ * Children
68
+ */
69
+ children: ReactNode;
70
+ };
71
+ /**
72
+ * A wrapper to apply a color scheme to its children.
73
+ */
74
+ declare const ColorSchemeWrapper: {
75
+ ({ colorScheme, children, ...otherProps }: ColorSchemeWrapperProps): JSX.Element;
76
+ displayName: string;
77
+ };
78
+
79
+ type BadgeProps = ComponentPropsWithoutRef<'div'> & {
80
+ /**
81
+ * Set the color scheme of the `Badge`
82
+ * TODO - link to a color scheme page
83
+ */
84
+ colorScheme?: ColorSchemeTypes;
85
+ /**
86
+ * The `Icon` component to use. Must be an instance of [Icon](/?path=/docs/components-icon--docs)
87
+ */
88
+ icon?: JSX.Element;
89
+ /**
90
+ * The text to display in the `Badge`
91
+ */
92
+ label: string;
93
+ };
94
+ /**
95
+ * A badge is a compact label, with optional icon, to convey status or context.
96
+ */
97
+ declare const Badge: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
98
+ /**
99
+ * Set the color scheme of the `Badge`
100
+ * TODO - link to a color scheme page
101
+ */
102
+ colorScheme?: ColorSchemeTypes;
103
+ /**
104
+ * The `Icon` component to use. Must be an instance of [Icon](/?path=/docs/components-icon--docs)
105
+ */
106
+ icon?: JSX.Element;
107
+ /**
108
+ * The text to display in the `Badge`
109
+ */
110
+ label: string;
111
+ } & react.RefAttributes<HTMLDivElement>>;
112
+
59
113
  type JustifyContentType = 'center' | 'flex-end' | 'flex-start' | 'space-around' | 'space-between' | 'space-evenly';
60
114
  type AlignContentType = 'center' | 'flex-end' | 'flex-start' | 'space-around' | 'space-between' | 'stretch';
61
115
  type AlignItemsType = 'baseline' | 'center' | 'flex-end' | 'flex-start' | 'stretch';
@@ -66,6 +120,16 @@ type Gap = {
66
120
  column: number | string;
67
121
  row: number | string;
68
122
  };
123
+ /**
124
+ * CSS property => Box prop:
125
+ * flex-direction => direction
126
+ * justify-content => justifyContent
127
+ * align-items => alignItems
128
+ * align-content => alignContent
129
+ * flex-wrap => wrapItems
130
+ * gap => gap
131
+ * display: inline-flex => inline
132
+ */
69
133
  type BoxProps = ComponentPropsWithoutRef<'div'> & {
70
134
  /**
71
135
  * Specifies how the browser distributes space between and around
@@ -159,15 +223,12 @@ type BoxProps = ComponentPropsWithoutRef<'div'> & {
159
223
  * Box is a layout container using [CSS Flexbox](https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Flexbox).
160
224
  */
161
225
  declare const Box: {
162
- ({ alignContent, alignItems, children, direction, hasBoxParent, fill, fillViewport, inline, justifyContent, wrapItems, ...otherProps }: BoxProps): JSX.Element;
226
+ ({ alignContent, alignItems, children, direction, hasBoxParent, fill, fillViewport, gap, inline, justifyContent, wrapItems, ...otherProps }: BoxProps): JSX.Element;
163
227
  displayName: string;
164
228
  };
165
229
 
166
- type ButtonSizes = 'hero' | 'large' | 'medium' | 'small';
167
230
  type ButtonVariants = 'ghost' | 'outline' | 'soft' | 'solid';
168
231
 
169
- type ColorSchemeTypes = 'inherit' | 'default' | 'info' | 'success' | 'warning' | 'error' | 'blue' | 'green' | 'orange' | 'pink' | 'purple' | 'yellow';
170
-
171
232
  type LinkTypes = 'default' | 'email' | 'external' | 'phone';
172
233
  type BaseProps = {
173
234
  /**
@@ -229,6 +290,7 @@ type ResponsiveObject<T> = AtLeastOneBreakpoint<Record<Breakpoints, T>> & {
229
290
  base: T;
230
291
  };
231
292
 
293
+ type ButtonSizes = 'lg' | 'md' | 'sm' | 'xl';
232
294
  type BaseButtonProps = {
233
295
  /**
234
296
  * Text that appears inside of the button
@@ -268,7 +330,7 @@ type BaseButtonProps = {
268
330
  * If true, the button will fill its container
269
331
  *
270
332
  * @type boolean | ResponsiveObject<boolean>
271
- * */
333
+ */
272
334
  fullWidth?: ResponsiveObject<boolean> | boolean;
273
335
  /**
274
336
  * Provides a button without any styling (useful for wrapping another element)
@@ -280,8 +342,6 @@ type BaseButtonProps = {
280
342
  rightIcon?: JSX.Element | undefined;
281
343
  /**
282
344
  * The size of button to display. Can be used as a [responsive prop](/docs/ui-docs-responsive-props--docs)
283
- *
284
- * @type 'small' | 'medium' | 'large' | 'hero'
285
345
  */
286
346
  size?: ButtonSizes | ResponsiveObject<ButtonSizes>;
287
347
  /**
@@ -732,7 +792,9 @@ type IconButtonProps = {
732
792
  * Accessible text for screen readers. Also shows up in a tooltip unless `disableTooltip` is true.
733
793
  */
734
794
  label: string;
735
- /** Disable the tooltip */
795
+ /**
796
+ * Disable the tooltip
797
+ */
736
798
  disableTooltip?: boolean;
737
799
  /**
738
800
  * The Icon component to use, e.g. `<Icon type="favorite" />`
@@ -748,7 +810,9 @@ declare const IconButton: react.ForwardRefExoticComponent<(Omit<{
748
810
  * Accessible text for screen readers. Also shows up in a tooltip unless `disableTooltip` is true.
749
811
  */
750
812
  label: string;
751
- /** Disable the tooltip */
813
+ /**
814
+ * Disable the tooltip
815
+ */
752
816
  disableTooltip?: boolean;
753
817
  /**
754
818
  * The Icon component to use, e.g. `<Icon type="favorite" />`
@@ -759,7 +823,9 @@ declare const IconButton: react.ForwardRefExoticComponent<(Omit<{
759
823
  * Accessible text for screen readers. Also shows up in a tooltip unless `disableTooltip` is true.
760
824
  */
761
825
  label: string;
762
- /** Disable the tooltip */
826
+ /**
827
+ * Disable the tooltip
828
+ */
763
829
  disableTooltip?: boolean;
764
830
  /**
765
831
  * The Icon component to use, e.g. `<Icon type="favorite" />`
@@ -767,6 +833,37 @@ declare const IconButton: react.ForwardRefExoticComponent<(Omit<{
767
833
  children: JSX.Element;
768
834
  } & Omit<ButtonAsLinkProps, "leftIcon" | "fullWidth" | "rightIcon">, "ref">) & react.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
769
835
 
836
+ type LabelProps = ComponentPropsWithoutRef<'label'> & {
837
+ /**
838
+ * Pass an arbitrary child node
839
+ */
840
+ children?: ReactNode;
841
+ /**
842
+ * To indicate that the label is for a disabled form component
843
+ */
844
+ disabled?: boolean;
845
+ /**
846
+ * ID of the form component that the label should be associated with
847
+ */
848
+ htmlFor?: string | undefined;
849
+ /**
850
+ * Use if label describes a required form component
851
+ */
852
+ required?: boolean;
853
+ /**
854
+ * For label text that needs to be available to assistive technology (e.g. screen readers)
855
+ * but otherwise hidden on screen.
856
+ */
857
+ screenReaderOnly?: boolean;
858
+ };
859
+ /**
860
+ * Labels are used to give a title to a form component (eg. Input, Select, etc.)
861
+ */
862
+ declare const Label: {
863
+ ({ children, disabled, htmlFor, required, screenReaderOnly, ...otherProps }: LabelProps): JSX.Element;
864
+ displayName: string;
865
+ };
866
+
770
867
  type ScreenReaderOnlyProps = ComponentPropsWithoutRef<'div'> & {
771
868
  /**
772
869
  * Pass an arbitrary child node
@@ -793,17 +890,18 @@ declare const ScreenReaderOnly: {
793
890
  type Spacings = 'space-01' | 'space-02' | 'space-03' | 'space-04' | 'space-05' | 'space-06' | 'space-07' | 'space-08' | 'space-09' | 'space-10' | 'space-11';
794
891
 
795
892
  type StackProps = {
893
+ /**
894
+ * Optional children
895
+ */
796
896
  children?: ReactNode | undefined;
797
897
  /**
798
898
  * The gap between each item in the stack. Can be a [responsive prop](/docs/ui-docs-responsive-props--docs).
799
899
  * TODO: add link to Spacing docs
800
- *
801
900
  */
802
901
  gap?: Spacings;
803
902
  /**
804
903
  * Vertical is equivalent to `flex-direction: column;`, horizontal is equivalent to `flex-direction: row;`.
805
904
  * The default behavior is `vertical`. Can be a [responsive prop](/docs/ui-docs-responsive-props--docs).
806
- *
807
905
  */
808
906
  direction?: 'horizontal' | 'vertical';
809
907
  renderAs?: ElementType$1;
@@ -1057,4 +1155,4 @@ declare const WistiaLogo: {
1057
1155
  displayName: string;
1058
1156
  };
1059
1157
 
1060
- export { Box, Button, ButtonGroup, type ButtonProps, Divider, Ellipsis, Heading, type HeadingProps, Icon, IconButton, type IconButtonProps, type IconNameType, Link, type LinkProps, ScreenReaderOnly, Stack, Text, type TextProps, Tooltip, type TooltipProps, UIProvider, WistiaLogo, copyToClipboard, ellipsisFlexParentStyle, ellipsisStyle, iconSizeMap, mq, useActiveMq, useAriaLive, useMq, useWindowSize };
1158
+ export { Badge, type BadgeProps, Box, type BoxProps, Button, ButtonGroup, type ButtonProps, type ColorSchemeTypes, ColorSchemeWrapper, type ColorSchemeWrapperProps, Divider, Ellipsis, Heading, type HeadingProps, Icon, IconButton, type IconButtonProps, type IconNameType, Label, type LabelProps, Link, type LinkProps, ScreenReaderOnly, Stack, Text, type TextProps, Tooltip, type TooltipProps, UIProvider, WistiaLogo, colorSchemeOptions, copyToClipboard, ellipsisFlexParentStyle, ellipsisStyle, iconSizeMap, mq, useActiveMq, useAriaLive, useMq, 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, JSX, ComponentPropsWithoutRef, ComponentPropsWithRef, MouseEvent, JSXElementConstructor, ElementType as ElementType$1 } from 'react';
3
+ import { ReactNode, ComponentPropsWithoutRef, JSX, ComponentPropsWithRef, MouseEvent, JSXElementConstructor, ElementType as ElementType$1 } from 'react';
4
4
  import { LinkProps as LinkProps$1 } from 'react-router-dom';
5
5
  import * as styled_components from 'styled-components';
6
6
 
@@ -56,6 +56,60 @@ type AriaLiveContextType = {
56
56
  };
57
57
  declare const useAriaLive: () => AriaLiveContextType;
58
58
 
59
+ declare const colorSchemeOptions: readonly ["inherit", "default", "info", "success", "warning", "error", "blue", "green", "orange", "pink", "purple", "yellow"];
60
+ type ColorSchemeTypes = (typeof colorSchemeOptions)[number];
61
+ type ColorSchemeWrapperProps = ComponentPropsWithoutRef<'div'> & {
62
+ /**
63
+ * The color scheme to apply
64
+ */
65
+ colorScheme: ColorSchemeTypes;
66
+ /**
67
+ * Children
68
+ */
69
+ children: ReactNode;
70
+ };
71
+ /**
72
+ * A wrapper to apply a color scheme to its children.
73
+ */
74
+ declare const ColorSchemeWrapper: {
75
+ ({ colorScheme, children, ...otherProps }: ColorSchemeWrapperProps): JSX.Element;
76
+ displayName: string;
77
+ };
78
+
79
+ type BadgeProps = ComponentPropsWithoutRef<'div'> & {
80
+ /**
81
+ * Set the color scheme of the `Badge`
82
+ * TODO - link to a color scheme page
83
+ */
84
+ colorScheme?: ColorSchemeTypes;
85
+ /**
86
+ * The `Icon` component to use. Must be an instance of [Icon](/?path=/docs/components-icon--docs)
87
+ */
88
+ icon?: JSX.Element;
89
+ /**
90
+ * The text to display in the `Badge`
91
+ */
92
+ label: string;
93
+ };
94
+ /**
95
+ * A badge is a compact label, with optional icon, to convey status or context.
96
+ */
97
+ declare const Badge: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
98
+ /**
99
+ * Set the color scheme of the `Badge`
100
+ * TODO - link to a color scheme page
101
+ */
102
+ colorScheme?: ColorSchemeTypes;
103
+ /**
104
+ * The `Icon` component to use. Must be an instance of [Icon](/?path=/docs/components-icon--docs)
105
+ */
106
+ icon?: JSX.Element;
107
+ /**
108
+ * The text to display in the `Badge`
109
+ */
110
+ label: string;
111
+ } & react.RefAttributes<HTMLDivElement>>;
112
+
59
113
  type JustifyContentType = 'center' | 'flex-end' | 'flex-start' | 'space-around' | 'space-between' | 'space-evenly';
60
114
  type AlignContentType = 'center' | 'flex-end' | 'flex-start' | 'space-around' | 'space-between' | 'stretch';
61
115
  type AlignItemsType = 'baseline' | 'center' | 'flex-end' | 'flex-start' | 'stretch';
@@ -66,6 +120,16 @@ type Gap = {
66
120
  column: number | string;
67
121
  row: number | string;
68
122
  };
123
+ /**
124
+ * CSS property => Box prop:
125
+ * flex-direction => direction
126
+ * justify-content => justifyContent
127
+ * align-items => alignItems
128
+ * align-content => alignContent
129
+ * flex-wrap => wrapItems
130
+ * gap => gap
131
+ * display: inline-flex => inline
132
+ */
69
133
  type BoxProps = ComponentPropsWithoutRef<'div'> & {
70
134
  /**
71
135
  * Specifies how the browser distributes space between and around
@@ -159,15 +223,12 @@ type BoxProps = ComponentPropsWithoutRef<'div'> & {
159
223
  * Box is a layout container using [CSS Flexbox](https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Flexbox).
160
224
  */
161
225
  declare const Box: {
162
- ({ alignContent, alignItems, children, direction, hasBoxParent, fill, fillViewport, inline, justifyContent, wrapItems, ...otherProps }: BoxProps): JSX.Element;
226
+ ({ alignContent, alignItems, children, direction, hasBoxParent, fill, fillViewport, gap, inline, justifyContent, wrapItems, ...otherProps }: BoxProps): JSX.Element;
163
227
  displayName: string;
164
228
  };
165
229
 
166
- type ButtonSizes = 'hero' | 'large' | 'medium' | 'small';
167
230
  type ButtonVariants = 'ghost' | 'outline' | 'soft' | 'solid';
168
231
 
169
- type ColorSchemeTypes = 'inherit' | 'default' | 'info' | 'success' | 'warning' | 'error' | 'blue' | 'green' | 'orange' | 'pink' | 'purple' | 'yellow';
170
-
171
232
  type LinkTypes = 'default' | 'email' | 'external' | 'phone';
172
233
  type BaseProps = {
173
234
  /**
@@ -229,6 +290,7 @@ type ResponsiveObject<T> = AtLeastOneBreakpoint<Record<Breakpoints, T>> & {
229
290
  base: T;
230
291
  };
231
292
 
293
+ type ButtonSizes = 'lg' | 'md' | 'sm' | 'xl';
232
294
  type BaseButtonProps = {
233
295
  /**
234
296
  * Text that appears inside of the button
@@ -268,7 +330,7 @@ type BaseButtonProps = {
268
330
  * If true, the button will fill its container
269
331
  *
270
332
  * @type boolean | ResponsiveObject<boolean>
271
- * */
333
+ */
272
334
  fullWidth?: ResponsiveObject<boolean> | boolean;
273
335
  /**
274
336
  * Provides a button without any styling (useful for wrapping another element)
@@ -280,8 +342,6 @@ type BaseButtonProps = {
280
342
  rightIcon?: JSX.Element | undefined;
281
343
  /**
282
344
  * The size of button to display. Can be used as a [responsive prop](/docs/ui-docs-responsive-props--docs)
283
- *
284
- * @type 'small' | 'medium' | 'large' | 'hero'
285
345
  */
286
346
  size?: ButtonSizes | ResponsiveObject<ButtonSizes>;
287
347
  /**
@@ -732,7 +792,9 @@ type IconButtonProps = {
732
792
  * Accessible text for screen readers. Also shows up in a tooltip unless `disableTooltip` is true.
733
793
  */
734
794
  label: string;
735
- /** Disable the tooltip */
795
+ /**
796
+ * Disable the tooltip
797
+ */
736
798
  disableTooltip?: boolean;
737
799
  /**
738
800
  * The Icon component to use, e.g. `<Icon type="favorite" />`
@@ -748,7 +810,9 @@ declare const IconButton: react.ForwardRefExoticComponent<(Omit<{
748
810
  * Accessible text for screen readers. Also shows up in a tooltip unless `disableTooltip` is true.
749
811
  */
750
812
  label: string;
751
- /** Disable the tooltip */
813
+ /**
814
+ * Disable the tooltip
815
+ */
752
816
  disableTooltip?: boolean;
753
817
  /**
754
818
  * The Icon component to use, e.g. `<Icon type="favorite" />`
@@ -759,7 +823,9 @@ declare const IconButton: react.ForwardRefExoticComponent<(Omit<{
759
823
  * Accessible text for screen readers. Also shows up in a tooltip unless `disableTooltip` is true.
760
824
  */
761
825
  label: string;
762
- /** Disable the tooltip */
826
+ /**
827
+ * Disable the tooltip
828
+ */
763
829
  disableTooltip?: boolean;
764
830
  /**
765
831
  * The Icon component to use, e.g. `<Icon type="favorite" />`
@@ -767,6 +833,37 @@ declare const IconButton: react.ForwardRefExoticComponent<(Omit<{
767
833
  children: JSX.Element;
768
834
  } & Omit<ButtonAsLinkProps, "leftIcon" | "fullWidth" | "rightIcon">, "ref">) & react.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
769
835
 
836
+ type LabelProps = ComponentPropsWithoutRef<'label'> & {
837
+ /**
838
+ * Pass an arbitrary child node
839
+ */
840
+ children?: ReactNode;
841
+ /**
842
+ * To indicate that the label is for a disabled form component
843
+ */
844
+ disabled?: boolean;
845
+ /**
846
+ * ID of the form component that the label should be associated with
847
+ */
848
+ htmlFor?: string | undefined;
849
+ /**
850
+ * Use if label describes a required form component
851
+ */
852
+ required?: boolean;
853
+ /**
854
+ * For label text that needs to be available to assistive technology (e.g. screen readers)
855
+ * but otherwise hidden on screen.
856
+ */
857
+ screenReaderOnly?: boolean;
858
+ };
859
+ /**
860
+ * Labels are used to give a title to a form component (eg. Input, Select, etc.)
861
+ */
862
+ declare const Label: {
863
+ ({ children, disabled, htmlFor, required, screenReaderOnly, ...otherProps }: LabelProps): JSX.Element;
864
+ displayName: string;
865
+ };
866
+
770
867
  type ScreenReaderOnlyProps = ComponentPropsWithoutRef<'div'> & {
771
868
  /**
772
869
  * Pass an arbitrary child node
@@ -793,17 +890,18 @@ declare const ScreenReaderOnly: {
793
890
  type Spacings = 'space-01' | 'space-02' | 'space-03' | 'space-04' | 'space-05' | 'space-06' | 'space-07' | 'space-08' | 'space-09' | 'space-10' | 'space-11';
794
891
 
795
892
  type StackProps = {
893
+ /**
894
+ * Optional children
895
+ */
796
896
  children?: ReactNode | undefined;
797
897
  /**
798
898
  * The gap between each item in the stack. Can be a [responsive prop](/docs/ui-docs-responsive-props--docs).
799
899
  * TODO: add link to Spacing docs
800
- *
801
900
  */
802
901
  gap?: Spacings;
803
902
  /**
804
903
  * Vertical is equivalent to `flex-direction: column;`, horizontal is equivalent to `flex-direction: row;`.
805
904
  * The default behavior is `vertical`. Can be a [responsive prop](/docs/ui-docs-responsive-props--docs).
806
- *
807
905
  */
808
906
  direction?: 'horizontal' | 'vertical';
809
907
  renderAs?: ElementType$1;
@@ -1057,4 +1155,4 @@ declare const WistiaLogo: {
1057
1155
  displayName: string;
1058
1156
  };
1059
1157
 
1060
- export { Box, Button, ButtonGroup, type ButtonProps, Divider, Ellipsis, Heading, type HeadingProps, Icon, IconButton, type IconButtonProps, type IconNameType, Link, type LinkProps, ScreenReaderOnly, Stack, Text, type TextProps, Tooltip, type TooltipProps, UIProvider, WistiaLogo, copyToClipboard, ellipsisFlexParentStyle, ellipsisStyle, iconSizeMap, mq, useActiveMq, useAriaLive, useMq, useWindowSize };
1158
+ export { Badge, type BadgeProps, Box, type BoxProps, Button, ButtonGroup, type ButtonProps, type ColorSchemeTypes, ColorSchemeWrapper, type ColorSchemeWrapperProps, Divider, Ellipsis, Heading, type HeadingProps, Icon, IconButton, type IconButtonProps, type IconNameType, Label, type LabelProps, Link, type LinkProps, ScreenReaderOnly, Stack, Text, type TextProps, Tooltip, type TooltipProps, UIProvider, WistiaLogo, colorSchemeOptions, copyToClipboard, ellipsisFlexParentStyle, ellipsisStyle, iconSizeMap, mq, useActiveMq, useAriaLive, useMq, useWindowSize };