@purpurds/card 7.6.1 → 7.7.0

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/src/card-root.tsx CHANGED
@@ -1,21 +1,12 @@
1
- import React, {
2
- type DetailedHTMLProps,
3
- type ForwardedRef,
4
- forwardRef,
5
- type HTMLAttributes,
6
- type ReactNode,
7
- } from "react";
1
+ import React, { forwardRef, type ReactNode } from "react";
2
+ import type { BaseProps } from "@purpurds/common-types";
8
3
  import c from "classnames/bind";
9
4
 
10
5
  import styles from "./card-root.module.scss";
11
6
 
12
7
  const cx = c.bind(styles);
13
8
 
14
- export type CardRootProps = DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement> & {
15
- /**
16
- * Use this to set a testid on the card
17
- */
18
- ["data-testid"]?: string;
9
+ export type CardRootProps = Omit<BaseProps, "children"> & {
19
10
  children: ReactNode;
20
11
  fullHeight?: boolean;
21
12
  variant?: "primary" | "secondary";
@@ -23,7 +14,7 @@ export type CardRootProps = DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HT
23
14
 
24
15
  const rootClassName = "purpur-card-root";
25
16
 
26
- export const CardRoot = forwardRef(
17
+ export const CardRoot = forwardRef<HTMLDivElement, CardRootProps>(
27
18
  (
28
19
  {
29
20
  ["data-testid"]: dataTestId = "purpur-card-root",
@@ -32,8 +23,8 @@ export const CardRoot = forwardRef(
32
23
  fullHeight = true,
33
24
  variant,
34
25
  ...props
35
- }: CardRootProps,
36
- ref: ForwardedRef<HTMLDivElement>
26
+ },
27
+ ref
37
28
  ) => {
38
29
  const classes = cx([
39
30
  rootClassName,
@@ -86,7 +86,7 @@ export const CardWithHeading: Story = {
86
86
  <Card.Heading
87
87
  title="Tips and tricks"
88
88
  icon={<IconSimcard size="sm" />}
89
- href="/?path=/docs/components-card--docs"
89
+ href="/?path=/docs/layout-and-structure-card--docs"
90
90
  >
91
91
  <Card.Cta linkStyling>
92
92
  <IconArrowRight size="sm" />
@@ -221,7 +221,7 @@ export const CardHeadingWithCustomLinkElement: Story = {
221
221
  <Card>
222
222
  <Card.Heading
223
223
  title="Tips and tricks"
224
- href="/?path=/docs/components-card--docs"
224
+ href="/?path=/docs/layout-and-structure-card--docs"
225
225
  linkElement={React.forwardRef(
226
226
  (
227
227
  { href, children }: { href?: string; children?: React.ReactNode },
@@ -253,7 +253,7 @@ export const CardHeadingWithCustomLinkElement: Story = {
253
253
  <Card {...args}>
254
254
  <Card.Heading
255
255
  title="Tips and tricks"
256
- href="/?path=/docs/components-card--docs"
256
+ href="/?path=/docs/layout-and-structure-card--docs"
257
257
  linkElement={LinkElement}
258
258
  ></Card.Heading>
259
259
  </Card>