@companycam/slab-web 1.16.2-beta.3 → 1.16.2-beta.5

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.
@@ -6,12 +6,13 @@ export type BillboardImage = {
6
6
  alt: string;
7
7
  imageContainerStyle?: CSSProperties;
8
8
  };
9
- type Action = Omit<ButtonProps, 'children'> & {
9
+ type Action<C extends React.ElementType = 'button'> = ButtonProps<C> & {
10
10
  label: string;
11
11
  'data-testid'?: string;
12
+ children?: 'never';
12
13
  };
13
14
  type HTMLDivProps = ComponentPropsWithRef<'div'>;
14
- export type BillboardProps = HTMLDivProps & {
15
+ export type BillboardProps<PrimaryActionButtonComponent extends React.ElementType = 'button', SecondaryActionButtonComponent extends React.ElementType = 'button'> = HTMLDivProps & {
15
16
  color?: BillboardIconColor;
16
17
  /** Add margin with spacing design tokens: `ccMargin="none xl l s"` */
17
18
  ccMargin?: string;
@@ -20,9 +21,9 @@ export type BillboardProps = HTMLDivProps & {
20
21
  /** Body text below the title */
21
22
  message?: string;
22
23
  /** Top button. [Button](../?path=/docs/button--docs) props. */
23
- primaryAction?: Action;
24
+ primaryAction?: Action<PrimaryActionButtonComponent>;
24
25
  /** Bottom button - always `subtle`. [Button](../?path=/docs/button--docs) props. */
25
- secondaryAction?: Action;
26
+ secondaryAction?: Action<SecondaryActionButtonComponent>;
26
27
  /** Heading text */
27
28
  title?: string;
28
29
  /** Image source, alt text, image container style */
@@ -35,5 +36,5 @@ export type BillboardProps = HTMLDivProps & {
35
36
  * - If the `message` is long enough, set a `max-width` by extending Billboard as a `styled-component`: `const StyledBillboard = styled(Billboard)({ maxWidth: '400px'; margin: 0 auto; });`
36
37
  * - Target the `image.imageContainerStyle` prop to style the image container to best accommodate your image's aspect ratio.
37
38
  */
38
- export declare const Billboard: ({ image, ccMargin, color, iconName, message, primaryAction, secondaryAction, title, ...props }: BillboardProps) => import("react/jsx-runtime").JSX.Element;
39
+ export declare function Billboard<PrimaryActionButtonComponent extends React.ElementType = 'button', SecondaryActionButtonComponent extends React.ElementType = 'button'>({ image, ccMargin, color, iconName, message, primaryAction, secondaryAction, title, ...props }: BillboardProps<PrimaryActionButtonComponent, SecondaryActionButtonComponent>): import("react/jsx-runtime").JSX.Element;
39
40
  export default Billboard;
@@ -1,5 +1,5 @@
1
1
  import { default as React, CSSProperties, ReactElement } from 'react';
2
- import { PolymorphicComponentPropsWithRef } from '../shared/types';
2
+ import { PolymorphicComponentPropsWithRef, PolymorphicRef } from '../shared/types';
3
3
  type ButtonColor = 'destroy' | 'primary' | 'secondary' | 'subtle' | 'success';
4
4
  export type ButtonSize = 'small' | 'medium' | 'large';
5
5
  declare const ButtonDesigns: {
@@ -33,11 +33,17 @@ export type BaseButtonProps = {
33
33
  };
34
34
  export type ButtonProps<C extends React.ElementType = 'button'> = PolymorphicComponentPropsWithRef<C, BaseButtonProps>;
35
35
  export type ButtonAsAnchorProps = Omit<ButtonProps<'a'>, 'component' | 'href'> & {
36
+ component?: never;
36
37
  href: string;
37
38
  };
39
+ declare function BaseButton<C extends React.ElementType = 'button'>(props: ButtonProps<C>, ref?: PolymorphicRef<C>): React.ReactNode;
40
+ declare function BaseButton(props: ButtonAsAnchorProps, ref?: PolymorphicRef<'a'>): React.ReactNode;
41
+ declare namespace BaseButton {
42
+ var displayName: string;
43
+ }
38
44
  /**
39
45
  * A versatile button component that can be rendered as any HTML element or React component.
40
46
  * Automatically renders as an anchor tag when an href prop is provided.
41
47
  */
42
- export declare const Button: <C extends React.ElementType>(p: ButtonProps<C>) => React.ReactNode;
48
+ export declare const Button: typeof BaseButton;
43
49
  export default Button;
@@ -1,10 +1,15 @@
1
1
  import { BaseButtonProps } from '../Button/Button';
2
- import { PolymorphicComponentPropsWithRef } from '../shared/types';
3
- type BaseButtonCondensedProps = Omit<BaseButtonProps, 'design'>;
2
+ import { PolymorphicComponentPropsWithRef, PolymorphicRef } from '../shared/types';
3
+ export type BaseButtonCondensedProps = Omit<BaseButtonProps, 'design'> & {
4
+ design?: never;
5
+ };
4
6
  export type ButtonCondensedProps<C extends React.ElementType = 'button'> = PolymorphicComponentPropsWithRef<C, BaseButtonCondensedProps>;
5
7
  export type ButtonCondensedAsAnchorProps = Omit<ButtonCondensedProps<'a'>, 'component' | 'href'> & {
8
+ component?: never;
6
9
  href: string;
7
10
  };
11
+ declare function BaseButtonCondensed<C extends React.ElementType = 'button'>(props: ButtonCondensedProps<C>, ref?: PolymorphicRef<C>): React.ReactNode;
12
+ declare function BaseButtonCondensed(props: ButtonCondensedAsAnchorProps, ref?: PolymorphicRef<'a'>): React.ReactNode;
8
13
  /**
9
14
  A minimal [Button](/docs/button--docs) with styles for situations where you don't need padding, such as inside a table cell.
10
15
 
@@ -12,5 +17,5 @@ ButtonCondensed accepts all of the same props as [Button](/docs/button--docs), b
12
17
 
13
18
  If you want to render a simple inline link within a text block, use [Link](/docs/link--docs) instead.
14
19
  */
15
- export declare const ButtonCondensed: <C extends React.ElementType>(p: ButtonCondensedProps<C>) => React.ReactNode;
20
+ export declare const ButtonCondensed: typeof BaseButtonCondensed;
16
21
  export default ButtonCondensed;
@@ -1,19 +1,17 @@
1
1
  import { ElementType } from 'react';
2
2
  import { BaseButtonProps, IconComponentProps } from '../Button/Button';
3
3
  import { PolymorphicComponentPropsWithRef } from '../shared/types';
4
- type FilteredBaseButtonProps = Omit<BaseButtonProps, 'design' | 'icon' | 'size'>;
5
- type Size = 'small' | 'medium' | 'large';
6
4
  type Shape = 'circle' | 'square';
7
- export type BaseButtonIconProps<C extends ElementType> = FilteredBaseButtonProps & {
5
+ export type BaseButtonIconProps = Omit<BaseButtonProps, 'design' | 'icon'> & {
8
6
  accessibilityLabel: string;
9
7
  iconName?: string;
10
8
  iconComponent?: IconComponentProps;
11
9
  shape?: Shape;
12
- size?: Size;
13
10
  design?: 'solid' | 'minimal';
14
11
  };
15
- export type ButtonIconProps<C extends ElementType = 'button'> = PolymorphicComponentPropsWithRef<C, BaseButtonIconProps<C>>;
12
+ export type ButtonIconProps<C extends ElementType = 'button'> = PolymorphicComponentPropsWithRef<C, BaseButtonIconProps>;
16
13
  export type ButtonIconAsAnchorProps = Omit<ButtonIconProps<'a'>, 'component' | 'href'> & {
14
+ component?: never;
17
15
  href: string;
18
16
  };
19
17
  /**
@@ -1,8 +1,9 @@
1
1
  import { BaseButtonIconProps } from '../ButtonIcon/ButtonIcon';
2
2
  import { PolymorphicComponentPropsWithRef } from '../shared/types';
3
- type BaseButtonIconCondensedProps<C extends React.ElementType = 'button'> = Omit<BaseButtonIconProps<C>, 'design'>;
4
- export type ButtonIconCondensedProps<C extends React.ElementType = 'button'> = PolymorphicComponentPropsWithRef<C, BaseButtonIconCondensedProps<C>>;
3
+ type BaseButtonIconCondensedProps = Omit<BaseButtonIconProps, 'design'>;
4
+ export type ButtonIconCondensedProps<C extends React.ElementType = 'button'> = PolymorphicComponentPropsWithRef<C, BaseButtonIconCondensedProps>;
5
5
  export type ButtonIconCondensedAsAnchorProps = Omit<ButtonIconCondensedProps<'a'>, 'component' | 'href'> & {
6
+ component?: never;
6
7
  href: string;
7
8
  };
8
9
  export declare const ButtonIconCondensed: <C extends React.ElementType>(p: ButtonIconCondensedProps<C>) => React.ReactNode;
@@ -1,13 +1,14 @@
1
1
  import { default as React, ComponentPropsWithRef } from 'react';
2
- import { ButtonProps } from '../Button/Button';
3
- type Action = Omit<ButtonProps, 'children' | 'color' | 'icon'> & {
2
+ import { ButtonCondensedProps, BaseButtonCondensedProps } from '../ButtonCondensed/ButtonCondensed';
3
+ type BaseAction = Omit<BaseButtonCondensedProps, 'color' | 'icon'> & {
4
4
  label: string;
5
5
  'data-testid'?: string;
6
6
  };
7
+ type Action<C extends React.ElementType = 'button'> = ButtonCondensedProps<C> & BaseAction;
7
8
  type HTMLHeaderProps = ComponentPropsWithRef<'header'>;
8
- export type PageHeaderProps = HTMLHeaderProps & {
9
+ export type PageHeaderProps<C extends React.ElementType = 'button'> = HTMLHeaderProps & {
9
10
  heading: string;
10
- backAction?: Action;
11
+ backAction?: Action<C>;
11
12
  contentAfter?: React.ReactNode;
12
13
  contentAfterHeading?: React.ReactNode;
13
14
  hasBottomBorder?: boolean;
@@ -19,5 +20,5 @@ export type PageHeaderProps = HTMLHeaderProps & {
19
20
  - You can include an optional breadcrumb nav button above the heading with `backAction`. `backAction` gives you access to props for [Button](/docs/button--docs) and requires a `label`.
20
21
  - There's also an optional `contentAfter` prop where you can add buttons or other relevant content you may want to include at the end of the header.
21
22
  */
22
- export declare function PageHeader({ backAction, contentAfter, contentAfterHeading, hasBottomBorder, testId, heading, ...props }: PageHeaderProps): import("react/jsx-runtime").JSX.Element;
23
+ export declare function PageHeader<BackActionComponent extends React.ElementType = 'button'>({ backAction, contentAfter, contentAfterHeading, hasBottomBorder, testId, heading, ...props }: PageHeaderProps<BackActionComponent>): import("react/jsx-runtime").JSX.Element;
23
24
  export default PageHeader;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@companycam/slab-web",
3
- "version": "1.16.2-beta.3",
3
+ "version": "1.16.2-beta.5",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {