@a-type/ui 0.6.14 → 0.6.16

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.
@@ -8,10 +8,15 @@ export declare const CardMain: import("react").ForwardRefExoticComponent<{
8
8
  onClick?: ((ev: MouseEvent) => void) | undefined;
9
9
  children?: ReactNode;
10
10
  compact?: boolean | undefined;
11
+ /** forces non-interactive version */
12
+ nonInteractive?: boolean | undefined;
11
13
  } & import("react").RefAttributes<any>>;
12
14
  export declare const CardTitle: import("react").FunctionComponent<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
13
15
  ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
14
16
  }>;
17
+ export declare const CardContent: import("react").FunctionComponent<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
18
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
19
+ }>;
15
20
  export declare const CardImage: import("react").FunctionComponent<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
16
21
  ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
17
22
  }>;
@@ -15,7 +15,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
15
15
  return (mod && mod.__esModule) ? mod : { "default": mod };
16
16
  };
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.CardGrid = exports.CardMenu = exports.CardActions = exports.CardFooter = exports.CardImage = exports.CardTitle = exports.CardMain = exports.CardRoot = void 0;
18
+ exports.CardGrid = exports.CardMenu = exports.CardActions = exports.CardFooter = exports.CardImage = exports.CardContent = exports.CardTitle = exports.CardMain = exports.CardRoot = void 0;
19
19
  const jsx_runtime_1 = require("react/jsx-runtime");
20
20
  const react_1 = require("react");
21
21
  const hooks_js_1 = require("../../hooks.js");
@@ -23,11 +23,14 @@ const react_slot_1 = require("@radix-ui/react-slot");
23
23
  const clsx_1 = __importDefault(require("clsx"));
24
24
  exports.CardRoot = (0, hooks_js_1.withClassName)('div', 'layer-components:flex layer-components:flex-col layer-components:border-light layer-components:rounded-lg layer-components:text-lg layer-components:overflow-hidden layer-components:h-max-content layer-components:relative layer-components:bg-gray-1 layer-components:text-black');
25
25
  exports.CardMain = (0, react_1.forwardRef)(function CardMain(_a, ref) {
26
- var { asChild, className, compact } = _a, rest = __rest(_a, ["asChild", "className", "compact"]);
27
- const Comp = asChild ? react_slot_1.Slot : 'button';
28
- return ((0, jsx_runtime_1.jsx)(Comp, Object.assign({ ref: ref, className: (0, clsx_1.default)('layer-components:flex layer-components:flex-col layer-components:gap-1 layer-components:cursor-pointer layer-components:transition layer-components:p-4 layer-components:pb-2 layer-components:flex-1 layer-components:relative layer-components:z-1 layer-components:bg-transparent layer-components:border-none layer-components:text-start layer-components:text-inherit', 'layer-components:hover:bg-lightBlend layer-components:hover:color-black', 'layer-components:md:pt-4', compact && 'layer-variants:p-1 layer-variants:bg-white layer-variants:gap-0', className), "data-compact": compact }, rest)));
26
+ var { asChild, className, compact, nonInteractive } = _a, rest = __rest(_a, ["asChild", "className", "compact", "nonInteractive"]);
27
+ const isInteractive = !nonInteractive && (!!asChild || !!rest.onClick);
28
+ const Comp = asChild ? react_slot_1.Slot : isInteractive ? 'button' : 'div';
29
+ return ((0, jsx_runtime_1.jsx)(Comp, Object.assign({ ref: ref, className: (0, clsx_1.default)('layer-components:flex layer-components:flex-col layer-components:gap-1 layer-components:transition layer-components:p-4 layer-components:pb-2 layer-components:flex-1 layer-components:relative layer-components:z-1 layer-components:bg-transparent layer-components:border-none layer-components:text-start layer-components:text-inherit layer-components:text-sm', 'layer-components:md:pt-4', compact && 'layer-variants:p-1 layer-variants:bg-white layer-variants:gap-0', isInteractive &&
30
+ 'layer-components:cursor-pointer layer-components:hover:bg-lightBlend layer-components:hover:color-black', className), "data-compact": compact }, rest)));
29
31
  });
30
32
  exports.CardTitle = (0, hooks_js_1.withClassName)('div', 'layer-components:flex layer-components:flex-col layer-components:gap-1 layer-components:mt-auto layer-components:bg-white layer-components:p-2 layer-components:rounded-lg layer-components:w-auto layer-components:mr-auto layer-components:border layer-components:border-solid layer-components:border-grayDarkBlend layer-components:text-md layer-components:max-h-80px layer-components:overflow-hidden layer-components:text-ellipsis layer-components:max-w-full layer-components:text-inherit', '[data-compact=true]>&:(bg-transparent border-none p-2 whitespace-nowrap text-ellipsis overflow-hidden)');
33
+ exports.CardContent = (0, hooks_js_1.withClassName)('div', 'layer-components:flex layer-components:flex-col layer-components:gap-1 layer-components:p-2');
31
34
  exports.CardImage = (0, hooks_js_1.withClassName)('div', 'layer-components:absolute layer-components:z-0 layer-components:right-0 layer-components:top-0 layer-components:bottom-0 layer-components:w-full layer-components:h-full');
32
35
  exports.CardFooter = (0, hooks_js_1.withClassName)('div', 'layer-components:flex layer-components:flex-row layer-components:p-2 layer-components:bg-white layer-components:relative layer-components:z-1 layer-components:border-0 layer-components:border-t layer-components:border-t-grayDarkBlend layer-components:border-solid');
33
36
  exports.CardActions = (0, hooks_js_1.withClassName)('div', 'layer-components:ml-0 layer-components:mr-auto layer-components:flex layer-components:flex-row layer-components:gap-1 layer-components:items-center');
@@ -1 +1 @@
1
- {"version":3,"file":"Card.js","sourceRoot":"","sources":["../../../../src/components/card/Card.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,iCAA0D;AAC1D,6CAA+C;AAC/C,qDAA4C;AAC5C,gDAA8B;AAEjB,QAAA,QAAQ,GAAG,IAAA,wBAAa,EACpC,KAAK,EACL,8HAA8H,CAC9H,CAAC;AAEW,QAAA,QAAQ,GAAG,IAAA,kBAAU,EAShC,SAAS,QAAQ,CAAC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EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,OAAW,EAAN,IAAI,cAAtD,qDAAwD,CAAF;IAGtD,MAAM,aAAa,GAAG,CAAC,cAAc,IAAI,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvE,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,iBAAI,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;IAC/D,OAAO,CACN,uBAAC,IAAI,kBACJ,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,IAAA,cAAU,EACpB,2IAA2I,EAC3I,0BAA0B,EAC1B,OAAO,IAAI,qCAAqC,EAChD,aAAa;YACZ,oFAAoF,EACrF,SAAS,CACT,kBACa,OAAO,IACjB,IAAI,EACP,CACF,CAAC;AACH,CAAC,CAAC,CAAC;AAEU,QAAA,SAAS,GAAG,IAAA,wBAAa,EACrC,KAAK,EACL,yMAAyM,EACzM,wGAAwG,CACxG,CAAC;AAEW,QAAA,WAAW,GAAG,IAAA,wBAAa,EACvC,KAAK,EACL,4CAA4C,CAC5C,CAAC;AAEW,QAAA,SAAS,GAAG,IAAA,wBAAa,EACrC,KAAK,EACL,sEAAsE,CACtE,CAAC;AAEW,QAAA,UAAU,GAAG,IAAA,wBAAa,EACtC,KAAK,EACL,kHAAkH,CAClH,CAAC;AAEW,QAAA,WAAW,GAAG,IAAA,wBAAa,EACvC,KAAK,EACL,kEAAkE,CAClE,CAAC;AAEW,QAAA,QAAQ,GAAG,IAAA,wBAAa,EACpC,KAAK,EACL,kEAAkE,CAClE,CAAC;AAEW,QAAA,QAAQ,GAAG,IAAA,wBAAa,EACpC,KAAK,EACL,6EAA6E,EAC7E,gFAAgF,CAChF,CAAC"}
@@ -16,3 +16,7 @@ declare const meta: {
16
16
  export default meta;
17
17
  type Story = StoryObj<typeof CardRoot>;
18
18
  export declare const Default: Story;
19
+ export declare const Compact: Story;
20
+ export declare const NonInteractive: Story;
21
+ export declare const AsChild: Story;
22
+ export declare const AsChildNonInteractive: Story;
@@ -1,7 +1,7 @@
1
1
  // @unocss-include
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.Default = void 0;
4
+ exports.AsChildNonInteractive = exports.AsChild = exports.NonInteractive = exports.Compact = exports.Default = void 0;
5
5
  const jsx_runtime_1 = require("react/jsx-runtime");
6
6
  const Card_js_1 = require("./Card.js");
7
7
  const button_js_1 = require("../button.js");
@@ -16,6 +16,18 @@ const meta = {
16
16
  };
17
17
  exports.default = meta;
18
18
  exports.Default = {
19
- render: () => ((0, jsx_runtime_1.jsxs)(Card_js_1.CardRoot, { children: [(0, jsx_runtime_1.jsx)(Card_js_1.CardMain, { children: (0, jsx_runtime_1.jsx)(Card_js_1.CardTitle, { children: "Card Title" }) }), (0, jsx_runtime_1.jsx)(Card_js_1.CardFooter, { children: (0, jsx_runtime_1.jsxs)(Card_js_1.CardActions, { children: [(0, jsx_runtime_1.jsx)(button_js_1.Button, Object.assign({ size: "small" }, { children: "Button" })), (0, jsx_runtime_1.jsx)(button_js_1.Button, Object.assign({ size: "icon", color: "ghost" }, { children: (0, jsx_runtime_1.jsx)(icon_js_1.Icon, { name: "placeholder" }) }))] }) })] })),
19
+ render: () => ((0, jsx_runtime_1.jsxs)(Card_js_1.CardRoot, { children: [(0, jsx_runtime_1.jsxs)(Card_js_1.CardMain, Object.assign({ onClick: () => alert('clicked') }, { children: [(0, jsx_runtime_1.jsx)(Card_js_1.CardTitle, { children: "Card Title" }), (0, jsx_runtime_1.jsx)(Card_js_1.CardContent, { children: "Other stuff" })] })), (0, jsx_runtime_1.jsx)(Card_js_1.CardFooter, { children: (0, jsx_runtime_1.jsxs)(Card_js_1.CardActions, { children: [(0, jsx_runtime_1.jsx)(button_js_1.Button, Object.assign({ size: "small" }, { children: "Button" })), (0, jsx_runtime_1.jsx)(button_js_1.Button, Object.assign({ size: "icon", color: "ghost" }, { children: (0, jsx_runtime_1.jsx)(icon_js_1.Icon, { name: "placeholder" }) }))] }) })] })),
20
+ };
21
+ exports.Compact = {
22
+ render: () => ((0, jsx_runtime_1.jsxs)(Card_js_1.CardRoot, { children: [(0, jsx_runtime_1.jsx)(Card_js_1.CardMain, Object.assign({ compact: true }, { children: (0, jsx_runtime_1.jsx)(Card_js_1.CardTitle, { children: "Card Title" }) })), (0, jsx_runtime_1.jsx)(Card_js_1.CardFooter, { children: (0, jsx_runtime_1.jsxs)(Card_js_1.CardActions, { children: [(0, jsx_runtime_1.jsx)(button_js_1.Button, Object.assign({ size: "small" }, { children: "Button" })), (0, jsx_runtime_1.jsx)(button_js_1.Button, Object.assign({ size: "icon", color: "ghost" }, { children: (0, jsx_runtime_1.jsx)(icon_js_1.Icon, { name: "placeholder" }) }))] }) })] })),
23
+ };
24
+ exports.NonInteractive = {
25
+ render: () => ((0, jsx_runtime_1.jsxs)(Card_js_1.CardRoot, { children: [(0, jsx_runtime_1.jsxs)(Card_js_1.CardMain, { children: [(0, jsx_runtime_1.jsx)(Card_js_1.CardTitle, { children: "Card Title" }), (0, jsx_runtime_1.jsx)(Card_js_1.CardContent, { children: "Other stuff" })] }), (0, jsx_runtime_1.jsx)(Card_js_1.CardFooter, { children: (0, jsx_runtime_1.jsxs)(Card_js_1.CardActions, { children: [(0, jsx_runtime_1.jsx)(button_js_1.Button, Object.assign({ size: "small" }, { children: "Button" })), (0, jsx_runtime_1.jsx)(button_js_1.Button, Object.assign({ size: "icon", color: "ghost" }, { children: (0, jsx_runtime_1.jsx)(icon_js_1.Icon, { name: "placeholder" }) }))] }) })] })),
26
+ };
27
+ exports.AsChild = {
28
+ render: () => ((0, jsx_runtime_1.jsxs)(Card_js_1.CardRoot, { children: [(0, jsx_runtime_1.jsx)(Card_js_1.CardMain, Object.assign({ asChild: true }, { children: (0, jsx_runtime_1.jsxs)("a", Object.assign({ href: "#here" }, { children: [(0, jsx_runtime_1.jsx)(Card_js_1.CardTitle, { children: "Card Title" }), (0, jsx_runtime_1.jsx)(Card_js_1.CardContent, { children: "Other stuff" })] })) })), (0, jsx_runtime_1.jsx)(Card_js_1.CardFooter, { children: (0, jsx_runtime_1.jsxs)(Card_js_1.CardActions, { children: [(0, jsx_runtime_1.jsx)(button_js_1.Button, Object.assign({ size: "small" }, { children: "Button" })), (0, jsx_runtime_1.jsx)(button_js_1.Button, Object.assign({ size: "icon", color: "ghost" }, { children: (0, jsx_runtime_1.jsx)(icon_js_1.Icon, { name: "placeholder" }) }))] }) })] })),
29
+ };
30
+ exports.AsChildNonInteractive = {
31
+ render: () => ((0, jsx_runtime_1.jsxs)(Card_js_1.CardRoot, { children: [(0, jsx_runtime_1.jsx)(Card_js_1.CardMain, Object.assign({ asChild: true, nonInteractive: true }, { children: (0, jsx_runtime_1.jsxs)("button", { children: [(0, jsx_runtime_1.jsx)(Card_js_1.CardTitle, { children: "Card Title" }), (0, jsx_runtime_1.jsx)(Card_js_1.CardContent, { children: "Other stuff" })] }) })), (0, jsx_runtime_1.jsx)(Card_js_1.CardFooter, { children: (0, jsx_runtime_1.jsxs)(Card_js_1.CardActions, { children: [(0, jsx_runtime_1.jsx)(button_js_1.Button, Object.assign({ size: "small" }, { children: "Button" })), (0, jsx_runtime_1.jsx)(button_js_1.Button, Object.assign({ size: "icon", color: "ghost" }, { children: (0, jsx_runtime_1.jsx)(icon_js_1.Icon, { name: "placeholder" }) }))] }) })] })),
20
32
  };
21
33
  //# sourceMappingURL=Card.stories.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Card.stories.js","sourceRoot":"","sources":["../../../../src/components/card/Card.stories.tsx"],"names":[],"mappings":";;;;AACA,uCAMmB;AACnB,4CAAsC;AACtC,wCAAkC;AAElC,MAAM,IAAI,GAAG;IACZ,KAAK,EAAE,MAAM;IACb,SAAS,EAAE,kBAAQ;IACnB,QAAQ,EAAE,EAAE;IACZ,UAAU,EAAE;QACX,QAAQ,EAAE,EAAE,QA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ChC,uBAAC,cAAI,IAAC,IAAI,EAAC,aAAa,GAAG,IACnB,IACI,GACF,IACH,CACX;CACD,CAAC;AAEW,QAAA,qBAAqB,GAAU;IAC3C,MAAM,EAAE,GAAG,EAAE,CAAC,CACb,wBAAC,kBAAQ,eACR,uBAAC,kBAAQ,kBAAC,OAAO,QAAC,cAAc,sBAC/B,+CACC,uBAAC,mBAAS,6BAAuB,EACjC,uBAAC,qBAAW,8BAA0B,IAC9B,IACC,EACX,uBAAC,oBAAU,cACV,wBAAC,qBAAW,eACX,uBAAC,kBAAM,kBAAC,IAAI,EAAC,OAAO,4BAAgB,EACpC,uBAAC,kBAAM,kBAAC,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,OAAO,gBAChC,uBAAC,cAAI,IAAC,IAAI,EAAC,aAAa,GAAG,IACnB,IACI,GACF,IACH,CACX;CACD,CAAC"}
@@ -8,10 +8,15 @@ export declare const CardMain: import("react").ForwardRefExoticComponent<{
8
8
  onClick?: ((ev: MouseEvent) => void) | undefined;
9
9
  children?: ReactNode;
10
10
  compact?: boolean | undefined;
11
+ /** forces non-interactive version */
12
+ nonInteractive?: boolean | undefined;
11
13
  } & import("react").RefAttributes<any>>;
12
14
  export declare const CardTitle: import("react").FunctionComponent<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
13
15
  ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
14
16
  }>;
17
+ export declare const CardContent: import("react").FunctionComponent<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
18
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
19
+ }>;
15
20
  export declare const CardImage: import("react").FunctionComponent<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
16
21
  ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
17
22
  }>;
@@ -17,11 +17,14 @@ import { Slot } from '@radix-ui/react-slot';
17
17
  import classNames from 'clsx';
18
18
  export const CardRoot = withClassName('div', 'layer-components:flex layer-components:flex-col layer-components:border-light layer-components:rounded-lg layer-components:text-lg layer-components:overflow-hidden layer-components:h-max-content layer-components:relative layer-components:bg-gray-1 layer-components:text-black');
19
19
  export const CardMain = forwardRef(function CardMain(_a, ref) {
20
- var { asChild, className, compact } = _a, rest = __rest(_a, ["asChild", "className", "compact"]);
21
- const Comp = asChild ? Slot : 'button';
22
- return (_jsx(Comp, Object.assign({ ref: ref, className: classNames('layer-components:flex layer-components:flex-col layer-components:gap-1 layer-components:cursor-pointer layer-components:transition layer-components:p-4 layer-components:pb-2 layer-components:flex-1 layer-components:relative layer-components:z-1 layer-components:bg-transparent layer-components:border-none layer-components:text-start layer-components:text-inherit', 'layer-components:hover:bg-lightBlend layer-components:hover:color-black', 'layer-components:md:pt-4', compact && 'layer-variants:p-1 layer-variants:bg-white layer-variants:gap-0', className), "data-compact": compact }, rest)));
20
+ var { asChild, className, compact, nonInteractive } = _a, rest = __rest(_a, ["asChild", "className", "compact", "nonInteractive"]);
21
+ const isInteractive = !nonInteractive && (!!asChild || !!rest.onClick);
22
+ const Comp = asChild ? Slot : isInteractive ? 'button' : 'div';
23
+ return (_jsx(Comp, Object.assign({ ref: ref, className: classNames('layer-components:flex layer-components:flex-col layer-components:gap-1 layer-components:transition layer-components:p-4 layer-components:pb-2 layer-components:flex-1 layer-components:relative layer-components:z-1 layer-components:bg-transparent layer-components:border-none layer-components:text-start layer-components:text-inherit layer-components:text-sm', 'layer-components:md:pt-4', compact && 'layer-variants:p-1 layer-variants:bg-white layer-variants:gap-0', isInteractive &&
24
+ 'layer-components:cursor-pointer layer-components:hover:bg-lightBlend layer-components:hover:color-black', className), "data-compact": compact }, rest)));
23
25
  });
24
26
  export const CardTitle = withClassName('div', 'layer-components:flex layer-components:flex-col layer-components:gap-1 layer-components:mt-auto layer-components:bg-white layer-components:p-2 layer-components:rounded-lg layer-components:w-auto layer-components:mr-auto layer-components:border layer-components:border-solid layer-components:border-grayDarkBlend layer-components:text-md layer-components:max-h-80px layer-components:overflow-hidden layer-components:text-ellipsis layer-components:max-w-full layer-components:text-inherit', '[data-compact=true]>&:(bg-transparent border-none p-2 whitespace-nowrap text-ellipsis overflow-hidden)');
27
+ export const CardContent = withClassName('div', 'layer-components:flex layer-components:flex-col layer-components:gap-1 layer-components:p-2');
25
28
  export const CardImage = withClassName('div', 'layer-components:absolute layer-components:z-0 layer-components:right-0 layer-components:top-0 layer-components:bottom-0 layer-components:w-full layer-components:h-full');
26
29
  export const CardFooter = withClassName('div', 'layer-components:flex layer-components:flex-row layer-components:p-2 layer-components:bg-white layer-components:relative layer-components:z-1 layer-components:border-0 layer-components:border-t layer-components:border-t-grayDarkBlend layer-components:border-solid');
27
30
  export const CardActions = withClassName('div', 'layer-components:ml-0 layer-components:mr-auto layer-components:flex layer-components:flex-row layer-components:gap-1 layer-components:items-center');
@@ -1 +1 @@
1
- {"version":3,"file":"Card.js","sourceRoot":"","sources":["../../../../src/components/card/Card.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAyB,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,UAAU,MAAM,MAAM,CAAC;AAE9B,MAAM,CAAC,MAAM,QAAQ,GAAG,aAAa,CACpC,KAAK,EACL,8HAA8H,CAC9H,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAShC,SAAS,QAAQ,CAAC,EAAwC,EAAE,GAAG;QAA7C,EAAE,OAAO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C,KAAK,EACL,6EAA6E,EAC7E,gFAAgF,CAChF,CAAC"}
@@ -16,3 +16,7 @@ declare const meta: {
16
16
  export default meta;
17
17
  type Story = StoryObj<typeof CardRoot>;
18
18
  export declare const Default: Story;
19
+ export declare const Compact: Story;
20
+ export declare const NonInteractive: Story;
21
+ export declare const AsChild: Story;
22
+ export declare const AsChildNonInteractive: Story;
@@ -1,6 +1,6 @@
1
1
  // @unocss-include
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { CardActions, CardFooter, CardMain, CardRoot, CardTitle, } from './Card.js';
3
+ import { CardActions, CardContent, CardFooter, CardMain, CardRoot, CardTitle, } from './Card.js';
4
4
  import { Button } from '../button.js';
5
5
  import { Icon } from '../icon.js';
6
6
  const meta = {
@@ -13,6 +13,18 @@ const meta = {
13
13
  };
14
14
  export default meta;
15
15
  export const Default = {
16
- render: () => (_jsxs(CardRoot, { children: [_jsx(CardMain, { children: _jsx(CardTitle, { children: "Card Title" }) }), _jsx(CardFooter, { children: _jsxs(CardActions, { children: [_jsx(Button, Object.assign({ size: "small" }, { children: "Button" })), _jsx(Button, Object.assign({ size: "icon", color: "ghost" }, { children: _jsx(Icon, { name: "placeholder" }) }))] }) })] })),
16
+ render: () => (_jsxs(CardRoot, { children: [_jsxs(CardMain, Object.assign({ onClick: () => alert('clicked') }, { children: [_jsx(CardTitle, { children: "Card Title" }), _jsx(CardContent, { children: "Other stuff" })] })), _jsx(CardFooter, { children: _jsxs(CardActions, { children: [_jsx(Button, Object.assign({ size: "small" }, { children: "Button" })), _jsx(Button, Object.assign({ size: "icon", color: "ghost" }, { children: _jsx(Icon, { name: "placeholder" }) }))] }) })] })),
17
+ };
18
+ export const Compact = {
19
+ render: () => (_jsxs(CardRoot, { children: [_jsx(CardMain, Object.assign({ compact: true }, { children: _jsx(CardTitle, { children: "Card Title" }) })), _jsx(CardFooter, { children: _jsxs(CardActions, { children: [_jsx(Button, Object.assign({ size: "small" }, { children: "Button" })), _jsx(Button, Object.assign({ size: "icon", color: "ghost" }, { children: _jsx(Icon, { name: "placeholder" }) }))] }) })] })),
20
+ };
21
+ export const NonInteractive = {
22
+ render: () => (_jsxs(CardRoot, { children: [_jsxs(CardMain, { children: [_jsx(CardTitle, { children: "Card Title" }), _jsx(CardContent, { children: "Other stuff" })] }), _jsx(CardFooter, { children: _jsxs(CardActions, { children: [_jsx(Button, Object.assign({ size: "small" }, { children: "Button" })), _jsx(Button, Object.assign({ size: "icon", color: "ghost" }, { children: _jsx(Icon, { name: "placeholder" }) }))] }) })] })),
23
+ };
24
+ export const AsChild = {
25
+ render: () => (_jsxs(CardRoot, { children: [_jsx(CardMain, Object.assign({ asChild: true }, { children: _jsxs("a", Object.assign({ href: "#here" }, { children: [_jsx(CardTitle, { children: "Card Title" }), _jsx(CardContent, { children: "Other stuff" })] })) })), _jsx(CardFooter, { children: _jsxs(CardActions, { children: [_jsx(Button, Object.assign({ size: "small" }, { children: "Button" })), _jsx(Button, Object.assign({ size: "icon", color: "ghost" }, { children: _jsx(Icon, { name: "placeholder" }) }))] }) })] })),
26
+ };
27
+ export const AsChildNonInteractive = {
28
+ render: () => (_jsxs(CardRoot, { children: [_jsx(CardMain, Object.assign({ asChild: true, nonInteractive: true }, { children: _jsxs("button", { children: [_jsx(CardTitle, { children: "Card Title" }), _jsx(CardContent, { children: "Other stuff" })] }) })), _jsx(CardFooter, { children: _jsxs(CardActions, { children: [_jsx(Button, Object.assign({ size: "small" }, { children: "Button" })), _jsx(Button, Object.assign({ size: "icon", color: "ghost" }, { children: _jsx(Icon, { name: "placeholder" }) }))] }) })] })),
17
29
  };
18
30
  //# sourceMappingURL=Card.stories.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Card.stories.js","sourceRoot":"","sources":["../../../../src/components/card/Card.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EACN,WAAW,EACX,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,SAAS,GACT,MAAM,WAAW,CAAC;AACnB,OAA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AAU;IAC7B,MAAM,EAAE,GAAG,EAAE,CAAC,CACb,MAAC,QAAQ,eACR,KAAC,QAAQ,kBAAC,OAAO,sBAChB,2BAAG,IAAI,EAAC,OAAO,iBACd,KAAC,SAAS,6BAAuB,EACjC,KAAC,WAAW,8BAA0B,KACnC,IACM,EACX,KAAC,UAAU,cACV,MAAC,WAAW,eACX,KAAC,MAAM,kBAAC,IAAI,EAAC,OAAO,4BAAgB,EACpC,KAAC,MAAM,kBAAC,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,OAAO,gBAChC,KAAC,IAAI,IAAC,IAAI,EAAC,aAAa,GAAG,IACnB,IACI,GACF,IACH,CACX;CACD,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAU;IAC3C,MAAM,EAAE,GAAG,EAAE,CAAC,CACb,MAAC,QAAQ,eACR,KAAC,QAAQ,kBAAC,OAAO,QAAC,cAAc,sBAC/B,6BACC,KAAC,SAAS,6BAAuB,EACjC,KAAC,WAAW,8BAA0B,IAC9B,IACC,EACX,KAAC,UAAU,cACV,MAAC,WAAW,eACX,KAAC,MAAM,kBAAC,IAAI,EAAC,OAAO,4BAAgB,EACpC,KAAC,MAAM,kBAAC,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,OAAO,gBAChC,KAAC,IAAI,IAAC,IAAI,EAAC,aAAa,GAAG,IACnB,IACI,GACF,IACH,CACX;CACD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@a-type/ui",
3
- "version": "0.6.14",
3
+ "version": "0.6.16",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "/dist",
@@ -1,6 +1,7 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
2
  import {
3
3
  CardActions,
4
+ CardContent,
4
5
  CardFooter,
5
6
  CardMain,
6
7
  CardRoot,
@@ -23,10 +24,90 @@ export default meta;
23
24
  type Story = StoryObj<typeof CardRoot>;
24
25
 
25
26
  export const Default: Story = {
27
+ render: () => (
28
+ <CardRoot>
29
+ <CardMain onClick={() => alert('clicked')}>
30
+ <CardTitle>Card Title</CardTitle>
31
+ <CardContent>Other stuff</CardContent>
32
+ </CardMain>
33
+ <CardFooter>
34
+ <CardActions>
35
+ <Button size="small">Button</Button>
36
+ <Button size="icon" color="ghost">
37
+ <Icon name="placeholder" />
38
+ </Button>
39
+ </CardActions>
40
+ </CardFooter>
41
+ </CardRoot>
42
+ ),
43
+ };
44
+
45
+ export const Compact: Story = {
46
+ render: () => (
47
+ <CardRoot>
48
+ <CardMain compact>
49
+ <CardTitle>Card Title</CardTitle>
50
+ </CardMain>
51
+ <CardFooter>
52
+ <CardActions>
53
+ <Button size="small">Button</Button>
54
+ <Button size="icon" color="ghost">
55
+ <Icon name="placeholder" />
56
+ </Button>
57
+ </CardActions>
58
+ </CardFooter>
59
+ </CardRoot>
60
+ ),
61
+ };
62
+
63
+ export const NonInteractive: Story = {
26
64
  render: () => (
27
65
  <CardRoot>
28
66
  <CardMain>
29
67
  <CardTitle>Card Title</CardTitle>
68
+ <CardContent>Other stuff</CardContent>
69
+ </CardMain>
70
+ <CardFooter>
71
+ <CardActions>
72
+ <Button size="small">Button</Button>
73
+ <Button size="icon" color="ghost">
74
+ <Icon name="placeholder" />
75
+ </Button>
76
+ </CardActions>
77
+ </CardFooter>
78
+ </CardRoot>
79
+ ),
80
+ };
81
+
82
+ export const AsChild: Story = {
83
+ render: () => (
84
+ <CardRoot>
85
+ <CardMain asChild>
86
+ <a href="#here">
87
+ <CardTitle>Card Title</CardTitle>
88
+ <CardContent>Other stuff</CardContent>
89
+ </a>
90
+ </CardMain>
91
+ <CardFooter>
92
+ <CardActions>
93
+ <Button size="small">Button</Button>
94
+ <Button size="icon" color="ghost">
95
+ <Icon name="placeholder" />
96
+ </Button>
97
+ </CardActions>
98
+ </CardFooter>
99
+ </CardRoot>
100
+ ),
101
+ };
102
+
103
+ export const AsChildNonInteractive: Story = {
104
+ render: () => (
105
+ <CardRoot>
106
+ <CardMain asChild nonInteractive>
107
+ <button>
108
+ <CardTitle>Card Title</CardTitle>
109
+ <CardContent>Other stuff</CardContent>
110
+ </button>
30
111
  </CardMain>
31
112
  <CardFooter>
32
113
  <CardActions>
@@ -16,17 +16,24 @@ export const CardMain = forwardRef<
16
16
  onClick?: (ev: MouseEvent) => void;
17
17
  children?: ReactNode;
18
18
  compact?: boolean;
19
+ /** forces non-interactive version */
20
+ nonInteractive?: boolean;
19
21
  }
20
- >(function CardMain({ asChild, className, compact, ...rest }, ref) {
21
- const Comp = asChild ? Slot : 'button';
22
+ >(function CardMain(
23
+ { asChild, className, compact, nonInteractive, ...rest },
24
+ ref,
25
+ ) {
26
+ const isInteractive = !nonInteractive && (!!asChild || !!rest.onClick);
27
+ const Comp = asChild ? Slot : isInteractive ? 'button' : 'div';
22
28
  return (
23
29
  <Comp
24
30
  ref={ref}
25
31
  className={classNames(
26
- 'layer-components:(flex flex-col gap-1 cursor-pointer transition p-4 pb-2 flex-1 relative z-1 bg-transparent border-none text-start text-inherit)',
27
- 'layer-components:hover:(bg-lightBlend color-black)',
32
+ 'layer-components:(flex flex-col gap-1 transition p-4 pb-2 flex-1 relative z-1 bg-transparent border-none text-start text-inherit text-sm)',
28
33
  'layer-components:md:pt-4',
29
34
  compact && 'layer-variants:(p-1 bg-white gap-0)',
35
+ isInteractive &&
36
+ 'layer-components:cursor-pointer layer-components:hover:(bg-lightBlend color-black)',
30
37
  className,
31
38
  )}
32
39
  data-compact={compact}
@@ -41,6 +48,11 @@ export const CardTitle = withClassName(
41
48
  '[data-compact=true]>&:(bg-transparent border-none p-2 whitespace-nowrap text-ellipsis overflow-hidden)',
42
49
  );
43
50
 
51
+ export const CardContent = withClassName(
52
+ 'div',
53
+ 'layer-components:(flex flex-col gap-1 p-2)',
54
+ );
55
+
44
56
  export const CardImage = withClassName(
45
57
  'div',
46
58
  'layer-components:(absolute z-0 right-0 top-0 bottom-0 w-full h-full)',