@frontify/fondue 12.0.0-beta.74 → 12.0.0-beta.75
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/components/Card/Card.d.ts +2 -2
- package/dist/components/Card/Card.es.js +16 -16
- package/dist/components/Card/Card.es.js.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { FC,
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
2
|
import { PressEvent } from '@react-types/shared';
|
|
3
3
|
export declare type CardProps = {
|
|
4
|
+
children: ReactNode | ReactNode[];
|
|
4
5
|
hoverable?: boolean;
|
|
5
|
-
children?: ReactChild;
|
|
6
6
|
onClick?: (event: PressEvent) => void;
|
|
7
7
|
};
|
|
8
8
|
export declare const Card: FC<CardProps>;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { useButton as i } from "@react-aria/button";
|
|
2
|
-
import { merge as
|
|
3
|
-
import
|
|
4
|
-
import { mergeProps as
|
|
5
|
-
import { useFocusRing as
|
|
2
|
+
import { merge as d } from "../../utilities/merge.es.js";
|
|
3
|
+
import a, { useRef as f } from "react";
|
|
4
|
+
import { mergeProps as l } from "@react-aria/utils";
|
|
5
|
+
import { useFocusRing as p } from "@react-aria/focus";
|
|
6
6
|
import { FOCUS_STYLE as w } from "../../utilities/focusStyle.es.js";
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
{ elementType: "div", onPress: (
|
|
10
|
-
|
|
11
|
-
), { isFocusVisible: m, focusProps:
|
|
12
|
-
return /* @__PURE__ */
|
|
13
|
-
...
|
|
7
|
+
const R = ({ hoverable: t = !1, children: o, onClick: r }) => {
|
|
8
|
+
const e = f(null), { buttonProps: s } = i(
|
|
9
|
+
{ elementType: "div", onPress: (c) => r && r(c) },
|
|
10
|
+
e
|
|
11
|
+
), { isFocusVisible: m, focusProps: n } = p(), u = r ? l(s, n) : {};
|
|
12
|
+
return /* @__PURE__ */ a.createElement("div", {
|
|
13
|
+
...u,
|
|
14
14
|
"data-test-id": "card",
|
|
15
|
-
ref:
|
|
16
|
-
className:
|
|
17
|
-
"tw-w-full tw-outline-none tw-bg-white tw-border tw-border-black-10 tw-rounded",
|
|
18
|
-
|
|
15
|
+
ref: e,
|
|
16
|
+
className: d([
|
|
17
|
+
"tw-w-full tw-outline-none tw-bg-white tw-border tw-border-black-10 tw-rounded tw-overflow-hidden",
|
|
18
|
+
t ? "hover:tw-border-black" : "",
|
|
19
19
|
r ? "tw-cursor-pointer" : "tw-cursor-default",
|
|
20
20
|
m && w
|
|
21
21
|
])
|
|
22
22
|
}, o);
|
|
23
23
|
};
|
|
24
24
|
export {
|
|
25
|
-
|
|
25
|
+
R as Card
|
|
26
26
|
};
|
|
27
27
|
//# sourceMappingURL=Card.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.es.js","sources":["../../../src/components/Card/Card.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useButton } from '@react-aria/button';\nimport { merge } from '@utilities/merge';\nimport React, { FC,
|
|
1
|
+
{"version":3,"file":"Card.es.js","sources":["../../../src/components/Card/Card.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useButton } from '@react-aria/button';\nimport { merge } from '@utilities/merge';\nimport React, { FC, ReactNode, useRef } from 'react';\nimport { PressEvent } from '@react-types/shared';\nimport { mergeProps } from '@react-aria/utils';\nimport { useFocusRing } from '@react-aria/focus';\nimport { FOCUS_STYLE } from '@utilities/focusStyle';\n\nexport type CardProps = {\n children: ReactNode | ReactNode[];\n hoverable?: boolean;\n onClick?: (event: PressEvent) => void;\n};\n\nexport const Card: FC<CardProps> = ({ hoverable = false, children, onClick }) => {\n const ref = useRef<HTMLDivElement | null>(null);\n const { buttonProps } = useButton(\n { elementType: 'div', onPress: (event: PressEvent) => onClick && onClick(event) },\n ref,\n );\n const { isFocusVisible, focusProps } = useFocusRing();\n\n const clickableProps = !!onClick ? mergeProps(buttonProps, focusProps) : {};\n\n return (\n <div\n {...clickableProps}\n data-test-id=\"card\"\n ref={ref}\n className={merge([\n 'tw-w-full tw-outline-none tw-bg-white tw-border tw-border-black-10 tw-rounded tw-overflow-hidden',\n hoverable ? 'hover:tw-border-black' : '',\n onClick ? 'tw-cursor-pointer' : 'tw-cursor-default',\n isFocusVisible && FOCUS_STYLE,\n ])}\n >\n {children}\n </div>\n );\n};\n"],"names":["Card","hoverable","children","onClick","ref","useRef","buttonProps","useButton","event","isFocusVisible","focusProps","useFocusRing","clickableProps","mergeProps","React","merge","FOCUS_STYLE"],"mappings":";;;;;;AAgBO,MAAMA,IAAsB,CAAC,EAAE,WAAAC,IAAY,IAAO,UAAAC,GAAU,SAAAC,QAAc;AACvE,QAAAC,IAAMC,EAA8B,IAAI,GACxC,EAAE,aAAAC,MAAgBC;AAAA,IACpB,EAAE,aAAa,OAAO,SAAS,CAACC,MAAsBL,KAAWA,EAAQK,CAAK,EAAE;AAAA,IAChFJ;AAAA,EAAA,GAEE,EAAE,gBAAAK,GAAgB,YAAAC,EAAW,IAAIC,EAAa,GAE9CC,IAAmBT,IAAUU,EAAWP,GAAaI,CAAU,IAAI;AAEzE,SACK,gBAAAI,EAAA,cAAA,OAAA;AAAA,IACI,GAAGF;AAAA,IACJ,gBAAa;AAAA,IACb,KAAAR;AAAA,IACA,WAAWW,EAAM;AAAA,MACb;AAAA,MACAd,IAAY,0BAA0B;AAAA,MACtCE,IAAU,sBAAsB;AAAA,MAChCM,KAAkBO;AAAA,IAAA,CACrB;AAAA,EAAA,GAEAd,CACL;AAER;"}
|