@kubit-ui-web/react-components 2.0.0-beta.22 → 2.0.0-beta.23

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.
@@ -729,87 +729,121 @@ export declare type CalendarVariantStyles<Variant extends string> = CalendarStyl
729
729
  };
730
730
 
731
731
  /**
732
- * CardImage component for displaying an image card with responsive and theme support.
732
+ * Card component for displaying content in a structured container.
733
733
  *
734
- * This component is useful for rendering images in a card layout, adapting its style
735
- * based on the current device and variant. It leverages generics to allow custom variant
736
- * types, enabling flexible theming and styling.
734
+ * This component wraps content in a styled card with optional header, content, and footer sections.
735
+ * It is useful for organizing information, displaying items in a list, or creating selectable cards.
736
+ * Supports interactive states (hover, selected) and custom theming via variants.
737
737
  *
738
- * Internally, it uses {@link CardImageStandAlone} and injects device and CSS class information.
738
+ * All sections (header, content, footer) are optional and can accept either text or any React node.
739
+ * The card can respond to user interaction through onClick, onMouseEnter, and onMouseLeave handlers.
739
740
  *
740
- * The generic type parameter `<Variant extends string>` allows you to define your own variant
741
- * types for more precise theming.
741
+ * Internally, it computes CSS classes using a custom hook and delegates rendering to {@link CardStandAlone}.
742
+ *
743
+ * This component accepts a generic type parameter `<Variant extends string>` to allow for custom variant values,
744
+ * enabling flexible theming and styling.
742
745
  *
743
746
  * @example
744
747
  * ```tsx
745
- * <CardImage variant="primary" />
748
+ * <Card
749
+ * header={{ content: "Card Title" }}
750
+ * content="This is the card content"
751
+ * footer={{ content: "Footer information" }}
752
+ * />
746
753
  *
747
754
  * // With a custom variant type:
748
- * type MyVariant = "rounded" | "square";
749
- * <CardImage<MyVariant> variant="rounded" />
755
+ * type MyVariant = "primary" | "secondary";
756
+ * <Card<MyVariant>
757
+ * header="Primary Card"
758
+ * content={<div>Custom content</div>}
759
+ * variant="primary"
760
+ * state="selected"
761
+ * />
750
762
  * ```
751
763
  */
752
- export declare const CardImage: ForwardRefExoticComponent<CardImageProps<string> & RefAttributes<HTMLDivElement>>;
764
+ export declare const Card: ForwardRefExoticComponent<CardProps<string> & RefAttributes<HTMLDivElement>>;
753
765
 
754
- declare type CardImageCssClasses = ComponentSelected<ComponentsTypesComponents['CARD_IMAGE']>;
766
+ declare type CardCssClasses = ComponentSelected<ComponentsTypesComponents['CARD']>;
755
767
 
756
768
  /**
757
- * Represents the type for a link within the CardImage component.
758
- * Extends the LinkProps interface and includes content.
759
- */
760
- export declare type CardImageLinkProps = Omit<LinkProps, 'children'> & {
761
- content: string;
762
- };
763
-
764
- /**
765
- * Interface for the CardImage component with a variant.
766
- * Extends the CardImageStandAloneProps interface and adds a variant and additional CSS classes.
769
+ * Interface for the card component with a variant.
770
+ * Extends the ICardStandAlone interface and adds a variant and additional CSS classes.
767
771
  *
768
- * @template Variant - The type of the variant for the CardImage.
772
+ * @template Variant - The type of the variant for the card.
769
773
  */
