@spark-ui/components 17.10.2-beta.0 → 17.10.2
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/card/Type.d.ts +1 -0
- package/dist/card/index.js +1 -1
- package/dist/card/index.js.map +1 -1
- package/dist/card/index.mjs +27 -16
- package/dist/card/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/card/Type.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
2
2
|
import { ComponentProps, ReactNode } from 'react';
|
|
3
3
|
export declare const typeStyles: (props?: ({
|
|
4
4
|
intent?: "main" | "alert" | "support" | "accent" | "success" | "info" | "neutral" | "danger" | "surface" | null | undefined;
|
|
5
|
+
design?: "outlined" | "tinted" | null | undefined;
|
|
5
6
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
6
7
|
type TypeStylesProps = VariantProps<typeof typeStyles>;
|
|
7
8
|
export interface TypeProps extends ComponentProps<'header'>, TypeStylesProps {
|
package/dist/card/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../chunk-C91j1N6u.js`);const e=require(`../slot/index.js`);let t=require(`class-variance-authority`),n=require(`react`),r=require(`react/jsx-runtime`),i=require(`@spark-ui/internal-utils`);var a=(0,t.cva)([`group relative bg-clip-padding default:rounded-lg focus-visible:u-outline`,`disabled:opacity-dim-3 disabled:cursor-not-allowed`],{variants:{design:{outlined:[`border-sm`],tinted:[]},intent:(0,i.makeVariants)({main:[],support:[],accent:[],success:[],alert:[],danger:[],info:[],neutral:[],surface:[]})},compoundVariants:[{intent:`main`,design:`outlined`,class:(0,i.tw)([`border-main`])},{intent:`support`,design:`outlined`,class:(0,i.tw)([`border-support`])},{intent:`accent`,design:`outlined`,class:(0,i.tw)([`border-accent`])},{intent:`success`,design:`outlined`,class:(0,i.tw)([`border-success`])},{intent:`alert`,design:`outlined`,class:(0,i.tw)([`border-alert`])},{intent:`danger`,design:`outlined`,class:(0,i.tw)([`border-error`])},{intent:`info`,design:`outlined`,class:(0,i.tw)([`border-info`])},{intent:`neutral`,design:`outlined`,class:(0,i.tw)([`border-neutral`])},{intent:`surface`,design:`outlined`,class:(0,i.tw)([`border-outline`])}],defaultVariants:{design:`outlined`,intent:`surface`}}),o=(0,n.createContext)(void 0),s=()=>{let e=(0,n.useContext)(o);if(!e)throw Error(`useCardContext must be used within a Card component`);return e},c=[`onClick`,`onMouseDown`,`onMouseUp`,`onMouseEnter`,`onMouseLeave`,`onMouseMove`,`onMouseOver`,`onMouseOut`,`onDoubleClick`,`onContextMenu`],l=e=>{let t=!1,r=e=>{t||n.Children.forEach(e,e=>{if(!t&&(0,n.isValidElement)(e)){if(typeof e.type==`function`&&e.type.displayName===`Card.Type`){t=!0;return}if(e.props&&typeof e.props==`object`&&`children`in e.props){let t=e.props.children;t!=null&&r(t)}}})};return r(e),t},u=(e,t,r)=>{if(c.some(e=>e in r))return!0;if(!t)return!1;let i=n.Children.only(e);if(!(0,n.isValidElement)(i))return!1;if(typeof i.type==`string`&&[`a`,`button`].includes(i.type))return!0;let a=i.props;return c.some(e=>e in a)},d=({children:t,design:n=`outlined`,intent:i=`surface`,inset:s=!1,asChild:c,className:d,ref:f,...p})=>{let m=c?e.Slot:`div`,h=l(t),g=u(t,c,p);return(0,r.jsx)(o.Provider,{value:{design:n,intent:i,hasType:h,inset:s,isInteractive:g},children:(0,r.jsx)(m,{"data-spark-component":`card`,"data-interactive":g,ref:f,className:a({className:d,design:n,intent:i}),...p,children:t})})};d.displayName=`Card`;var f=(0,t.cva)([`relative
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../chunk-C91j1N6u.js`);const e=require(`../slot/index.js`);let t=require(`class-variance-authority`),n=require(`react`),r=require(`react/jsx-runtime`),i=require(`@spark-ui/internal-utils`);var a=(0,t.cva)([`group relative bg-clip-padding default:rounded-lg focus-visible:u-outline`,`disabled:opacity-dim-3 disabled:cursor-not-allowed`],{variants:{design:{outlined:[`border-sm`],tinted:[]},intent:(0,i.makeVariants)({main:[],support:[],accent:[],success:[],alert:[],danger:[],info:[],neutral:[],surface:[]})},compoundVariants:[{intent:`main`,design:`outlined`,class:(0,i.tw)([`border-main`])},{intent:`support`,design:`outlined`,class:(0,i.tw)([`border-support`])},{intent:`accent`,design:`outlined`,class:(0,i.tw)([`border-accent`])},{intent:`success`,design:`outlined`,class:(0,i.tw)([`border-success`])},{intent:`alert`,design:`outlined`,class:(0,i.tw)([`border-alert`])},{intent:`danger`,design:`outlined`,class:(0,i.tw)([`border-error`])},{intent:`info`,design:`outlined`,class:(0,i.tw)([`border-info`])},{intent:`neutral`,design:`outlined`,class:(0,i.tw)([`border-neutral`])},{intent:`surface`,design:`outlined`,class:(0,i.tw)([`border-outline`])}],defaultVariants:{design:`outlined`,intent:`surface`}}),o=(0,n.createContext)(void 0),s=()=>{let e=(0,n.useContext)(o);if(!e)throw Error(`useCardContext must be used within a Card component`);return e},c=[`onClick`,`onMouseDown`,`onMouseUp`,`onMouseEnter`,`onMouseLeave`,`onMouseMove`,`onMouseOver`,`onMouseOut`,`onDoubleClick`,`onContextMenu`],l=e=>{let t=!1,r=e=>{t||n.Children.forEach(e,e=>{if(!t&&(0,n.isValidElement)(e)){if(typeof e.type==`function`&&e.type.displayName===`Card.Type`){t=!0;return}if(e.props&&typeof e.props==`object`&&`children`in e.props){let t=e.props.children;t!=null&&r(t)}}})};return r(e),t},u=(e,t,r)=>{if(c.some(e=>e in r))return!0;if(!t)return!1;let i=n.Children.only(e);if(!(0,n.isValidElement)(i))return!1;if(typeof i.type==`string`&&[`a`,`button`].includes(i.type))return!0;let a=i.props;return c.some(e=>e in a)},d=({children:t,design:n=`outlined`,intent:i=`surface`,inset:s=!1,asChild:c,className:d,ref:f,...p})=>{let m=c?e.Slot:`div`,h=l(t),g=u(t,c,p);return(0,r.jsx)(o.Provider,{value:{design:n,intent:i,hasType:h,inset:s,isInteractive:g},children:(0,r.jsx)(m,{"data-spark-component":`card`,"data-interactive":g,ref:f,className:a({className:d,design:n,intent:i}),...p,children:t})})};d.displayName=`Card`;var f=(0,t.cva)([`relative default:rounded-lg w-full focus-visible:u-outline`,`default:transition-colors default:duration-200 ease-linear`],{variants:{inset:{false:[`default:p-lg`]},design:{outlined:[`default:bg-surface group-focus:bg-surface-hovered group-not-disabled:group-data-[interactive=true]:group-hover:bg-surface-hovered`],tinted:[]},hasType:{true:[`rounded-t-0`]},intent:(0,i.makeVariants)({main:[],support:[],accent:[],success:[],alert:[],danger:[],info:[],neutral:[],surface:[]})},compoundVariants:[{intent:`main`,design:`tinted`,class:(0,i.tw)([`bg-main-container text-on-main-container group-focus:bg-main-container-hovered`,`group-not-disabled:group-data-[interactive=true]:group-hover:bg-main-container-hovered`])},{intent:`support`,design:`tinted`,class:(0,i.tw)([`bg-support-container text-on-support-container group-focus:bg-support-container-hovered`,`group-not-disabled:group-data-[interactive=true]:group-hover:bg-support-container-hovered`])},{intent:`accent`,design:`tinted`,class:(0,i.tw)([`bg-accent-container text-on-accent-container group-focus:bg-accent-container-hovered`,`group-not-disabled:group-data-[interactive=true]:group-hover:bg-accent-container-hovered`])},{intent:`success`,design:`tinted`,class:(0,i.tw)([`bg-success-container text-on-success-container group-focus:bg-success-container-hovered`,`group-not-disabled:group-data-[interactive=true]:group-hover:bg-success-container-hovered`])},{intent:`alert`,design:`tinted`,class:(0,i.tw)([`bg-alert-container text-on-alert-container group-focus:bg-alert-container-hovered`,`group-not-disabled:group-data-[interactive=true]:group-hover:bg-alert-container-hovered`])},{intent:`danger`,design:`tinted`,class:(0,i.tw)([`bg-error-container text-on-error-container group-focus:bg-error-container-hovered`,`group-not-disabled:group-data-[interactive=true]:group-hover:bg-error-container-hovered`])},{intent:`info`,design:`tinted`,class:(0,i.tw)([`bg-info-container text-on-info-container group-focus:bg-info-container-hovered`,`group-not-disabled:group-data-[interactive=true]:group-hover:bg-info-container-hovered`])},{intent:`neutral`,design:`tinted`,class:(0,i.tw)([`bg-neutral-container text-on-neutral-container group-focus:bg-neutral-container-hovered`,`group-not-disabled:group-data-[interactive=true]:group-hover:bg-neutral-container-hovered`])},{intent:`surface`,design:`tinted`,class:(0,i.tw)([`bg-surface text-on-surface group-focus:bg-surface-hovered`,`group-not-disabled:group-data-[interactive=true]:group-hover:bg-surface-hovered`])}],defaultVariants:{design:`outlined`,intent:`surface`,inset:!1,hasType:!0}}),p=({children:t,inset:n,asChild:i,className:a,ref:o,...c})=>{let l=i?e.Slot:`div`,{design:u,intent:d,hasType:p}=s();return(0,r.jsx)(l,{"data-spark-component":`card-content`,ref:o,className:f({className:a,design:u,intent:d,inset:n,hasType:p}),...c,children:t})};p.displayName=`Content`;var m=(0,t.cva)([`rounded-t-lg default:text-body-2-highlight`,`default:text-center`,`min-h-sz-32`,`px-md`,`py-xs`,`flex items-center justify-center`,`whitespace-normal break-words`],{variants:{intent:{main:[`bg-main text-on-main`],support:[`bg-support text-on-support`],accent:[`bg-accent text-on-accent`],success:[`bg-success text-on-success`],alert:[`bg-alert text-on-alert`],danger:[`bg-error text-on-error`],info:[`bg-info text-on-info`],neutral:[`bg-neutral text-on-neutral`],surface:[`bg-surface-inverse text-on-surface-inverse`]},design:{outlined:[`-mx-px -mt-px`],tinted:[]}},defaultVariants:{intent:`main`,design:`outlined`}}),h=({intent:e,children:t,...n})=>{let i=s(),a=e??i.intent??`main`;return t?(0,r.jsx)(`header`,{className:m({intent:a,design:i.design}),...n,children:t}):null};h.displayName=`Card.Type`;var g=Object.assign(d,{Content:p,Type:h});g.displayName=`Card`,p.displayName=`Card.Content`,h.displayName=`Card.Type`,exports.Card=g;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/card/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/card/Card.styles.tsx","../../src/card/context.tsx","../../src/card/utils.ts","../../src/card/Card.tsx","../../src/card/Content.styles.tsx","../../src/card/Content.tsx","../../src/card/Type.tsx","../../src/card/index.ts"],"sourcesContent":["import { makeVariants, tw } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const cardStyles = cva(\n [\n 'group relative bg-clip-padding default:rounded-lg focus-visible:u-outline',\n 'disabled:opacity-dim-3 disabled:cursor-not-allowed',\n ],\n {\n variants: {\n design: {\n outlined: ['border-sm'],\n tinted: [],\n },\n /**\n * Color scheme of the button.\n */\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'success', 'alert', 'danger', 'info', 'neutral', 'surface']\n >({\n main: [],\n support: [],\n accent: [],\n success: [],\n alert: [],\n danger: [],\n info: [],\n neutral: [],\n surface: [],\n }),\n },\n compoundVariants: [\n // OUTLINED\n { intent: 'main', design: 'outlined', class: tw(['border-main']) },\n { intent: 'support', design: 'outlined', class: tw(['border-support']) },\n { intent: 'accent', design: 'outlined', class: tw(['border-accent']) },\n { intent: 'success', design: 'outlined', class: tw(['border-success']) },\n { intent: 'alert', design: 'outlined', class: tw(['border-alert']) },\n { intent: 'danger', design: 'outlined', class: tw(['border-error']) },\n { intent: 'info', design: 'outlined', class: tw(['border-info']) },\n { intent: 'neutral', design: 'outlined', class: tw(['border-neutral']) },\n { intent: 'surface', design: 'outlined', class: tw(['border-outline']) },\n ],\n defaultVariants: {\n design: 'outlined',\n intent: 'surface',\n },\n }\n)\n\nexport type CardStylesProps = VariantProps<typeof cardStyles>\n","import { createContext, useContext } from 'react'\n\nimport type { CardStylesProps } from './Card.styles'\n\nexport interface CardContextValue {\n design: CardStylesProps['design']\n intent: CardStylesProps['intent']\n hasType: boolean\n inset: boolean\n isInteractive: boolean\n}\n\nconst CardContext = createContext<CardContextValue | undefined>(undefined)\n\nexport const useCardContext = () => {\n const context = useContext(CardContext)\n if (!context) {\n throw new Error('useCardContext must be used within a Card component')\n }\n\n return context\n}\n\nexport { CardContext }\n","import { Children, isValidElement, ReactNode } from 'react'\n\nconst MOUSE_EVENTS = [\n 'onClick',\n 'onMouseDown',\n 'onMouseUp',\n 'onMouseEnter',\n 'onMouseLeave',\n 'onMouseMove',\n 'onMouseOver',\n 'onMouseOut',\n 'onDoubleClick',\n 'onContextMenu',\n] as const\n\nexport const hasType = (children: ReactNode): boolean => {\n let typeFound = false\n\n const searchForType = (node: ReactNode): void => {\n if (typeFound) return\n\n Children.forEach(node, child => {\n if (typeFound) return\n\n if (isValidElement(child)) {\n const isTypeComponent =\n typeof child.type === 'function' &&\n (child.type as { displayName?: string }).displayName === 'Card.Type'\n\n if (isTypeComponent) {\n typeFound = true\n\n return\n }\n\n const hasChildren =\n child.props && typeof child.props === 'object' && 'children' in child.props\n\n if (hasChildren) {\n const childChildren = (child.props as { children: ReactNode }).children\n if (childChildren !== undefined && childChildren !== null) {\n searchForType(childChildren)\n }\n }\n }\n })\n }\n\n searchForType(children)\n\n return typeFound\n}\n\nexport const isInteractive = (\n children: ReactNode,\n asChild: boolean | undefined,\n props: Record<string, any>\n): boolean => {\n const hasMouseEventHandlers = MOUSE_EVENTS.some(event => event in props)\n\n if (hasMouseEventHandlers) {\n return true\n }\n\n if (!asChild) {\n return false\n }\n\n const child = Children.only(children)\n\n if (!isValidElement(child)) {\n return false\n }\n\n const interactiveElements = ['a', 'button']\n const isInteractiveElement =\n typeof child.type === 'string' && interactiveElements.includes(child.type)\n\n if (isInteractiveElement) {\n return true\n }\n\n const childProps = child.props as Record<string, any>\n const hasChildEventHandlers = MOUSE_EVENTS.some(event => event in childProps)\n\n return hasChildEventHandlers\n}\n","import { ComponentProps } from 'react'\n\nimport { Slot } from '../slot'\nimport { cardStyles, type CardStylesProps } from './Card.styles'\nimport { CardContext } from './context'\nimport { hasType, isInteractive } from './utils'\n\nexport interface CardProps extends ComponentProps<'div'>, CardStylesProps {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * Whether the card should have an inset padding.\n */\n inset?: boolean\n}\n\nexport const Card = ({\n children,\n design = 'outlined',\n intent = 'surface',\n inset = false,\n asChild,\n className,\n ref,\n ...props\n}: CardProps) => {\n const Component = asChild ? Slot : 'div'\n const typeDetected = hasType(children)\n const interactiveDetected = isInteractive(children, asChild, props)\n\n return (\n <CardContext.Provider\n value={{\n design,\n intent,\n hasType: typeDetected,\n inset,\n isInteractive: interactiveDetected,\n }}\n >\n <Component\n data-spark-component=\"card\"\n data-interactive={interactiveDetected}\n ref={ref}\n className={cardStyles({\n className,\n design,\n intent,\n })}\n {...props}\n >\n {children}\n </Component>\n </CardContext.Provider>\n )\n}\n\nCard.displayName = 'Card'\n","import { makeVariants, tw } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const contentStyles = cva(\n [\n 'relative h-full default:rounded-lg w-full focus-visible:u-outline',\n 'default:transition-colors default:duration-200 ease-linear',\n ],\n {\n variants: {\n inset: {\n false: ['default:p-lg'],\n },\n design: {\n outlined: [\n 'default:bg-surface group-focus:bg-surface-hovered group-not-disabled:group-data-[interactive=true]:group-hover:bg-surface-hovered',\n ],\n tinted: [],\n },\n hasType: {\n true: ['rounded-t-0'],\n },\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'success', 'alert', 'danger', 'info', 'neutral', 'surface']\n >({\n main: [],\n support: [],\n accent: [],\n success: [],\n alert: [],\n danger: [],\n info: [],\n neutral: [],\n surface: [],\n }),\n },\n compoundVariants: [\n // OUTLINED\n /**\n * Outlined styles are handled by the Card component (parent)\n */\n // TINTED\n {\n intent: 'main',\n design: 'tinted',\n class: tw([\n 'bg-main-container text-on-main-container group-focus:bg-main-container-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-main-container-hovered',\n ]),\n },\n {\n intent: 'support',\n design: 'tinted',\n class: tw([\n 'bg-support-container text-on-support-container group-focus:bg-support-container-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-support-container-hovered',\n ]),\n },\n {\n intent: 'accent',\n design: 'tinted',\n class: tw([\n 'bg-accent-container text-on-accent-container group-focus:bg-accent-container-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-accent-container-hovered',\n ]),\n },\n {\n intent: 'success',\n design: 'tinted',\n class: tw([\n 'bg-success-container text-on-success-container group-focus:bg-success-container-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-success-container-hovered',\n ]),\n },\n {\n intent: 'alert',\n design: 'tinted',\n class: tw([\n 'bg-alert-container text-on-alert-container group-focus:bg-alert-container-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-alert-container-hovered',\n ]),\n },\n {\n intent: 'danger',\n design: 'tinted',\n class: tw([\n 'bg-error-container text-on-error-container group-focus:bg-error-container-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-error-container-hovered',\n ]),\n },\n {\n intent: 'info',\n design: 'tinted',\n class: tw([\n 'bg-info-container text-on-info-container group-focus:bg-info-container-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-info-container-hovered',\n ]),\n },\n {\n intent: 'neutral',\n design: 'tinted',\n class: tw([\n 'bg-neutral-container text-on-neutral-container group-focus:bg-neutral-container-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-neutral-container-hovered',\n ]),\n },\n {\n intent: 'surface',\n design: 'tinted',\n class: tw([\n 'bg-surface text-on-surface group-focus:bg-surface-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-surface-hovered',\n ]),\n },\n ],\n defaultVariants: {\n design: 'outlined',\n intent: 'surface',\n inset: false,\n hasType: true,\n },\n }\n)\n\nexport type ContentStylesProps = VariantProps<typeof contentStyles>\n","import { ComponentProps } from 'react'\n\nimport { Slot } from '../slot'\nimport { contentStyles } from './Content.styles'\nimport { useCardContext } from './context'\n\nexport interface ContentProps extends ComponentProps<'div'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * Whether the card should have an inset padding.\n */\n inset?: boolean\n}\n\n/**\n * The main content area of the card. Renders a <div> element.\n */\nexport const Content = ({ children, inset, asChild, className, ref, ...props }: ContentProps) => {\n const Component = asChild ? Slot : 'div'\n const { design, intent, hasType } = useCardContext()\n\n return (\n <Component\n data-spark-component=\"card-content\"\n ref={ref}\n className={contentStyles({\n className,\n design,\n intent,\n inset,\n hasType,\n })}\n {...props}\n >\n {children}\n </Component>\n )\n}\n\nContent.displayName = 'Content'\n","import { cva, type VariantProps } from 'class-variance-authority'\nimport { type ComponentProps, type ReactNode } from 'react'\n\nimport { useCardContext } from './context'\n\nexport const typeStyles = cva(\n [\n // Base structure\n 'rounded-t-lg default:text-body-2-highlight',\n 'default:text-center',\n\n // Height and layout\n 'min-h-sz-32', // Minimum height same as Backdrop\n 'px-md', // Horizontal padding for text\n 'py-xs', // Vertical padding for text (allows height to grow)\n\n // Layout\n 'flex items-center justify-center', // Vertical centering of text\n 'whitespace-normal break-words', // Allow text wrapping\n\n // Fix border-radius visual gap by overlapping parent border\n '-mx-px -mt-px',\n ],\n {\n variants: {\n intent: {\n main: ['bg-main text-on-main'],\n support: ['bg-support text-on-support'],\n accent: ['bg-accent text-on-accent'],\n success: ['bg-success text-on-success'],\n alert: ['bg-alert text-on-alert'],\n danger: ['bg-error text-on-error'],\n info: ['bg-info text-on-info'],\n neutral: ['bg-neutral text-on-neutral'],\n surface: ['bg-surface-inverse text-on-surface-inverse'],\n },\n },\n defaultVariants: {\n intent: 'main',\n },\n }\n)\n\ntype TypeStylesProps = VariantProps<typeof typeStyles>\n\nexport interface TypeProps extends ComponentProps<'header'>, TypeStylesProps {\n /**\n * The type or category to display (e.g., \"Best seller\", \"New product\")\n */\n children?: ReactNode\n}\n\nexport const Type = ({ intent, children, ...props }: TypeProps) => {\n const cardContext = useCardContext()\n\n // Use intent from props if provided, otherwise inherit from parent Card context\n const resolvedIntent = intent ?? cardContext.intent ?? 'main'\n\n // Don't render if no children provided (for backward compatibility with Backdrop)\n if (!children) {\n return null\n }\n\n return (\n <header className={typeStyles({ intent: resolvedIntent })} {...props}>\n {children}\n </header>\n )\n}\n\nType.displayName = 'Card.Type'\n","import { Card as Root } from './Card'\nimport { Content } from './Content'\nimport { Type } from './Type'\n\n/**\n * A container component that groups related content and actions in a single, styled surface.\n */\nexport const Card: typeof Root & {\n Content: typeof Content\n Type: typeof Type\n} = Object.assign(Root, {\n Content,\n Type,\n})\n\nCard.displayName = 'Card'\nContent.displayName = 'Card.Content'\nType.displayName = 'Card.Type'\n\nexport { type CardProps } from './Card'\nexport { type TypeProps } from './Type'\n"],"mappings":"yQAGA,IAAa,GAAA,EAAA,EAAA,KACX,CACE,4EACA,qDACD,CACD,CACE,SAAU,CACR,OAAQ,CACN,SAAU,CAAC,YAAY,CACvB,OAAQ,EAAE,CACX,CAID,QAAA,EAAA,EAAA,cAGE,CACA,KAAM,EAAE,CACR,QAAS,EAAE,CACX,OAAQ,EAAE,CACV,QAAS,EAAE,CACX,MAAO,EAAE,CACT,OAAQ,EAAE,CACV,KAAM,EAAE,CACR,QAAS,EAAE,CACX,QAAS,EAAE,CACZ,CAAC,CACH,CACD,iBAAkB,CAEhB,CAAE,OAAQ,OAAQ,OAAQ,WAAY,OAAA,EAAA,EAAA,IAAU,CAAC,cAAc,CAAC,CAAE,CAClE,CAAE,OAAQ,UAAW,OAAQ,WAAY,OAAA,EAAA,EAAA,IAAU,CAAC,iBAAiB,CAAC,CAAE,CACxE,CAAE,OAAQ,SAAU,OAAQ,WAAY,OAAA,EAAA,EAAA,IAAU,CAAC,gBAAgB,CAAC,CAAE,CACtE,CAAE,OAAQ,UAAW,OAAQ,WAAY,OAAA,EAAA,EAAA,IAAU,CAAC,iBAAiB,CAAC,CAAE,CACxE,CAAE,OAAQ,QAAS,OAAQ,WAAY,OAAA,EAAA,EAAA,IAAU,CAAC,eAAe,CAAC,CAAE,CACpE,CAAE,OAAQ,SAAU,OAAQ,WAAY,OAAA,EAAA,EAAA,IAAU,CAAC,eAAe,CAAC,CAAE,CACrE,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ACF,CACD,gBAAiB,CACf,OAAQ,OACT,CACF,CACF,CAWY,GAAQ,CAAE,SAAQ,WAAU,GAAG,KAAuB,CACjE,IAAM,EAAc,GAAgB,CAG9B,EAAiB,GAAU,EAAY,QAAU,OAOvD,OAJK,GAKH,EAAA,EAAA,KAAC,SAAD,CAAQ,UAAW,EAAW,CAAE,OAAQ,EAAgB,CAAC,CAAE,GAAI,EAC5D,WACM,CAAA,CANF,MAUX,EAAK,YAAc,YC/DnB,IAAa,EAGT,OAAO,OAAO,EAAM,CACtB,UACA,OACD,CAAC,CAEF,EAAK,YAAc,OACnB,EAAQ,YAAc,eACtB,EAAK,YAAc"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/card/Card.styles.tsx","../../src/card/context.tsx","../../src/card/utils.ts","../../src/card/Card.tsx","../../src/card/Content.styles.tsx","../../src/card/Content.tsx","../../src/card/Type.tsx","../../src/card/index.ts"],"sourcesContent":["import { makeVariants, tw } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const cardStyles = cva(\n [\n 'group relative bg-clip-padding default:rounded-lg focus-visible:u-outline',\n 'disabled:opacity-dim-3 disabled:cursor-not-allowed',\n ],\n {\n variants: {\n design: {\n outlined: ['border-sm'],\n tinted: [],\n },\n /**\n * Color scheme of the button.\n */\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'success', 'alert', 'danger', 'info', 'neutral', 'surface']\n >({\n main: [],\n support: [],\n accent: [],\n success: [],\n alert: [],\n danger: [],\n info: [],\n neutral: [],\n surface: [],\n }),\n },\n compoundVariants: [\n // OUTLINED\n { intent: 'main', design: 'outlined', class: tw(['border-main']) },\n { intent: 'support', design: 'outlined', class: tw(['border-support']) },\n { intent: 'accent', design: 'outlined', class: tw(['border-accent']) },\n { intent: 'success', design: 'outlined', class: tw(['border-success']) },\n { intent: 'alert', design: 'outlined', class: tw(['border-alert']) },\n { intent: 'danger', design: 'outlined', class: tw(['border-error']) },\n { intent: 'info', design: 'outlined', class: tw(['border-info']) },\n { intent: 'neutral', design: 'outlined', class: tw(['border-neutral']) },\n { intent: 'surface', design: 'outlined', class: tw(['border-outline']) },\n ],\n defaultVariants: {\n design: 'outlined',\n intent: 'surface',\n },\n }\n)\n\nexport type CardStylesProps = VariantProps<typeof cardStyles>\n","import { createContext, useContext } from 'react'\n\nimport type { CardStylesProps } from './Card.styles'\n\nexport interface CardContextValue {\n design: CardStylesProps['design']\n intent: CardStylesProps['intent']\n hasType: boolean\n inset: boolean\n isInteractive: boolean\n}\n\nconst CardContext = createContext<CardContextValue | undefined>(undefined)\n\nexport const useCardContext = () => {\n const context = useContext(CardContext)\n if (!context) {\n throw new Error('useCardContext must be used within a Card component')\n }\n\n return context\n}\n\nexport { CardContext }\n","import { Children, isValidElement, ReactNode } from 'react'\n\nconst MOUSE_EVENTS = [\n 'onClick',\n 'onMouseDown',\n 'onMouseUp',\n 'onMouseEnter',\n 'onMouseLeave',\n 'onMouseMove',\n 'onMouseOver',\n 'onMouseOut',\n 'onDoubleClick',\n 'onContextMenu',\n] as const\n\nexport const hasType = (children: ReactNode): boolean => {\n let typeFound = false\n\n const searchForType = (node: ReactNode): void => {\n if (typeFound) return\n\n Children.forEach(node, child => {\n if (typeFound) return\n\n if (isValidElement(child)) {\n const isTypeComponent =\n typeof child.type === 'function' &&\n (child.type as { displayName?: string }).displayName === 'Card.Type'\n\n if (isTypeComponent) {\n typeFound = true\n\n return\n }\n\n const hasChildren =\n child.props && typeof child.props === 'object' && 'children' in child.props\n\n if (hasChildren) {\n const childChildren = (child.props as { children: ReactNode }).children\n if (childChildren !== undefined && childChildren !== null) {\n searchForType(childChildren)\n }\n }\n }\n })\n }\n\n searchForType(children)\n\n return typeFound\n}\n\nexport const isInteractive = (\n children: ReactNode,\n asChild: boolean | undefined,\n props: Record<string, any>\n): boolean => {\n const hasMouseEventHandlers = MOUSE_EVENTS.some(event => event in props)\n\n if (hasMouseEventHandlers) {\n return true\n }\n\n if (!asChild) {\n return false\n }\n\n const child = Children.only(children)\n\n if (!isValidElement(child)) {\n return false\n }\n\n const interactiveElements = ['a', 'button']\n const isInteractiveElement =\n typeof child.type === 'string' && interactiveElements.includes(child.type)\n\n if (isInteractiveElement) {\n return true\n }\n\n const childProps = child.props as Record<string, any>\n const hasChildEventHandlers = MOUSE_EVENTS.some(event => event in childProps)\n\n return hasChildEventHandlers\n}\n","import { ComponentProps } from 'react'\n\nimport { Slot } from '../slot'\nimport { cardStyles, type CardStylesProps } from './Card.styles'\nimport { CardContext } from './context'\nimport { hasType, isInteractive } from './utils'\n\nexport interface CardProps extends ComponentProps<'div'>, CardStylesProps {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * Whether the card should have an inset padding.\n */\n inset?: boolean\n}\n\nexport const Card = ({\n children,\n design = 'outlined',\n intent = 'surface',\n inset = false,\n asChild,\n className,\n ref,\n ...props\n}: CardProps) => {\n const Component = asChild ? Slot : 'div'\n const typeDetected = hasType(children)\n const interactiveDetected = isInteractive(children, asChild, props)\n\n return (\n <CardContext.Provider\n value={{\n design,\n intent,\n hasType: typeDetected,\n inset,\n isInteractive: interactiveDetected,\n }}\n >\n <Component\n data-spark-component=\"card\"\n data-interactive={interactiveDetected}\n ref={ref}\n className={cardStyles({\n className,\n design,\n intent,\n })}\n {...props}\n >\n {children}\n </Component>\n </CardContext.Provider>\n )\n}\n\nCard.displayName = 'Card'\n","import { makeVariants, tw } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const contentStyles = cva(\n [\n 'relative default:rounded-lg w-full focus-visible:u-outline',\n 'default:transition-colors default:duration-200 ease-linear',\n ],\n {\n variants: {\n inset: {\n false: ['default:p-lg'],\n },\n design: {\n outlined: [\n 'default:bg-surface group-focus:bg-surface-hovered group-not-disabled:group-data-[interactive=true]:group-hover:bg-surface-hovered',\n ],\n tinted: [],\n },\n hasType: {\n true: ['rounded-t-0'],\n },\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'success', 'alert', 'danger', 'info', 'neutral', 'surface']\n >({\n main: [],\n support: [],\n accent: [],\n success: [],\n alert: [],\n danger: [],\n info: [],\n neutral: [],\n surface: [],\n }),\n },\n compoundVariants: [\n // OUTLINED\n /**\n * Outlined styles are handled by the Card component (parent)\n */\n // TINTED\n {\n intent: 'main',\n design: 'tinted',\n class: tw([\n 'bg-main-container text-on-main-container group-focus:bg-main-container-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-main-container-hovered',\n ]),\n },\n {\n intent: 'support',\n design: 'tinted',\n class: tw([\n 'bg-support-container text-on-support-container group-focus:bg-support-container-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-support-container-hovered',\n ]),\n },\n {\n intent: 'accent',\n design: 'tinted',\n class: tw([\n 'bg-accent-container text-on-accent-container group-focus:bg-accent-container-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-accent-container-hovered',\n ]),\n },\n {\n intent: 'success',\n design: 'tinted',\n class: tw([\n 'bg-success-container text-on-success-container group-focus:bg-success-container-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-success-container-hovered',\n ]),\n },\n {\n intent: 'alert',\n design: 'tinted',\n class: tw([\n 'bg-alert-container text-on-alert-container group-focus:bg-alert-container-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-alert-container-hovered',\n ]),\n },\n {\n intent: 'danger',\n design: 'tinted',\n class: tw([\n 'bg-error-container text-on-error-container group-focus:bg-error-container-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-error-container-hovered',\n ]),\n },\n {\n intent: 'info',\n design: 'tinted',\n class: tw([\n 'bg-info-container text-on-info-container group-focus:bg-info-container-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-info-container-hovered',\n ]),\n },\n {\n intent: 'neutral',\n design: 'tinted',\n class: tw([\n 'bg-neutral-container text-on-neutral-container group-focus:bg-neutral-container-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-neutral-container-hovered',\n ]),\n },\n {\n intent: 'surface',\n design: 'tinted',\n class: tw([\n 'bg-surface text-on-surface group-focus:bg-surface-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-surface-hovered',\n ]),\n },\n ],\n defaultVariants: {\n design: 'outlined',\n intent: 'surface',\n inset: false,\n hasType: true,\n },\n }\n)\n\nexport type ContentStylesProps = VariantProps<typeof contentStyles>\n","import { ComponentProps } from 'react'\n\nimport { Slot } from '../slot'\nimport { contentStyles } from './Content.styles'\nimport { useCardContext } from './context'\n\nexport interface ContentProps extends ComponentProps<'div'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * Whether the card should have an inset padding.\n */\n inset?: boolean\n}\n\n/**\n * The main content area of the card. Renders a <div> element.\n */\nexport const Content = ({ children, inset, asChild, className, ref, ...props }: ContentProps) => {\n const Component = asChild ? Slot : 'div'\n const { design, intent, hasType } = useCardContext()\n\n return (\n <Component\n data-spark-component=\"card-content\"\n ref={ref}\n className={contentStyles({\n className,\n design,\n intent,\n inset,\n hasType,\n })}\n {...props}\n >\n {children}\n </Component>\n )\n}\n\nContent.displayName = 'Content'\n","import { cva, type VariantProps } from 'class-variance-authority'\nimport { type ComponentProps, type ReactNode } from 'react'\n\nimport { useCardContext } from './context'\n\nexport const typeStyles = cva(\n [\n // Base structure\n 'rounded-t-lg default:text-body-2-highlight',\n 'default:text-center',\n\n // Height and layout\n 'min-h-sz-32', // Minimum height same as Backdrop\n 'px-md', // Horizontal padding for text\n 'py-xs', // Vertical padding for text (allows height to grow)\n\n // Layout\n 'flex items-center justify-center', // Vertical centering of text\n 'whitespace-normal break-words', // Allow text wrapping\n ],\n {\n variants: {\n intent: {\n main: ['bg-main text-on-main'],\n support: ['bg-support text-on-support'],\n accent: ['bg-accent text-on-accent'],\n success: ['bg-success text-on-success'],\n alert: ['bg-alert text-on-alert'],\n danger: ['bg-error text-on-error'],\n info: ['bg-info text-on-info'],\n neutral: ['bg-neutral text-on-neutral'],\n surface: ['bg-surface-inverse text-on-surface-inverse'],\n },\n design: {\n outlined: ['-mx-px -mt-px'], // Fix border-radius visual gap by overlapping parent border\n tinted: [],\n },\n },\n defaultVariants: {\n intent: 'main',\n design: 'outlined',\n },\n }\n)\n\ntype TypeStylesProps = VariantProps<typeof typeStyles>\n\nexport interface TypeProps extends ComponentProps<'header'>, TypeStylesProps {\n /**\n * The type or category to display (e.g., \"Best seller\", \"New product\")\n */\n children?: ReactNode\n}\n\nexport const Type = ({ intent, children, ...props }: TypeProps) => {\n const cardContext = useCardContext()\n\n // Use intent from props if provided, otherwise inherit from parent Card context\n const resolvedIntent = intent ?? cardContext.intent ?? 'main'\n\n // Don't render if no children provided (for backward compatibility with Backdrop)\n if (!children) {\n return null\n }\n\n return (\n <header\n className={typeStyles({ intent: resolvedIntent, design: cardContext.design })}\n {...props}\n >\n {children}\n </header>\n )\n}\n\nType.displayName = 'Card.Type'\n","import { Card as Root } from './Card'\nimport { Content } from './Content'\nimport { Type } from './Type'\n\n/**\n * A container component that groups related content and actions in a single, styled surface.\n */\nexport const Card: typeof Root & {\n Content: typeof Content\n Type: typeof Type\n} = Object.assign(Root, {\n Content,\n Type,\n})\n\nCard.displayName = 'Card'\nContent.displayName = 'Card.Content'\nType.displayName = 'Card.Type'\n\nexport { type CardProps } from './Card'\nexport { type TypeProps } from './Type'\n"],"mappings":"yQAGA,IAAa,GAAA,EAAA,EAAA,KACX,CACE,4EACA,qDACD,CACD,CACE,SAAU,CACR,OAAQ,CACN,SAAU,CAAC,YAAY,CACvB,OAAQ,EAAE,CACX,CAID,QAAA,EAAA,EAAA,cAGE,CACA,KAAM,EAAE,CACR,QAAS,EAAE,CACX,OAAQ,EAAE,CACV,QAAS,EAAE,CACX,MAAO,EAAE,CACT,OAAQ,EAAE,CACV,KAAM,EAAE,CACR,QAAS,EAAE,CACX,QAAS,EAAE,CACZ,CAAC,CACH,CAC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,SAAQ,WAAY,GAAgB,CAEpD,OACE,EAAA,EAAA,KAAC,EAAD,CACE,uBAAqB,eAChB,MACL,UAAW,EAAc,CACvB,YACA,SACA,SACA,QACA,UACD,CAAC,CACF,GAAI,EAEH,WACS,CAAA,EAIhB,EAAQ,YAAc,UCrCtB,IAAa,GAAA,EAAA,EAAA,KACX,CAEE,6CACA,sBAGA,cACA,QACA,QAGA,mCACA,gCACD,CACD,CACE,SAAU,CACR,OAAQ,CACN,KAAM,CAAC,uBAAuB,CAC9B,QAAS,CAAC,6BAA6B,CACvC,OAAQ,CAAC,2BAA2B,CACpC,QAAS,CAAC,6BAA6B,CACvC,MAAO,CAAC,yBAAyB,CACjC,OAAQ,CAAC,yBAAyB,CAClC,KAAM,CAAC,uBAAuB,CAC9B,QAAS,CAAC,6BAA6B,CACvC,QAAS,CAAC,6CAA6C,CACxD,CACD,OAAQ,CACN,SAAU,CAAC,gBAAgB,CAC3B,OAAQ,EAAE,CACX,CACF,CACD,gBAAiB,CACf,OAAQ,OACR,OAAQ,WACT,CACF,CACF,CAWY,GAAQ,CAAE,SAAQ,WAAU,GAAG,KAAuB,CACjE,IAAM,EAAc,GAAgB,CAG9B,EAAiB,GAAU,EAAY,QAAU,OAOvD,OAJK,GAKH,EAAA,EAAA,KAAC,SAAD,CACE,UAAW,EAAW,CAAE,OAAQ,EAAgB,OAAQ,EAAY,OAAQ,CAAC,CAC7E,GAAI,EAEH,WACM,CAAA,CATF,MAaX,EAAK,YAAc,YCpEnB,IAAa,EAGT,OAAO,OAAO,EAAM,CACtB,UACA,OACD,CAAC,CAEF,EAAK,YAAc,OACnB,EAAQ,YAAc,eACtB,EAAK,YAAc"}
|
package/dist/card/index.mjs
CHANGED
|
@@ -139,7 +139,7 @@ var l = t(["group relative bg-clip-padding default:rounded-lg focus-visible:u-ou
|
|
|
139
139
|
h.displayName = "Card";
|
|
140
140
|
//#endregion
|
|
141
141
|
//#region src/card/Content.styles.tsx
|
|
142
|
-
var g = t(["relative
|
|
142
|
+
var g = t(["relative default:rounded-lg w-full focus-visible:u-outline", "default:transition-colors default:duration-200 ease-linear"], {
|
|
143
143
|
variants: {
|
|
144
144
|
inset: { false: ["default:p-lg"] },
|
|
145
145
|
design: {
|
|
@@ -238,25 +238,36 @@ var v = t([
|
|
|
238
238
|
"px-md",
|
|
239
239
|
"py-xs",
|
|
240
240
|
"flex items-center justify-center",
|
|
241
|
-
"whitespace-normal break-words"
|
|
242
|
-
"-mx-px -mt-px"
|
|
241
|
+
"whitespace-normal break-words"
|
|
243
242
|
], {
|
|
244
|
-
variants: {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
243
|
+
variants: {
|
|
244
|
+
intent: {
|
|
245
|
+
main: ["bg-main text-on-main"],
|
|
246
|
+
support: ["bg-support text-on-support"],
|
|
247
|
+
accent: ["bg-accent text-on-accent"],
|
|
248
|
+
success: ["bg-success text-on-success"],
|
|
249
|
+
alert: ["bg-alert text-on-alert"],
|
|
250
|
+
danger: ["bg-error text-on-error"],
|
|
251
|
+
info: ["bg-info text-on-info"],
|
|
252
|
+
neutral: ["bg-neutral text-on-neutral"],
|
|
253
|
+
surface: ["bg-surface-inverse text-on-surface-inverse"]
|
|
254
|
+
},
|
|
255
|
+
design: {
|
|
256
|
+
outlined: ["-mx-px -mt-px"],
|
|
257
|
+
tinted: []
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
defaultVariants: {
|
|
261
|
+
intent: "main",
|
|
262
|
+
design: "outlined"
|
|
263
|
+
}
|
|
256
264
|
}), y = ({ intent: e, children: t, ...n }) => {
|
|
257
265
|
let r = d(), i = e ?? r.intent ?? "main";
|
|
258
266
|
return t ? /* @__PURE__ */ o("header", {
|
|
259
|
-
className: v({
|
|
267
|
+
className: v({
|
|
268
|
+
intent: i,
|
|
269
|
+
design: r.design
|
|
270
|
+
}),
|
|
260
271
|
...n,
|
|
261
272
|
children: t
|
|
262
273
|
}) : null;
|
package/dist/card/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/card/Card.styles.tsx","../../src/card/context.tsx","../../src/card/utils.ts","../../src/card/Card.tsx","../../src/card/Content.styles.tsx","../../src/card/Content.tsx","../../src/card/Type.tsx","../../src/card/index.ts"],"sourcesContent":["import { makeVariants, tw } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const cardStyles = cva(\n [\n 'group relative bg-clip-padding default:rounded-lg focus-visible:u-outline',\n 'disabled:opacity-dim-3 disabled:cursor-not-allowed',\n ],\n {\n variants: {\n design: {\n outlined: ['border-sm'],\n tinted: [],\n },\n /**\n * Color scheme of the button.\n */\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'success', 'alert', 'danger', 'info', 'neutral', 'surface']\n >({\n main: [],\n support: [],\n accent: [],\n success: [],\n alert: [],\n danger: [],\n info: [],\n neutral: [],\n surface: [],\n }),\n },\n compoundVariants: [\n // OUTLINED\n { intent: 'main', design: 'outlined', class: tw(['border-main']) },\n { intent: 'support', design: 'outlined', class: tw(['border-support']) },\n { intent: 'accent', design: 'outlined', class: tw(['border-accent']) },\n { intent: 'success', design: 'outlined', class: tw(['border-success']) },\n { intent: 'alert', design: 'outlined', class: tw(['border-alert']) },\n { intent: 'danger', design: 'outlined', class: tw(['border-error']) },\n { intent: 'info', design: 'outlined', class: tw(['border-info']) },\n { intent: 'neutral', design: 'outlined', class: tw(['border-neutral']) },\n { intent: 'surface', design: 'outlined', class: tw(['border-outline']) },\n ],\n defaultVariants: {\n design: 'outlined',\n intent: 'surface',\n },\n }\n)\n\nexport type CardStylesProps = VariantProps<typeof cardStyles>\n","import { createContext, useContext } from 'react'\n\nimport type { CardStylesProps } from './Card.styles'\n\nexport interface CardContextValue {\n design: CardStylesProps['design']\n intent: CardStylesProps['intent']\n hasType: boolean\n inset: boolean\n isInteractive: boolean\n}\n\nconst CardContext = createContext<CardContextValue | undefined>(undefined)\n\nexport const useCardContext = () => {\n const context = useContext(CardContext)\n if (!context) {\n throw new Error('useCardContext must be used within a Card component')\n }\n\n return context\n}\n\nexport { CardContext }\n","import { Children, isValidElement, ReactNode } from 'react'\n\nconst MOUSE_EVENTS = [\n 'onClick',\n 'onMouseDown',\n 'onMouseUp',\n 'onMouseEnter',\n 'onMouseLeave',\n 'onMouseMove',\n 'onMouseOver',\n 'onMouseOut',\n 'onDoubleClick',\n 'onContextMenu',\n] as const\n\nexport const hasType = (children: ReactNode): boolean => {\n let typeFound = false\n\n const searchForType = (node: ReactNode): void => {\n if (typeFound) return\n\n Children.forEach(node, child => {\n if (typeFound) return\n\n if (isValidElement(child)) {\n const isTypeComponent =\n typeof child.type === 'function' &&\n (child.type as { displayName?: string }).displayName === 'Card.Type'\n\n if (isTypeComponent) {\n typeFound = true\n\n return\n }\n\n const hasChildren =\n child.props && typeof child.props === 'object' && 'children' in child.props\n\n if (hasChildren) {\n const childChildren = (child.props as { children: ReactNode }).children\n if (childChildren !== undefined && childChildren !== null) {\n searchForType(childChildren)\n }\n }\n }\n })\n }\n\n searchForType(children)\n\n return typeFound\n}\n\nexport const isInteractive = (\n children: ReactNode,\n asChild: boolean | undefined,\n props: Record<string, any>\n): boolean => {\n const hasMouseEventHandlers = MOUSE_EVENTS.some(event => event in props)\n\n if (hasMouseEventHandlers) {\n return true\n }\n\n if (!asChild) {\n return false\n }\n\n const child = Children.only(children)\n\n if (!isValidElement(child)) {\n return false\n }\n\n const interactiveElements = ['a', 'button']\n const isInteractiveElement =\n typeof child.type === 'string' && interactiveElements.includes(child.type)\n\n if (isInteractiveElement) {\n return true\n }\n\n const childProps = child.props as Record<string, any>\n const hasChildEventHandlers = MOUSE_EVENTS.some(event => event in childProps)\n\n return hasChildEventHandlers\n}\n","import { ComponentProps } from 'react'\n\nimport { Slot } from '../slot'\nimport { cardStyles, type CardStylesProps } from './Card.styles'\nimport { CardContext } from './context'\nimport { hasType, isInteractive } from './utils'\n\nexport interface CardProps extends ComponentProps<'div'>, CardStylesProps {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * Whether the card should have an inset padding.\n */\n inset?: boolean\n}\n\nexport const Card = ({\n children,\n design = 'outlined',\n intent = 'surface',\n inset = false,\n asChild,\n className,\n ref,\n ...props\n}: CardProps) => {\n const Component = asChild ? Slot : 'div'\n const typeDetected = hasType(children)\n const interactiveDetected = isInteractive(children, asChild, props)\n\n return (\n <CardContext.Provider\n value={{\n design,\n intent,\n hasType: typeDetected,\n inset,\n isInteractive: interactiveDetected,\n }}\n >\n <Component\n data-spark-component=\"card\"\n data-interactive={interactiveDetected}\n ref={ref}\n className={cardStyles({\n className,\n design,\n intent,\n })}\n {...props}\n >\n {children}\n </Component>\n </CardContext.Provider>\n )\n}\n\nCard.displayName = 'Card'\n","import { makeVariants, tw } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const contentStyles = cva(\n [\n 'relative h-full default:rounded-lg w-full focus-visible:u-outline',\n 'default:transition-colors default:duration-200 ease-linear',\n ],\n {\n variants: {\n inset: {\n false: ['default:p-lg'],\n },\n design: {\n outlined: [\n 'default:bg-surface group-focus:bg-surface-hovered group-not-disabled:group-data-[interactive=true]:group-hover:bg-surface-hovered',\n ],\n tinted: [],\n },\n hasType: {\n true: ['rounded-t-0'],\n },\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'success', 'alert', 'danger', 'info', 'neutral', 'surface']\n >({\n main: [],\n support: [],\n accent: [],\n success: [],\n alert: [],\n danger: [],\n info: [],\n neutral: [],\n surface: [],\n }),\n },\n compoundVariants: [\n // OUTLINED\n /**\n * Outlined styles are handled by the Card component (parent)\n */\n // TINTED\n {\n intent: 'main',\n design: 'tinted',\n class: tw([\n 'bg-main-container text-on-main-container group-focus:bg-main-container-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-main-container-hovered',\n ]),\n },\n {\n intent: 'support',\n design: 'tinted',\n class: tw([\n 'bg-support-container text-on-support-container group-focus:bg-support-container-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-support-container-hovered',\n ]),\n },\n {\n intent: 'accent',\n design: 'tinted',\n class: tw([\n 'bg-accent-container text-on-accent-container group-focus:bg-accent-container-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-accent-container-hovered',\n ]),\n },\n {\n intent: 'success',\n design: 'tinted',\n class: tw([\n 'bg-success-container text-on-success-container group-focus:bg-success-container-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-success-container-hovered',\n ]),\n },\n {\n intent: 'alert',\n design: 'tinted',\n class: tw([\n 'bg-alert-container text-on-alert-container group-focus:bg-alert-container-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-alert-container-hovered',\n ]),\n },\n {\n intent: 'danger',\n design: 'tinted',\n class: tw([\n 'bg-error-container text-on-error-container group-focus:bg-error-container-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-error-container-hovered',\n ]),\n },\n {\n intent: 'info',\n design: 'tinted',\n class: tw([\n 'bg-info-container text-on-info-container group-focus:bg-info-container-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-info-container-hovered',\n ]),\n },\n {\n intent: 'neutral',\n design: 'tinted',\n class: tw([\n 'bg-neutral-container text-on-neutral-container group-focus:bg-neutral-container-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-neutral-container-hovered',\n ]),\n },\n {\n intent: 'surface',\n design: 'tinted',\n class: tw([\n 'bg-surface text-on-surface group-focus:bg-surface-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-surface-hovered',\n ]),\n },\n ],\n defaultVariants: {\n design: 'outlined',\n intent: 'surface',\n inset: false,\n hasType: true,\n },\n }\n)\n\nexport type ContentStylesProps = VariantProps<typeof contentStyles>\n","import { ComponentProps } from 'react'\n\nimport { Slot } from '../slot'\nimport { contentStyles } from './Content.styles'\nimport { useCardContext } from './context'\n\nexport interface ContentProps extends ComponentProps<'div'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * Whether the card should have an inset padding.\n */\n inset?: boolean\n}\n\n/**\n * The main content area of the card. Renders a <div> element.\n */\nexport const Content = ({ children, inset, asChild, className, ref, ...props }: ContentProps) => {\n const Component = asChild ? Slot : 'div'\n const { design, intent, hasType } = useCardContext()\n\n return (\n <Component\n data-spark-component=\"card-content\"\n ref={ref}\n className={contentStyles({\n className,\n design,\n intent,\n inset,\n hasType,\n })}\n {...props}\n >\n {children}\n </Component>\n )\n}\n\nContent.displayName = 'Content'\n","import { cva, type VariantProps } from 'class-variance-authority'\nimport { type ComponentProps, type ReactNode } from 'react'\n\nimport { useCardContext } from './context'\n\nexport const typeStyles = cva(\n [\n // Base structure\n 'rounded-t-lg default:text-body-2-highlight',\n 'default:text-center',\n\n // Height and layout\n 'min-h-sz-32', // Minimum height same as Backdrop\n 'px-md', // Horizontal padding for text\n 'py-xs', // Vertical padding for text (allows height to grow)\n\n // Layout\n 'flex items-center justify-center', // Vertical centering of text\n 'whitespace-normal break-words', // Allow text wrapping\n\n // Fix border-radius visual gap by overlapping parent border\n '-mx-px -mt-px',\n ],\n {\n variants: {\n intent: {\n main: ['bg-main text-on-main'],\n support: ['bg-support text-on-support'],\n accent: ['bg-accent text-on-accent'],\n success: ['bg-success text-on-success'],\n alert: ['bg-alert text-on-alert'],\n danger: ['bg-error text-on-error'],\n info: ['bg-info text-on-info'],\n neutral: ['bg-neutral text-on-neutral'],\n surface: ['bg-surface-inverse text-on-surface-inverse'],\n },\n },\n defaultVariants: {\n intent: 'main',\n },\n }\n)\n\ntype TypeStylesProps = VariantProps<typeof typeStyles>\n\nexport interface TypeProps extends ComponentProps<'header'>, TypeStylesProps {\n /**\n * The type or category to display (e.g., \"Best seller\", \"New product\")\n */\n children?: ReactNode\n}\n\nexport const Type = ({ intent, children, ...props }: TypeProps) => {\n const cardContext = useCardContext()\n\n // Use intent from props if provided, otherwise inherit from parent Card context\n const resolvedIntent = intent ?? cardContext.intent ?? 'main'\n\n // Don't render if no children provided (for backward compatibility with Backdrop)\n if (!children) {\n return null\n }\n\n return (\n <header className={typeStyles({ intent: resolvedIntent })} {...props}>\n {children}\n </header>\n )\n}\n\nType.displayName = 'Card.Type'\n","import { Card as Root } from './Card'\nimport { Content } from './Content'\nimport { Type } from './Type'\n\n/**\n * A container component that groups related content and actions in a single, styled surface.\n */\nexport const Card: typeof Root & {\n Content: typeof Content\n Type: typeof Type\n} = Object.assign(Root, {\n Content,\n Type,\n})\n\nCard.displayName = 'Card'\nContent.displayName = 'Card.Content'\nType.displayName = 'Card.Type'\n\nexport { type CardProps } from './Card'\nexport { type TypeProps } from './Type'\n"],"mappings":";;;;;;AAGA,IAAa,IAAa,EACxB,CACE,6EACA,qDACD,EACD;CACE,UAAU;EACR,QAAQ;GACN,UAAU,CAAC,YAAY;GACvB,QAAQ,EAAE;GACX;EAID,QAAQ,EAGN;GACA,MAAM,EAAE;GACR,SAAS,EAAE;GACX,QAAQ,EAAE;GACV,SAAS,EAAE;GACX,OAAO,EAAE;GACT,QAAQ,EAAE;GACV,MAAM,EAAE;GACR,SAAS,EAAE;GACX,SAAS,EAAE;GACZ,CAAC;EACH;CACD,kBAAkB;EAEhB;GAAE,QAAQ;GAAQ,QAAQ;GAAY,OAAO,EAAG,CAAC,cAAc,CAAC;GAAE;EAClE;GAAE,QAAQ;GAAW,QAAQ;GAAY,OAAO,EAAG,CAAC,iBAAiB,CAAC;GAAE;EACxE;GAAE,QAAQ;GAAU,QAAQ;GAAY,OAAO,EAAG,CAAC,gBAAgB,CAAC;GAAE;EACtE;GAAE,QAAQ;GAAW,QAAQ;GAAY,OAAO,EAAG,CAAC,iBAAiB,CAAC;GAAE;EACxE;GAAE,QAAQ;GAAS,QAAQ;GAAY,OA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AKH,kBAAC,UAAD;EAAQ,WAAW,EAAW,EAAE,QAAQ,GAAgB,CAAC;EAAE,GAAI;EAC5D;EACM,CAAA,GANF;;AAUX,EAAK,cAAc;;;AC/DnB,IAAa,IAGT,OAAO,OAAO,GAAM;CACtB;CACA;CACD,CAAC;AAEF,EAAK,cAAc,QACnB,EAAQ,cAAc,gBACtB,EAAK,cAAc"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/card/Card.styles.tsx","../../src/card/context.tsx","../../src/card/utils.ts","../../src/card/Card.tsx","../../src/card/Content.styles.tsx","../../src/card/Content.tsx","../../src/card/Type.tsx","../../src/card/index.ts"],"sourcesContent":["import { makeVariants, tw } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const cardStyles = cva(\n [\n 'group relative bg-clip-padding default:rounded-lg focus-visible:u-outline',\n 'disabled:opacity-dim-3 disabled:cursor-not-allowed',\n ],\n {\n variants: {\n design: {\n outlined: ['border-sm'],\n tinted: [],\n },\n /**\n * Color scheme of the button.\n */\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'success', 'alert', 'danger', 'info', 'neutral', 'surface']\n >({\n main: [],\n support: [],\n accent: [],\n success: [],\n alert: [],\n danger: [],\n info: [],\n neutral: [],\n surface: [],\n }),\n },\n compoundVariants: [\n // OUTLINED\n { intent: 'main', design: 'outlined', class: tw(['border-main']) },\n { intent: 'support', design: 'outlined', class: tw(['border-support']) },\n { intent: 'accent', design: 'outlined', class: tw(['border-accent']) },\n { intent: 'success', design: 'outlined', class: tw(['border-success']) },\n { intent: 'alert', design: 'outlined', class: tw(['border-alert']) },\n { intent: 'danger', design: 'outlined', class: tw(['border-error']) },\n { intent: 'info', design: 'outlined', class: tw(['border-info']) },\n { intent: 'neutral', design: 'outlined', class: tw(['border-neutral']) },\n { intent: 'surface', design: 'outlined', class: tw(['border-outline']) },\n ],\n defaultVariants: {\n design: 'outlined',\n intent: 'surface',\n },\n }\n)\n\nexport type CardStylesProps = VariantProps<typeof cardStyles>\n","import { createContext, useContext } from 'react'\n\nimport type { CardStylesProps } from './Card.styles'\n\nexport interface CardContextValue {\n design: CardStylesProps['design']\n intent: CardStylesProps['intent']\n hasType: boolean\n inset: boolean\n isInteractive: boolean\n}\n\nconst CardContext = createContext<CardContextValue | undefined>(undefined)\n\nexport const useCardContext = () => {\n const context = useContext(CardContext)\n if (!context) {\n throw new Error('useCardContext must be used within a Card component')\n }\n\n return context\n}\n\nexport { CardContext }\n","import { Children, isValidElement, ReactNode } from 'react'\n\nconst MOUSE_EVENTS = [\n 'onClick',\n 'onMouseDown',\n 'onMouseUp',\n 'onMouseEnter',\n 'onMouseLeave',\n 'onMouseMove',\n 'onMouseOver',\n 'onMouseOut',\n 'onDoubleClick',\n 'onContextMenu',\n] as const\n\nexport const hasType = (children: ReactNode): boolean => {\n let typeFound = false\n\n const searchForType = (node: ReactNode): void => {\n if (typeFound) return\n\n Children.forEach(node, child => {\n if (typeFound) return\n\n if (isValidElement(child)) {\n const isTypeComponent =\n typeof child.type === 'function' &&\n (child.type as { displayName?: string }).displayName === 'Card.Type'\n\n if (isTypeComponent) {\n typeFound = true\n\n return\n }\n\n const hasChildren =\n child.props && typeof child.props === 'object' && 'children' in child.props\n\n if (hasChildren) {\n const childChildren = (child.props as { children: ReactNode }).children\n if (childChildren !== undefined && childChildren !== null) {\n searchForType(childChildren)\n }\n }\n }\n })\n }\n\n searchForType(children)\n\n return typeFound\n}\n\nexport const isInteractive = (\n children: ReactNode,\n asChild: boolean | undefined,\n props: Record<string, any>\n): boolean => {\n const hasMouseEventHandlers = MOUSE_EVENTS.some(event => event in props)\n\n if (hasMouseEventHandlers) {\n return true\n }\n\n if (!asChild) {\n return false\n }\n\n const child = Children.only(children)\n\n if (!isValidElement(child)) {\n return false\n }\n\n const interactiveElements = ['a', 'button']\n const isInteractiveElement =\n typeof child.type === 'string' && interactiveElements.includes(child.type)\n\n if (isInteractiveElement) {\n return true\n }\n\n const childProps = child.props as Record<string, any>\n const hasChildEventHandlers = MOUSE_EVENTS.some(event => event in childProps)\n\n return hasChildEventHandlers\n}\n","import { ComponentProps } from 'react'\n\nimport { Slot } from '../slot'\nimport { cardStyles, type CardStylesProps } from './Card.styles'\nimport { CardContext } from './context'\nimport { hasType, isInteractive } from './utils'\n\nexport interface CardProps extends ComponentProps<'div'>, CardStylesProps {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * Whether the card should have an inset padding.\n */\n inset?: boolean\n}\n\nexport const Card = ({\n children,\n design = 'outlined',\n intent = 'surface',\n inset = false,\n asChild,\n className,\n ref,\n ...props\n}: CardProps) => {\n const Component = asChild ? Slot : 'div'\n const typeDetected = hasType(children)\n const interactiveDetected = isInteractive(children, asChild, props)\n\n return (\n <CardContext.Provider\n value={{\n design,\n intent,\n hasType: typeDetected,\n inset,\n isInteractive: interactiveDetected,\n }}\n >\n <Component\n data-spark-component=\"card\"\n data-interactive={interactiveDetected}\n ref={ref}\n className={cardStyles({\n className,\n design,\n intent,\n })}\n {...props}\n >\n {children}\n </Component>\n </CardContext.Provider>\n )\n}\n\nCard.displayName = 'Card'\n","import { makeVariants, tw } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const contentStyles = cva(\n [\n 'relative default:rounded-lg w-full focus-visible:u-outline',\n 'default:transition-colors default:duration-200 ease-linear',\n ],\n {\n variants: {\n inset: {\n false: ['default:p-lg'],\n },\n design: {\n outlined: [\n 'default:bg-surface group-focus:bg-surface-hovered group-not-disabled:group-data-[interactive=true]:group-hover:bg-surface-hovered',\n ],\n tinted: [],\n },\n hasType: {\n true: ['rounded-t-0'],\n },\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'success', 'alert', 'danger', 'info', 'neutral', 'surface']\n >({\n main: [],\n support: [],\n accent: [],\n success: [],\n alert: [],\n danger: [],\n info: [],\n neutral: [],\n surface: [],\n }),\n },\n compoundVariants: [\n // OUTLINED\n /**\n * Outlined styles are handled by the Card component (parent)\n */\n // TINTED\n {\n intent: 'main',\n design: 'tinted',\n class: tw([\n 'bg-main-container text-on-main-container group-focus:bg-main-container-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-main-container-hovered',\n ]),\n },\n {\n intent: 'support',\n design: 'tinted',\n class: tw([\n 'bg-support-container text-on-support-container group-focus:bg-support-container-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-support-container-hovered',\n ]),\n },\n {\n intent: 'accent',\n design: 'tinted',\n class: tw([\n 'bg-accent-container text-on-accent-container group-focus:bg-accent-container-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-accent-container-hovered',\n ]),\n },\n {\n intent: 'success',\n design: 'tinted',\n class: tw([\n 'bg-success-container text-on-success-container group-focus:bg-success-container-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-success-container-hovered',\n ]),\n },\n {\n intent: 'alert',\n design: 'tinted',\n class: tw([\n 'bg-alert-container text-on-alert-container group-focus:bg-alert-container-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-alert-container-hovered',\n ]),\n },\n {\n intent: 'danger',\n design: 'tinted',\n class: tw([\n 'bg-error-container text-on-error-container group-focus:bg-error-container-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-error-container-hovered',\n ]),\n },\n {\n intent: 'info',\n design: 'tinted',\n class: tw([\n 'bg-info-container text-on-info-container group-focus:bg-info-container-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-info-container-hovered',\n ]),\n },\n {\n intent: 'neutral',\n design: 'tinted',\n class: tw([\n 'bg-neutral-container text-on-neutral-container group-focus:bg-neutral-container-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-neutral-container-hovered',\n ]),\n },\n {\n intent: 'surface',\n design: 'tinted',\n class: tw([\n 'bg-surface text-on-surface group-focus:bg-surface-hovered',\n 'group-not-disabled:group-data-[interactive=true]:group-hover:bg-surface-hovered',\n ]),\n },\n ],\n defaultVariants: {\n design: 'outlined',\n intent: 'surface',\n inset: false,\n hasType: true,\n },\n }\n)\n\nexport type ContentStylesProps = VariantProps<typeof contentStyles>\n","import { ComponentProps } from 'react'\n\nimport { Slot } from '../slot'\nimport { contentStyles } from './Content.styles'\nimport { useCardContext } from './context'\n\nexport interface ContentProps extends ComponentProps<'div'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * Whether the card should have an inset padding.\n */\n inset?: boolean\n}\n\n/**\n * The main content area of the card. Renders a <div> element.\n */\nexport const Content = ({ children, inset, asChild, className, ref, ...props }: ContentProps) => {\n const Component = asChild ? Slot : 'div'\n const { design, intent, hasType } = useCardContext()\n\n return (\n <Component\n data-spark-component=\"card-content\"\n ref={ref}\n className={contentStyles({\n className,\n design,\n intent,\n inset,\n hasType,\n })}\n {...props}\n >\n {children}\n </Component>\n )\n}\n\nContent.displayName = 'Content'\n","import { cva, type VariantProps } from 'class-variance-authority'\nimport { type ComponentProps, type ReactNode } from 'react'\n\nimport { useCardContext } from './context'\n\nexport const typeStyles = cva(\n [\n // Base structure\n 'rounded-t-lg default:text-body-2-highlight',\n 'default:text-center',\n\n // Height and layout\n 'min-h-sz-32', // Minimum height same as Backdrop\n 'px-md', // Horizontal padding for text\n 'py-xs', // Vertical padding for text (allows height to grow)\n\n // Layout\n 'flex items-center justify-center', // Vertical centering of text\n 'whitespace-normal break-words', // Allow text wrapping\n ],\n {\n variants: {\n intent: {\n main: ['bg-main text-on-main'],\n support: ['bg-support text-on-support'],\n accent: ['bg-accent text-on-accent'],\n success: ['bg-success text-on-success'],\n alert: ['bg-alert text-on-alert'],\n danger: ['bg-error text-on-error'],\n info: ['bg-info text-on-info'],\n neutral: ['bg-neutral text-on-neutral'],\n surface: ['bg-surface-inverse text-on-surface-inverse'],\n },\n design: {\n outlined: ['-mx-px -mt-px'], // Fix border-radius visual gap by overlapping parent border\n tinted: [],\n },\n },\n defaultVariants: {\n intent: 'main',\n design: 'outlined',\n },\n }\n)\n\ntype TypeStylesProps = VariantProps<typeof typeStyles>\n\nexport interface TypeProps extends ComponentProps<'header'>, TypeStylesProps {\n /**\n * The type or category to display (e.g., \"Best seller\", \"New product\")\n */\n children?: ReactNode\n}\n\nexport const Type = ({ intent, children, ...props }: TypeProps) => {\n const cardContext = useCardContext()\n\n // Use intent from props if provided, otherwise inherit from parent Card context\n const resolvedIntent = intent ?? cardContext.intent ?? 'main'\n\n // Don't render if no children provided (for backward compatibility with Backdrop)\n if (!children) {\n return null\n }\n\n return (\n <header\n className={typeStyles({ intent: resolvedIntent, design: cardContext.design })}\n {...props}\n >\n {children}\n </header>\n )\n}\n\nType.displayName = 'Card.Type'\n","import { Card as Root } from './Card'\nimport { Content } from './Content'\nimport { Type } from './Type'\n\n/**\n * A container component that groups related content and actions in a single, styled surface.\n */\nexport const Card: typeof Root & {\n Content: typeof Content\n Type: typeof Type\n} = Object.assign(Root, {\n Content,\n Type,\n})\n\nCard.displayName = 'Card'\nContent.displayName = 'Card.Content'\nType.displayName = 'Card.Type'\n\nexport { type CardProps } from './Card'\nexport { type TypeProps } from './Type'\n"],"mappings":";;;;;;AAGA,IAAa,IAAa,EACxB,CACE,6EACA,qDACD,EACD;CACE,UAAU;EACR,QAAQ;GACN,UAAU,CAAC,YAAY;GACvB,QAAQ,EAAE;GACX;EAID,QAAQ,EAGN;GACA,MAAM,EAAE;GACR,SAAS,EAAE;GACX,QAAQ,EAAE;GACV,SAAS,EAAE;GACX,OAAO,EAAE;GACT,QAAQ,EAAE;GACV,MAAM,EAAE;GACR,SAAS,EAAE;GACX,SAAS,EAAE;GACZ,CAAC;EACH;CACD,kBAAkB;EAEhB;GAAE,QAAQ;GAAQ,QAAQ;GAAY,OAAO,EAAG,CAAC,cAAc,CAAC;GAAE;EAClE;GAAE,QAAQ;GAAW,QAAQ;GAAY,OAAO,EAAG,CAAC,iBAAiB,CAAC;GAAE;EACxE;GAAE,QAAQ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6C;GACxD;EACD,QAAQ;GACN,UAAU,CAAC,gBAAgB;GAC3B,QAAQ,EAAE;GACX;EACF;CACD,iBAAiB;EACf,QAAQ;EACR,QAAQ;EACT;CACF,CACF,EAWY,KAAQ,EAAE,WAAQ,aAAU,GAAG,QAAuB;CACjE,IAAM,IAAc,GAAgB,EAG9B,IAAiB,KAAU,EAAY,UAAU;AAOvD,QAJK,IAKH,kBAAC,UAAD;EACE,WAAW,EAAW;GAAE,QAAQ;GAAgB,QAAQ,EAAY;GAAQ,CAAC;EAC7E,GAAI;EAEH;EACM,CAAA,GATF;;AAaX,EAAK,cAAc;;;ACpEnB,IAAa,IAGT,OAAO,OAAO,GAAM;CACtB;CACA;CACD,CAAC;AAEF,EAAK,cAAc,QACnB,EAAQ,cAAc,gBACtB,EAAK,cAAc"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spark-ui/components",
|
|
3
|
-
"version": "17.10.2
|
|
3
|
+
"version": "17.10.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Spark (Leboncoin design system) components.",
|
|
6
6
|
"exports": {
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@base-ui/react": "1.0.0",
|
|
51
|
-
"@spark-ui/hooks": "17.10.2
|
|
52
|
-
"@spark-ui/icons": "17.10.2
|
|
53
|
-
"@spark-ui/internal-utils": "17.10.2
|
|
51
|
+
"@spark-ui/hooks": "17.10.2",
|
|
52
|
+
"@spark-ui/icons": "17.10.2",
|
|
53
|
+
"@spark-ui/internal-utils": "17.10.2",
|
|
54
54
|
"@zag-js/pagination": "1.30.0",
|
|
55
55
|
"@zag-js/react": "1.30.0",
|
|
56
56
|
"class-variance-authority": "0.7.1",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"react-snap-carousel": "0.5.1"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"@spark-ui/theme-utils": "17.10.2
|
|
65
|
+
"@spark-ui/theme-utils": "17.10.2",
|
|
66
66
|
"react": "19.2.4",
|
|
67
67
|
"react-dom": "19.2.4",
|
|
68
68
|
"tailwindcss": "4.1.18"
|