@digital-b2c/coreui-kit 0.5.1 → 0.5.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/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import * as react from 'react';
3
- import react__default, { ImgHTMLAttributes, ReactNode, AnchorHTMLAttributes, HTMLAttributes, FC, PropsWithChildren } from 'react';
2
+ import * as React$1 from 'react';
3
+ import React__default, { ImgHTMLAttributes, ReactNode, Ref, AnchorHTMLAttributes, HTMLAttributes, FC, PropsWithChildren } from 'react';
4
4
 
5
5
  interface IPicture {
6
6
  src: string;
@@ -19,26 +19,6 @@ type ResponsiveSources = {
19
19
  };
20
20
  type PictureProps = ImgHTMLAttributes<HTMLImageElement> & (SrcOnly | ResponsiveSources);
21
21
 
22
- interface ICta {
23
- label: string;
24
- url: string;
25
- isExternal?: boolean;
26
- }
27
- interface ICtaLogo extends ICta {
28
- logo?: IPicture;
29
- }
30
-
31
- interface BrandsStripProps {
32
- className?: string;
33
- variant?: 'light' | 'dark';
34
- title?: string;
35
- logos?: PictureProps[];
36
- cta?: ICta;
37
- size?: 'small';
38
- }
39
-
40
- declare const BrandsStrip: ({ className, variant, title, logos, cta, size, }: BrandsStripProps) => react_jsx_runtime.JSX.Element;
41
-
42
22
  declare const svgs: {
43
23
  ads: string;
44
24
  book: string;
@@ -93,11 +73,34 @@ declare const svgs: {
93
73
  xWhite: string;
94
74
  };
95
75
  type IconType = keyof typeof svgs;
96
- interface IconProps extends react__default.ComponentPropsWithRef<'svg'> {
76
+ interface IconProps extends React__default.ComponentPropsWithRef<'svg'> {
97
77
  type: IconType;
98
78
  size?: number;
99
79
  }
100
- declare const Icon: react__default.FC<IconProps>;
80
+ declare const Icon: React__default.FC<IconProps>;
81
+
82
+ interface ICta {
83
+ label?: string;
84
+ url: string;
85
+ isExternal?: boolean;
86
+ }
87
+ interface ICtaLogo extends ICta {
88
+ logo?: IPicture;
89
+ }
90
+ interface ICtaIcon extends ICta {
91
+ icon?: IconType;
92
+ }
93
+
94
+ interface BrandsStripProps {
95
+ className?: string;
96
+ variant?: 'light' | 'dark';
97
+ title?: string;
98
+ logos?: PictureProps[];
99
+ cta?: ICta;
100
+ size?: 'small';
101
+ }
102
+
103
+ declare const BrandsStrip: ({ className, variant, title, logos, cta, size, }: BrandsStripProps) => react_jsx_runtime.JSX.Element;
101
104
 
102
105
  declare const ButtonVariantReadOnly: readonly ["primary", "secondary", "ghost", "nofill", "grey", "nofillblack", "shiny"];
103
106
  type TButtonVariant = (typeof ButtonVariantReadOnly)[number];
@@ -126,11 +129,15 @@ interface CardProps {
126
129
  subtitle?: ReactNode;
127
130
  icon?: IconType;
128
131
  logo?: IPicture;
129
- cta?: ICta;
132
+ cta?: ICtaLogo & ICtaIcon;
130
133
  children?: ReactNode;
134
+ ref?: Ref<HTMLDivElement>;
131
135
  }
132
136
 
133
- declare const Card: react.ForwardRefExoticComponent<CardProps & react.RefAttributes<HTMLDivElement>> & {
137
+ declare const Card: {
138
+ ({ className, title, subtitle, cta, icon, logo, children, ref }: CardProps): react_jsx_runtime.JSX.Element;
139
+ displayName: string;
140
+ } & {
134
141
  Title: ({ children }: CardTitleProps) => react_jsx_runtime.JSX.Element;
135
142
  Subtitle: ({ children }: CardSubtitleProps) => react_jsx_runtime.JSX.Element;
136
143
  };
@@ -206,7 +213,7 @@ interface ContainerProps extends HTMLAttributes<HTMLDivElement> {
206
213
  children: ReactNode;
207
214
  }
208
215
 
209
- declare const Container: react.ForwardRefExoticComponent<ContainerProps & react.RefAttributes<HTMLDivElement>>;
216
+ declare const Container: React$1.ForwardRefExoticComponent<ContainerProps & React$1.RefAttributes<HTMLDivElement>>;
210
217
 
211
218
  type ConditionalWrapperProps = {
212
219
  condition: boolean;
@@ -524,4 +531,4 @@ type SlotMap = Record<string, SlotComponent>;
524
531
  */
525
532
  declare function resolveCompoundSlots(children: ReactNode, slots: SlotMap): Record<string, ReactNode>;
526
533
 
527
- export { Anchor, type AnchorProps, BrandsStrip, type BrandsStripProps, Button, type ButtonProps, Card, CardCollection, type CardCollectionProps, type CardProps, ConditionalWrapper, type ConditionalWrapperProps, ContactModule, type ContactModuleProps, Container, type ContainerProps, CountingCard, type CountingCardProps, EventList, type EventListProps, Footer, type FooterProps, HeroBanner, type HeroBannerProps, type ICta, type ICtaLogo, type IPicture, Icon, type IconType, InfoCard, type InfoCardProps, MiniBanner, type MiniBannerProps, MiniSectionCta, type MiniSectionCtaProps, Pagination, type PaginationProps, Picture, type PictureProps, PracticeCard, type PracticeCardProps, PracticePathCards, type PracticePathCardsProps, Teaser5050With3Text, type Teaser5050With3TextProps, Teaser5050WithCta, type Teaser5050WithCtaProps, TextCenterCtaInBottom, type TextCenterCtaInBottomProps, TextEvent, type TextEventProps, resolveCompoundSlots, svgs, useIntersectionObserver };
534
+ export { Anchor, type AnchorProps, BrandsStrip, type BrandsStripProps, Button, type ButtonProps, Card, CardCollection, type CardCollectionProps, type CardProps, ConditionalWrapper, type ConditionalWrapperProps, ContactModule, type ContactModuleProps, Container, type ContainerProps, CountingCard, type CountingCardProps, EventList, type EventListProps, Footer, type FooterProps, HeroBanner, type HeroBannerProps, type ICta, type ICtaIcon, type ICtaLogo, type IPicture, Icon, type IconType, InfoCard, type InfoCardProps, MiniBanner, type MiniBannerProps, MiniSectionCta, type MiniSectionCtaProps, Pagination, type PaginationProps, Picture, type PictureProps, PracticeCard, type PracticeCardProps, PracticePathCards, type PracticePathCardsProps, Teaser5050With3Text, type Teaser5050With3TextProps, Teaser5050WithCta, type Teaser5050WithCtaProps, TextCenterCtaInBottom, type TextCenterCtaInBottomProps, TextEvent, type TextEventProps, resolveCompoundSlots, svgs, useIntersectionObserver };
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import clsx19 from 'clsx';
2
2
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
3
- import React52, { forwardRef, Children, isValidElement, useRef, useState, useCallback, useMemo, useEffect } from 'react';
3
+ import React52, { forwardRef, useRef, useState, useCallback, Children, isValidElement, useMemo, useEffect } from 'react';
4
4
  import gsap$1, { gsap } from 'gsap';
5
5
  import { useGSAP } from '@gsap/react';
6
6
  import { ScrollTrigger } from 'gsap/ScrollTrigger';
@@ -665,40 +665,54 @@ function resolveCompoundSlots(children, slots) {
665
665
  return resolved;
666
666
  }
667
667
 
668
+ // src/components/primitives/Container/Container.module.scss
669
+ var Container_module_default = {
670
+ container: "Container_module_container"
671
+ };
672
+ var Container = forwardRef(
673
+ (_a, ref) => {
674
+ var _b = _a, { children, className } = _b, props = __objRest(_b, ["children", "className"]);
675
+ return /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({ ref, className: clsx19(Container_module_default.container, className) }, props), { children }));
676
+ }
677
+ );
678
+ Container.displayName = "Container";
679
+
668
680
  // src/components/Card/Card.module.scss
669
681
  var Card_module_default = {
670
682
  card: "Card_module_card",
671
683
  logo: "Card_module_logo",
672
684
  subtitle: "Card_module_subtitle"
673
685
  };
674
- var Card = forwardRef(
675
- ({ className, title, subtitle, cta, icon, logo, children }, ref) => {
676
- var _a, _b;
677
- const slots = resolveCompoundSlots(children, {
678
- title: CardTitle,
679
- subtitle: CardSubtitle
680
- });
681
- const titleNode = (_a = slots.title) != null ? _a : title;
682
- const subtitleNode = (_b = slots.subtitle) != null ? _b : subtitle;
683
- return /* @__PURE__ */ jsxs("div", { ref, className: clsx19(Card_module_default.card, className), children: [
684
- (logo == null ? void 0 : logo.src) ? /* @__PURE__ */ jsx(Picture, __spreadValues({ className: Card_module_default.logo }, logo)) : icon && /* @__PURE__ */ jsx(Icon, { type: icon, className: Card_module_default.logo }),
685
- /* @__PURE__ */ jsxs("div", { className: Card_module_default.content, children: [
686
- titleNode && /* @__PURE__ */ jsx("h3", { className: "h4", children: titleNode }),
687
- subtitleNode && /* @__PURE__ */ jsx("div", { className: Card_module_default.subtitle, children: subtitleNode })
688
- ] }),
689
- cta && /* @__PURE__ */ jsx(
690
- Button,
691
- {
692
- href: cta.url,
693
- isExternal: cta.isExternal,
694
- variant: "secondary",
695
- icon: cta.url ? "rightBlack" : void 0,
696
- children: cta.label
697
- }
698
- )
699
- ] });
700
- }
701
- );
686
+ var Card = ({ className, title, subtitle, cta, icon, logo, children, ref }) => {
687
+ var _a, _b;
688
+ const { url: href, label, isExternal } = cta != null ? cta : {};
689
+ const slots = resolveCompoundSlots(children, {
690
+ title: CardTitle,
691
+ subtitle: CardSubtitle
692
+ });
693
+ const titleNode = (_a = slots.title) != null ? _a : title;
694
+ const subtitleNode = (_b = slots.subtitle) != null ? _b : subtitle;
695
+ console.log(href && !label, href, !label);
696
+ return /* @__PURE__ */ jsxs(
697
+ ConditionalWrapper,
698
+ __spreadProps(__spreadValues({
699
+ ref,
700
+ className: clsx19(Card_module_default.card, className),
701
+ wrapper: Anchor,
702
+ fallback: "div",
703
+ condition: href && !label
704
+ }, href ? { href, isExternal } : {}), {
705
+ children: [
706
+ (logo == null ? void 0 : logo.src) ? /* @__PURE__ */ jsx(Picture, __spreadValues({ className: Card_module_default.logo }, logo)) : icon && /* @__PURE__ */ jsx(Icon, { type: icon, className: Card_module_default.logo }),
707
+ /* @__PURE__ */ jsxs("div", { className: Card_module_default.content, children: [
708
+ titleNode && /* @__PURE__ */ jsx("h3", { className: "h4", children: titleNode }),
709
+ subtitleNode && /* @__PURE__ */ jsx("div", { className: Card_module_default.subtitle, children: subtitleNode })
710
+ ] }),
711
+ (cta == null ? void 0 : cta.label) && /* @__PURE__ */ jsx(Button, { href: cta.url, isExternal: cta.isExternal, variant: "secondary", icon: cta.icon, children: cta.label })
712
+ ]
713
+ })
714
+ );
715
+ };
702
716
  Card.displayName = "Card";
703
717
 
704
718
  // src/components/Card/index.ts
@@ -861,18 +875,6 @@ var Pagination = ({
861
875
  ] });
862
876
  };
863
877
 
864
- // src/components/primitives/Container/Container.module.scss
865
- var Container_module_default = {
866
- container: "Container_module_container"
867
- };
868
- var Container = forwardRef(
869
- (_a, ref) => {
870
- var _b = _a, { children, className } = _b, props = __objRest(_b, ["children", "className"]);
871
- return /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({ ref, className: clsx19(Container_module_default.container, className) }, props), { children }));
872
- }
873
- );
874
- Container.displayName = "Container";
875
-
876
878
  // src/components/PracticeCard/PracticeCard.module.scss
877
879
  var PracticeCard_module_default = {
878
880
  "practice-card": "PracticeCard_module_practice-card",