770
- export declare interface CardImageProps<Variant = undefined extends string ? unknown : string> extends Omit<CardImageStandAloneProps, 'device'> {
774
+ export declare interface CardProps<Variant extends string | unknown> extends Omit<CardStandAloneProps, 'cssClasses'> {
771
775
  variant?: Variant;
772
- additionalClasses?: CardImageCssClasses;
776
+ additionalClasses?: Partial<CardCssClasses>;
773
777
  }
774
778
 
775
779
  /**
776
- * Represents the type for responsive images based on device breakpoints.
780
+ * Standalone card component for rendering a section with optional header, content and footer areas.
781
+ *
782
+ * This component displays a styled card container with three optional sections:
783
+ * - header: Can be text or any React node
784
+ * - content: Can be text or any React node
785
+ * - footer: Can be text or any React node
786
+ *
787
+ * Supports interactive states like hover and selected, making it useful for
788
+ * selectable cards, clickable items, or informational panels.
789
+ *
790
+ * This component accepts a generic type parameter `<Variant extends string>` to allow for custom variant values,
791
+ * enabling flexible theming and styling of the card.
792
+ *
793
+ * @example
794
+ * ```tsx
795
+ * <CardStandAlone
796
+ * header={{ content: "Card Title" }}
797
+ * content="Card content goes here"
798
+ * footer={{ content: "Footer text" }}
799
+ * />
800
+ *
801
+ * // With a custom variant type:
802
+ * type MyVariant = "primary" | "secondary";
803
+ * <CardStandAlone<MyVariant>
804
+ * header="Primary Card"
805
+ * content={<div>Custom content</div>}
806
+ * variant="primary"
807
+ * state="selected"
808
+ * />
809
+ * ```
777
810
  */
778
- declare interface CardImageResponsiveImages {
779
- [DEVICE_BREAKPOINTS.DESKTOP]: string;
780
- [DEVICE_BREAKPOINTS.MOBILE]: string;
781
- [DEVICE_BREAKPOINTS.TABLET]: string;
782
- }
811
+ export declare const CardStandAlone: ForwardRefExoticComponent<CardStandAloneProps & RefAttributes<HTMLDivElement>>;
783
812
 
784
813
  /**
785
- * Interface for the standalone CardImage component.
786
- * Includes responsive images, title, description, optional link, and CSS classes.
814
+ * Interface for the standalone card component.
815
+ * It includes optional custom CSS classes, header, content, footer sections and interactive states.
787
816
  */
788
- export declare interface CardImageStandAloneProps extends DataAttributes {
789
- image: CardImageResponsiveImages;
790
- title: CommonTextProps;
791
- description?: CommonTextProps;
792
- link?: CardImageLinkProps;
793
- device: string;
794
- imageAltText?: string;
795
- component?: string | React.ElementType;
796
- onClick?: React.MouseEventHandler;
797
- cssClasses?: CardImageCssClasses;
817
+ export declare interface CardStandAloneProps extends DataAttributes {
818
+ cssClasses?: CardCssClasses;
819
+ header?: CommonTextProps | ReactNode;
820
+ content?: CommonTextProps | ReactNode;
821
+ footer?: CommonTextProps | ReactNode;
822
+ state?: StateType;
823
+ onClick?: React.MouseEventHandler<HTMLDivElement>;
824
+ onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
825
+ onMouseLeave?: React.MouseEventHandler<HTMLDivElement>;
798
826
  }
799
827
 
800
- export declare interface CardImageStyleProps extends CssLibPropsType {
801
- _imageContainer?: CssLibPropsType;
828
+ /**
829
+ * Interface representing the styles for the card component.
830
+ */
831
+ export declare interface CardStyleProps extends CssLibPropsType {
832
+ _header?: CssLibPropsType;
802
833
  _content?: CssLibPropsType;
803
- _textContainer?: CssLibPropsType;
804
- _titleContainer?: CssLibPropsType;
805
- _title?: CssLibPropsType;
806
- _descriptionContainer?: CssLibPropsType;
807
- _description?: CssLibPropsType;
808
- _linkContainer?: CssLibPropsType;
834
+ _footer?: CssLibPropsType;
835
+ $pseudo?: {
836
+ hover?: CssLibPropsType;
837
+ };
809
838
  }
810
839
 
811
- export declare type CardImageVariantStyles<Variant extends string> = CardImageStyleProps & {
812
- [key in Variant]?: CardImageStyleProps;
840
+ /**
841
+ * Type representing the styles for different variants of the card component.
842
+ *
843
+ * @template Variant - The type of the variant keys.
844
+ */
845
+ export declare type CardVariantStyles<Variant extends string> = CardStyleProps & {
846
+ [key in Variant]: CardStyleProps;
813
847
  };
814
848
 
815
849
  export declare const Carousel: ForwardRefExoticComponent<Omit<ICarousel, "ref"> & RefAttributes<CarouselRefType>>;
@@ -1128,7 +1162,7 @@ declare type ComponentSelected<T> = Pick<T, NonVariablesKeys<T>>;
1128
1162
 
1129
1163
  declare type ComponentSelected_2<T> = Pick<T, NonVariablesKeys_2<T>>;
1130
1164
 
1131
- declare type ComponentsTypesAvailableComponents = 'ACCORDION' | 'ALERT' | 'AVATAR' | 'BADGE' | 'BREADCRUMBS' | 'BUTTON' | 'CALENDAR' | 'CARD_IMAGE' | 'CAROUSEL' | 'CHECKBOX' | 'CHECKBOX_BASE' | 'CHIP' | 'CONTAINER' | 'DATA_TABLE' | 'DOT' | 'ERROR_MESSAGE' | 'ICON' | 'INPUT' | 'INPUT_BASE' | 'INPUT_DECORATION' | 'INPUT_SIGNATURE' | 'ITEM_ROVE' | 'LINK' | 'LINK_AS_BUTTON' | 'LIST_OPTIONS' | 'MODAL' | 'OPTION' | 'OVERLAY' | 'PAGE_CONTROL' | 'PAGINATION' | 'POPOVER' | 'PROGRESS_BAR' | 'RADIO_BUTTON' | 'SELECT' | 'SELECTOR_BOX_FILE' | 'SKELETON' | 'SLIDER' | 'SNACKBAR' | 'STEPPER_NUMBER' | 'TABLE' | 'TABLE_BODY' | 'TABLE_CAPTION' | 'TABLE_CELL' | 'TABLE_DIVIDER' | 'TABLE_FOOT' | 'TABLE_HEAD' | 'TABLE_ROW' | 'TABS' | 'TAG' | 'TEXT' | 'TEXT_AREA' | 'TEXT_COUNT' | 'TOGGLE' | 'TOOLTIP' | 'VIRTUAL_KEYBOARD';
1165
+ declare type ComponentsTypesAvailableComponents = 'ACCORDION' | 'ALERT' | 'AVATAR' | 'BADGE' | 'BREADCRUMBS' | 'BUTTON' | 'CALENDAR' | 'CARD' | 'CAROUSEL' | 'CHECKBOX' | 'CHECKBOX_BASE' | 'CHIP' | 'CONTAINER' | 'DATA_TABLE' | 'DOT' | 'ERROR_MESSAGE' | 'ICON' | 'INPUT' | 'INPUT_BASE' | 'INPUT_DECORATION' | 'INPUT_SIGNATURE' | 'ITEM_ROVE' | 'LINK' | 'LINK_AS_BUTTON' | 'LIST_OPTIONS' | 'MODAL' | 'OPTION' | 'OVERLAY' | 'PAGE_CONTROL' | 'PAGINATION' | 'POPOVER' | 'PROGRESS_BAR' | 'RADIO_BUTTON' | 'SELECT' | 'SELECTOR_BOX_FILE' | 'SKELETON' | 'SLIDER' | 'SNACKBAR' | 'STEPPER_NUMBER' | 'TABLE' | 'TABLE_BODY' | 'TABLE_CAPTION' | 'TABLE_CELL' | 'TABLE_DIVIDER' | 'TABLE_FOOT' | 'TABLE_HEAD' | 'TABLE_ROW' | 'TABS' | 'TAG' | 'TEXT' | 'TEXT_AREA' | 'TEXT_COUNT' | 'TOGGLE' | 'TOOLTIP' | 'VIRTUAL_KEYBOARD';
1132
1166
 
1133
1167
  declare type ComponentsTypesComponents = {
1134
1168
  ACCORDION: {
@@ -1306,22 +1340,16 @@ declare type ComponentsTypesComponents = {
1306
1340
  loader: string;
1307
1341
  };
1308
1342
  };
1309
- CARD_IMAGE: {
1310
- card_image: string;
1343
+ CARD: {
1344
+ card: string;
1311
1345
  content: string;
1312
- description: string;
1313
- descriptioncontainer: string;
1314
- imagecontainer: string;
1315
- linkcontainer: string;
1316
- textcontainer: string;
1317
- title: string;
1318
- titlecontainer: string;
1319
- $_alternative: {
1320
- card_image: string;
1321
- };
1346
+ footer: string;
1347
+ header: string;
1322
1348
  $_default: {
1323
- card_image: string;
1324
- description: string;
1349
+ card: string;
1350
+ content: string;
1351
+ footer: string;
1352
+ header: string;
1325
1353
  };
1326
1354
  };
1327
1355
  CAROUSEL: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubit-ui-web/react-components",
3
- "version": "2.0.0-beta.22",
3
+ "version": "2.0.0-beta.23",
4
4
  "description": "Kubit React Components is a customizable, accessible library of React web components, designed to enhance your application's user experience",
5
5
  "author": {
6
6
  "name": "Kubit",
@@ -133,7 +133,7 @@
133
133
  "@testing-library/react": "^16.3.1",
134
134
  "@testing-library/user-event": "^14.6.1",
135
135
  "@trivago/prettier-plugin-sort-imports": "^6.0.2",
136
- "@types/node": "^25.0.3",
136
+ "@types/node": "^25.0.5",
137
137
  "@types/react": "^18.3.12",
138
138
  "@types/react-dom": "^18.3.1",
139
139
  "@types/testing-library__jest-dom": "^6.0.0",
@@ -160,7 +160,7 @@
160
160
  "typescript-eslint": "^8.52.0",
161
161
  "vite": "7.3.1",
162
162
  "vite-plugin-dts": "^4.5.4",
163
- "vite-tsconfig-paths": "^6.0.3",
163
+ "vite-tsconfig-paths": "^6.0.4",
164
164
  "vitest": "^4.0.16",
165
165
  "vitest-axe": "^0.1.0"
166
166
  },
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../_virtual/jsx-runtime.js"),s=require("react"),a=require("../../lib/hooks/useClassName/useClassName.js"),r=require("../../lib/hooks/useMediaDevice/useMediaDevice.js"),i=require("./cardImageStandAlone.js"),t=s.forwardRef(({additionalClasses:s,variant:t,...o},u)=>{const n=r.useMediaDevice(),d=a.useClassName({additionalClassNames:s,component:"CARD_IMAGE",variant:t});return e.jsxRuntimeExports.jsx(i.CardImageStandAlone,{...o,ref:u,cssClasses:d,device:n})});exports.CardImage=t;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../_virtual/jsx-runtime.js"),t=require("react"),s=require("../link/link.js"),i=require("../text/text.js"),o=require("../../lib/utils/pickCustomAttributes/pickCustomAttributes.js"),r=require("../../lib/utils/process/processCommonProp.js"),n=require("../../lib/components/customComponent/customComponent.js"),c=t.forwardRef(({component:t="div",cssClasses:c,description:l,device:a,image:x,imageAltText:m,link:u,onClick:p,title:d,...j},C)=>{const b=o.pickCustomAttributes(j);return e.jsxRuntimeExports.jsxs(n.CustomComponent,{ref:C,className:c?.card_image,component:t,tabIndex:0,onClick:p,...b,children:[e.jsxRuntimeExports.jsx("div",{"aria-label":m||void 0,className:c?.imagecontainer,role:m?"img":void 0,style:x?.[a]?{backgroundImage:`url(${x[a]})`}:void 0}),e.jsxRuntimeExports.jsxs("div",{className:c?.content,children:[e.jsxRuntimeExports.jsxs("div",{className:c?.textcontainer,children:[e.jsxRuntimeExports.jsx(i.Text,{additionalClasses:{text:c?.title},component:"h3",...r.processTextProp(d)}),e.jsxRuntimeExports.jsx(i.Text,{additionalClasses:{text:c?.description},...r.processTextProp(l)})]}),u?.url&&e.jsxRuntimeExports.jsx("div",{className:c?.linkcontainer,children:e.jsxRuntimeExports.jsx(s.Link,{iconPosition:"right",...u,children:u.content||""})})]})]})});exports.CardImageStandAlone=c;
@@ -1,2 +0,0 @@
1
- import{j as s}from"../../_virtual/jsx-runtime.js";import{forwardRef as e}from"react";import{useClassName as a}from"../../lib/hooks/useClassName/useClassName.js";import{useMediaDevice as o}from"../../lib/hooks/useMediaDevice/useMediaDevice.js";import{CardImageStandAlone as i}from"./cardImageStandAlone.js";const r=e(({additionalClasses:e,variant:r,...t},m)=>{const n=o(),l=a({additionalClassNames:e,component:"CARD_IMAGE",variant:r});/* @__PURE__ */
2
- return s.jsx(i,{...t,ref:m,cssClasses:l,device:n})});export{r as CardImage};
@@ -1,7 +0,0 @@
1
- import{j as t}from"../../_virtual/jsx-runtime.js";import{forwardRef as i}from"react";import{Link as s}from"../link/link.js";import{Text as o}from"../text/text.js";import{pickCustomAttributes as e}from"../../lib/utils/pickCustomAttributes/pickCustomAttributes.js";import{processTextProp as n}from"../../lib/utils/process/processCommonProp.js";import{CustomComponent as r}from"../../lib/components/customComponent/customComponent.js";const m=i(({component:i="div",cssClasses:m,description:c,device:l,image:a,imageAltText:d,link:p,onClick:x,title:j,...u},v)=>{const C=e(u);/* @__PURE__ */
2
- return t.jsxs(r,{ref:v,className:m?.card_image,component:i,tabIndex:0,onClick:x,...C,children:[
3
- /* @__PURE__ */t.jsx("div",{"aria-label":d||void 0,className:m?.imagecontainer,role:d?"img":void 0,style:a?.[l]?{backgroundImage:`url(${a[l]})`}:void 0}),
4
- /* @__PURE__ */t.jsxs("div",{className:m?.content,children:[
5
- /* @__PURE__ */t.jsxs("div",{className:m?.textcontainer,children:[
6
- /* @__PURE__ */t.jsx(o,{additionalClasses:{text:m?.title},component:"h3",...n(j)}),
7
- /* @__PURE__ */t.jsx(o,{additionalClasses:{text:m?.description},...n(c)})]}),p?.url&&/* @__PURE__ */t.jsx("div",{className:m?.linkcontainer,children:/* @__PURE__ */t.jsx(s,{iconPosition:"right",...p,children:p.content||""})})]})]})});export{m as CardImageStandAlone};