@cleartrip/ct-design-card 4.0.0 → 4.1.0-SNAPSHOT-native-main.1

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/README.md ADDED
@@ -0,0 +1,121 @@
1
+ # Card
2
+
3
+ A container component that displays content in a card-like layout with elevation.
4
+
5
+ ---
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @cleartrip/ct-design-card
11
+ # or
12
+ pnpm add @cleartrip/ct-design-card
13
+ ```
14
+
15
+ ### Peer dependencies
16
+
17
+ ```bash
18
+ # Required for all targets
19
+ npm install react
20
+
21
+ # Web only
22
+ npm install react-dom
23
+
24
+ # React Native only
25
+ npm install react-native
26
+ ```
27
+
28
+ ---
29
+
30
+ ## Usage
31
+
32
+ ### Basic
33
+
34
+ ```tsx
35
+ import { Card } from '@cleartrip/ct-design-card';
36
+
37
+ function Example() {
38
+ return (
39
+ <Card>
40
+ {/* Basic usage */}
41
+ </Card>
42
+ );
43
+ }
44
+ ```
45
+
46
+ ---
47
+
48
+ ## Props
49
+
50
+ | Prop | Type | Default | Required | Description |
51
+ |------|------|---------|----------|-------------|
52
+ | `borderWidth` | `CardBorderWidthType` | — | No | Set border width of card. Defaults to 'md'. |
53
+ | `cornerRadius` | `CardRadiusType` | — | No | Set the radius of card corners. Defaults to 'md'. |
54
+ | `showShadow` | `boolean` | — | No | Show shadow on the card. Defaults to true. |
55
+ | `shadowDirection` | `CardShadowDirectionType` | — | No | Direction of the shadow. Defaults to 'top' (web only — RN uses standard |
56
+ | `shadowVariant` | `CardShadowVariantType` | — | No | Variant of the shadow. Maps to the theme elevation tokens. Defaults to |
57
+ | `borderDirection` | `CardBorderDirectionType` | — | No | Direction of the border. Defaults to 'default' (all sides). |
58
+ | `noBorder` | `boolean` | — | No | When true, skips rendering the border but keeps the rounded corners. |
59
+ | `children` | `ReactNode` | — | No | Content rendered inside the card. |
60
+ | `styleConfig` | `ICardStyleConfig` | — | No | Style configuration overrides for the root container. |
61
+ | `onClick` | `IContainer['onClick']` | — | No | Callback fired when the card is clicked or pressed. |
62
+ | `onLayout` | `IContainer['onLayout']` | — | No | Callback fired when the card is layout changed. |
63
+
64
+ ---
65
+
66
+ ## CardRadius
67
+
68
+ - `NONE` — none
69
+ - `SMALL` — sm
70
+ - `MEDIUM` — md
71
+ - `LARGE` — lg
72
+ - `EXTRA_LARGE` — xl
73
+ ---
74
+
75
+ ## CardBorderWidth
76
+
77
+ - `NONE` — none
78
+ - `SMALL` — sm
79
+ - `MEDIUM` — md
80
+ - `LARGE` — lg
81
+ ---
82
+
83
+ ## CardShadowDirection
84
+
85
+ - `TOP` — top
86
+ - `BOTTOM` — bottom
87
+ ---
88
+
89
+ ## CardShadowVariant
90
+
91
+ - `E1` — E1
92
+ - `E2` — E2
93
+ - `E3` — E3
94
+ - `E4` — E4
95
+ ---
96
+
97
+ ## CardBorderDirection
98
+
99
+ - `TOP` — top
100
+ - `BOTTOM` — bottom
101
+ - `LEFT` — left
102
+ - `RIGHT` — right
103
+ - `DEFAULT` — default
104
+ ---
105
+
106
+ ## Accessibility
107
+
108
+ - The component follows accessibility best practices
109
+ - Ensure proper ARIA attributes are provided where needed
110
+ - Test with screen readers to ensure usability
111
+
112
+ ---
113
+
114
+ ## Migration
115
+
116
+ If migrating from a previous version:
117
+
118
+ ```diff
119
+ - import { Card } from 'yagami/core/components';
120
+ + import { Card } from '@cleartrip/ct-design-card';
121
+ ```
package/dist/Card.d.ts CHANGED
@@ -1,6 +1,5 @@
1
- import { CardProps } from './type';
2
- import { ForwardRefComponentWithStyle } from '@cleartrip/ct-design-types';
3
- type PolymorphicCard = ForwardRefComponentWithStyle<'div', CardProps>;
4
- declare const Card: PolymorphicCard;
1
+ import { ContainerRef } from '@cleartrip/ct-design-container';
2
+ import { ICardProps } from './type';
3
+ declare const Card: import("react").ForwardRefExoticComponent<ICardProps & import("react").RefAttributes<ContainerRef>>;
5
4
  export default Card;
6
5
  //# sourceMappingURL=Card.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../packages/components/Card/src/Card.tsx"],"names":[],"mappings":"AAIA,OAAO,EAGL,SAAS,EAIV,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,4BAA4B,EAAY,MAAM,4BAA4B,CAAC;AAGpF,KAAK,eAAe,GAAG,4BAA4B,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AAMtE,QAAA,MAAM,IAAI,iBAmCU,CAAC;AAErB,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../packages/components/Card/src/Card.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAa,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAEzE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,QAAA,MAAM,IAAI,qGAQR,CAAC;AAGH,eAAe,IAAI,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { ContainerRef } from '@cleartrip/ct-design-container';
2
+ declare const Card: import("react").ForwardRefExoticComponent<import("./type").ICardProps & import("react").RefAttributes<ContainerRef>>;
3
+ export default Card;
4
+ //# sourceMappingURL=Card.native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Card.native.d.ts","sourceRoot":"","sources":["../packages/components/Card/src/Card.native.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAa,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAOzE,QAAA,MAAM,IAAI,sHAsDT,CAAC;AAIF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,43 @@
1
+ export declare enum CardSize {
2
+ NONE = "none",
3
+ SMALL = "sm",
4
+ MEDIUM = "md",
5
+ LARGE = "lg",
6
+ EXTRA_LARGE = "xl"
7
+ }
8
+ export declare enum CardRadius {
9
+ NONE = "none",
10
+ SMALL = "sm",
11
+ MEDIUM = "md",
12
+ LARGE = "lg",
13
+ EXTRA_LARGE = "xl"
14
+ }
15
+ export declare enum CardBorderWidth {
16
+ NONE = "none",
17
+ SMALL = "sm",
18
+ MEDIUM = "md",
19
+ LARGE = "lg"
20
+ }
21
+ export declare enum CardShadowDirection {
22
+ TOP = "top",
23
+ BOTTOM = "bottom"
24
+ }
25
+ export declare enum CardShadowVariant {
26
+ E1 = "E1",
27
+ E2 = "E2",
28
+ E3 = "E3",
29
+ E4 = "E4"
30
+ }
31
+ export declare enum CardBorderDirection {
32
+ TOP = "top",
33
+ BOTTOM = "bottom",
34
+ LEFT = "left",
35
+ RIGHT = "right",
36
+ DEFAULT = "default"
37
+ }
38
+ export declare const CardBorderColors: {
39
+ readonly PRIMARY: string;
40
+ readonly SECONDARY: string;
41
+ readonly TERTIARY: string;
42
+ };
43
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../packages/components/Card/src/constants.ts"],"names":[],"mappings":"AAEA,oBAAY,QAAQ;IAClB,IAAI,SAAS;IACb,KAAK,OAAO;IACZ,MAAM,OAAO;IACb,KAAK,OAAO;IACZ,WAAW,OAAO;CACnB;AAED,oBAAY,UAAU;IACpB,IAAI,SAAS;IACb,KAAK,OAAO;IACZ,MAAM,OAAO;IACb,KAAK,OAAO;IACZ,WAAW,OAAO;CACnB;AAED,oBAAY,eAAe;IACzB,IAAI,SAAS;IACb,KAAK,OAAO;IACZ,MAAM,OAAO;IACb,KAAK,OAAO;CACb;AAED,oBAAY,mBAAmB;IAC7B,GAAG,QAAQ;IACX,MAAM,WAAW;CAClB;AAED,oBAAY,iBAAiB;IAC3B,EAAE,OAAO;IACT,EAAE,OAAO;IACT,EAAE,OAAO;IACT,EAAE,OAAO;CACV;AAED,oBAAY,mBAAmB;IAC7B,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,OAAO,YAAY;CACpB;AAED,eAAO,MAAM,gBAAgB;;;;CAInB,CAAC"}
@@ -1,2 +1,2 @@
1
- "use strict";var r=require("tslib"),e=require("react/jsx-runtime"),o=require("react"),t=require("@cleartrip/ct-design-theme");function d(r){return r&&r.__esModule?r:{default:r}}var a,i,s,n,c,u=d(require("styled-components"));exports.CardRadius=void 0,(a=exports.CardRadius||(exports.CardRadius={})).NONE="none",a.SMALL="sm",a.MEDIUM="md",a.LARGE="lg",a.EXTRA_LARGE="xl",exports.CardBorderWidth=void 0,(i=exports.CardBorderWidth||(exports.CardBorderWidth={})).NONE="none",i.SMALL="sm",i.MEDIUM="md",i.LARGE="lg",exports.CardShadowDirection=void 0,(s=exports.CardShadowDirection||(exports.CardShadowDirection={})).TOP="top",s.BOTTOM="bottom",exports.CardShadowVariant=void 0,(n=exports.CardShadowVariant||(exports.CardShadowVariant={})).E1="E1",n.E2="E2",n.E3="E3",n.E4="E4",exports.CardBorderDirection=void 0,(c=exports.CardBorderDirection||(exports.CardBorderDirection={})).TOP="top",c.BOTTOM="bottom",c.LEFT="left",c.RIGHT="right",c.DEFAULT="default";var h=function(r,e){switch(r){case exports.CardRadius.NONE:return e.border.radius[0];case exports.CardRadius.SMALL:return e.border.radius[6];case exports.CardRadius.MEDIUM:return e.border.radius[8];case exports.CardRadius.LARGE:return e.border.radius[12];case exports.CardRadius.EXTRA_LARGE:return e.border.radius[16];default:return e.border.radius[8]}},p=function(r,e){switch(r){case exports.CardRadius.NONE:return e.border.width.none;case exports.CardRadius.SMALL:return e.border.width.sm;case exports.CardRadius.MEDIUM:return e.border.width.md;case exports.CardRadius.LARGE:return e.border.width.lg;default:return e.border.width.md}},b=function(r,e,o,t){switch(r){case exports.CardBorderDirection.DEFAULT:return{border:"".concat(e," ").concat(o," ").concat(t)};case exports.CardBorderDirection.TOP:return{borderTop:"".concat(e," ").concat(o," ").concat(t)};case exports.CardBorderDirection.BOTTOM:return{borderBottom:"".concat(e," ").concat(o," ").concat(t)};case exports.CardBorderDirection.LEFT:return{borderLeft:"".concat(e," ").concat(o," ").concat(t)};case exports.CardBorderDirection.RIGHT:return{borderRight:"".concat(e," ").concat(o," ").concat(t)};default:return{border:"".concat(e," ").concat(o," ").concat(t)}}},x=function(e,o,t,d,a){var i=h(o,d),s=d.border.style.solid,n=d.color.border.default,c=p(e,d),u=b(t,c,s,n);return a?{borderRadius:i}:r.__assign({borderRadius:i},u)},C=function(r,e){switch(r){case exports.CardShadowVariant.E1:return e.elevation.topE1;case exports.CardShadowVariant.E2:return e.elevation.topE2;case exports.CardShadowVariant.E3:return e.elevation.topE3;case exports.CardShadowVariant.E4:return e.elevation.topE4;default:return e.elevation.topE2}},w=function(r,e){switch(r){case exports.CardShadowVariant.E1:return e.elevation.bottomE1;case exports.CardShadowVariant.E2:return e.elevation.bottomE2;case exports.CardShadowVariant.E3:return e.elevation.bottomE3;case exports.CardShadowVariant.E4:return e.elevation.bottomE4;default:return e.elevation.bottomE2}},E=function(r,e,o){switch(r){case exports.CardShadowDirection.TOP:return C(e,o);case exports.CardShadowDirection.BOTTOM:default:return w(e,o)}},l=function(e){var o=e.cornerRadius,t=e.borderWidth,d=e.showShadow,a=e.shadowDirection,i=e.shadowVariant,s=e.borderDirection,n=e.theme,c=e.noBorder;return r.__assign({boxShadow:d?E(a,i,n):"none"},x(t,o,s,n,c))},R=u.default.div((function(e){var o=e.css,t=e.theme,d=r.__rest(e,["css","theme"]);return function(e){var o=e.borderRadius,t=e.border,d=e.borderTop,a=e.borderBottom,i=e.borderLeft,s=e.borderRight,n=e.boxShadow,c=e.borderColor,u=e.theme,h=r.__rest(e,["borderRadius","border","borderTop","borderBottom","borderLeft","borderRight","boxShadow","borderColor","theme"]);return r.__assign({borderRadius:o,border:t,borderTop:d,borderBottom:a,borderLeft:i,borderRight:s,boxShadow:n,borderColor:c,backgroundColor:u.color.background.neutral},h)}(r.__assign(r.__assign(r.__assign({},o),{theme:t}),d))})),S=o.forwardRef((function(o,d){var a=o.children,i=o.cornerRadius,s=void 0===i?exports.CardRadius.MEDIUM:i,n=o.borderWidth,c=void 0===n?exports.CardBorderWidth.MEDIUM:n,u=o.showShadow,h=void 0===u||u,p=o.shadowDirection,b=void 0===p?exports.CardShadowDirection.TOP:p,x=o.shadowVariant,C=void 0===x?exports.CardShadowVariant.E2:x,w=o.borderDirection,E=void 0===w?exports.CardBorderDirection.DEFAULT:w,S=o.css;o.onChange;var D=o.noBorder,v=void 0!==D&&D,m=r.__rest(o,["children","cornerRadius","borderWidth","showShadow","shadowDirection","shadowVariant","borderDirection","css","onChange","noBorder"]),f=t.useTheme(),g=l({cornerRadius:s,borderWidth:c,showShadow:h,shadowDirection:b,shadowVariant:C,borderDirection:E,theme:f,noBorder:v});return e.jsx(R,r.__assign({ref:d,css:r.__assign(r.__assign({},g),S)},m,{theme:f},{children:a}))}));exports.Card=S,exports.getBorderDirectionStyles=b,exports.getBottomShadow=w,exports.getCardBorderRadius=h,exports.getCardBorderStyles=x,exports.getCardBorderWidth=p,exports.getCardShadowStyles=E,exports.getCardStyles=l,exports.getTopShadow=C;
1
+ "use strict";var r=require("react/jsx-runtime"),e=require("react"),o=require("@cleartrip/ct-design-container"),d=require("@cleartrip/ct-design-tokens");const t=e.forwardRef(({children:e,styleConfig:d,onClick:t},s)=>{const{root:a=[]}=d||{};return r.jsx(o.Container,{ref:s,onClick:t,styleConfig:{root:[...a]},children:e})});var s,a,i,n,c,u;t.displayName="Card",exports.CardSize=void 0,(s=exports.CardSize||(exports.CardSize={})).NONE="none",s.SMALL="sm",s.MEDIUM="md",s.LARGE="lg",s.EXTRA_LARGE="xl",exports.CardRadius=void 0,(a=exports.CardRadius||(exports.CardRadius={})).NONE="none",a.SMALL="sm",a.MEDIUM="md",a.LARGE="lg",a.EXTRA_LARGE="xl",exports.CardBorderWidth=void 0,(i=exports.CardBorderWidth||(exports.CardBorderWidth={})).NONE="none",i.SMALL="sm",i.MEDIUM="md",i.LARGE="lg",exports.CardShadowDirection=void 0,(n=exports.CardShadowDirection||(exports.CardShadowDirection={})).TOP="top",n.BOTTOM="bottom",exports.CardShadowVariant=void 0,(c=exports.CardShadowVariant||(exports.CardShadowVariant={})).E1="E1",c.E2="E2",c.E3="E3",c.E4="E4",exports.CardBorderDirection=void 0,(u=exports.CardBorderDirection||(exports.CardBorderDirection={})).TOP="top",u.BOTTOM="bottom",u.LEFT="left",u.RIGHT="right",u.DEFAULT="default";const l={PRIMARY:d.colors.black,SECONDARY:d.colors.success,TERTIARY:d.colors.warning},C=(r,e)=>{switch(r){case exports.CardSize.NONE:return e.border.radius[0];case exports.CardSize.SMALL:return e.border.radius[6];case exports.CardSize.MEDIUM:return e.border.radius[8];case exports.CardSize.LARGE:return e.border.radius[12];case exports.CardSize.EXTRA_LARGE:return e.border.radius[16];default:return e.border.radius[8]}},p=(r,e)=>{switch(r){case exports.CardSize.NONE:return e.border.width.none;case exports.CardSize.SMALL:return e.border.width.sm;case exports.CardSize.MEDIUM:return e.border.width.md;case exports.CardSize.LARGE:return e.border.width.lg;default:return e.border.width.md}},b=(r,e,o,d)=>({borderWidth:e,borderStyle:o,borderColor:d}),x=(r,e,o,d,t,s)=>{const a=C(e,t),i=t.border.style.solid,n=p(r,t),c=b(0,n,i,d);return s?{borderRadius:a}:Object.assign({borderRadius:a},c)};exports.Card=t,exports.CardBorderColors=l,exports.getBorderDirectionStyles=b,exports.getCardBorderRadius=C,exports.getCardBorderStyles=x,exports.getCardBorderWidth=p,exports.getCardStyles=({borderColor:r,cornerRadius:e,borderWidth:o,showShadow:d,shadowColor:t,shadowOffset:s,shadowOpacity:a,elevation:i,borderDirection:n,theme:c})=>{const u=d?{shadowColor:t,shadowOffset:s,shadowOpacity:a,shadowRadius:2,elevation:i}:{},l=x(o,e,0,r,c);return Object.assign(Object.assign({},u),l)},exports.getDefaultCardStyles=(r,e)=>{switch(e){case exports.CardSize.LARGE:return{height:r.size[12],borderRadius:r.border.radius[24],borderStyle:r.border.style.solid};case exports.CardSize.MEDIUM:return{height:r.size[10],borderRadius:r.border.radius[20],borderStyle:r.border.style.solid};case exports.CardSize.SMALL:return{height:r.size[8],borderRadius:r.border.radius[16],borderStyle:r.border.style.solid};default:return{height:r.size[10],borderRadius:r.border.radius[20],borderStyle:r.border.style.solid}}};
2
2
  //# sourceMappingURL=ct-design-card.browser.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ct-design-card.browser.cjs.js","sources":["../packages/components/Card/src/type.ts","../packages/components/Card/src/style.ts","../packages/components/Card/src/Card.tsx","../packages/components/Card/src/StyledCard/style.ts"],"sourcesContent":[null,null,null,null],"names":["CardRadius","CardBorderWidth","CardShadowDirection","CardShadowVariant","CardBorderDirection","getCardBorderRadius","cornerRadius","theme","NONE","border","radius","SMALL","MEDIUM","LARGE","EXTRA_LARGE","getCardBorderWidth","borderWidth","width","none","sm","md","lg","getBorderDirectionStyles","borderDirection","borderStyle","borderColor","DEFAULT","concat","TOP","borderTop","BOTTOM","borderBottom","LEFT","borderLeft","RIGHT","borderRight","getCardBorderStyles","cardBorderWidth","noBorder","borderRadius","style","solid","color","default","getTopShadow","shadowVariant","E1","elevation","topE1","E2","topE2","E3","topE3","E4","topE4","getBottomShadow","bottomE1","bottomE2","bottomE3","bottomE4","getCardShadowStyles","shadowDirection","getCardStyles","_a","showShadow","__assign","boxShadow","StyledCard","styled","div","css","rest","__rest","backgroundColor","background","neutral","getStyledCardStyled","Card","forwardRef","forwardedRef","children","_b","_c","_d","_e","_f","_g","onChange","_h","useTheme","cardStyles","_jsx","ref"],"mappings":"qLAEYA,EAUAC,EASAC,EAOAC,EASAC,oCAnCAJ,QAMXA,gBAAA,GANWA,EAAAA,qBAAAA,QAAAA,WAMX,CAAA,IALC,KAAA,OACAA,EAAA,MAAA,KACAA,EAAA,OAAA,KACAA,EAAA,MAAA,KACAA,EAAA,YAAA,KAKUC,QAKXA,qBAAA,GALWA,EAAAA,0BAAAA,QAAAA,gBAKX,CAAA,IAJC,KAAA,OACAA,EAAA,MAAA,KACAA,EAAA,OAAA,KACAA,EAAA,MAAA,KAKUC,QAGXA,yBAAA,GAHWA,EAAAA,8BAAAA,QAAA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AUA,EACVE,YAAWA,EACX+B,YACAzC,YAAWA,EACXgD,gBAAiBlE,EAAMmC,MAAMgC,WAAWC,SACrCJ,EAEP,CDTEK,qCAAyBN,GAAG,CAAE/D,MAAKA,IAAKgE,GAAO,IAG3CM,EAAOC,EAAUA,YACrB,SACEf,EAaAgB,GAZE,IAAAC,EAAQjB,EAAAiB,SACRC,EAAAlB,EAAAzD,aAAAA,OAAY,IAAA2E,EAAGjF,mBAAWY,OAAMqE,EAChCC,EAAAnB,EAAA/C,YAAAA,OAAW,IAAAkE,EAAGjF,wBAAgBW,OAAMsE,EACpCC,EAAApB,EAAAC,WAAAA,OAAU,IAAAmB,GAAOA,EACjBC,EAAyCrB,EAAAF,gBAAzCA,OAAe,IAAAuB,EAAGlF,QAAmBA,oBAAC0B,IAAGwD,EACzCC,EAAoCtB,EAAAlB,cAApCA,OAAa,IAAAwC,EAAGlF,0BAAkB8C,GAAEoC,EACpCC,oBAAA/D,OAAkB,IAAA+D,EAAAlF,4BAAoBsB,QAAO4D,EAC7ChB,EAAGP,EAAAO,IACKP,EAAAwB,aACRC,EAAgBzB,EAAAzB,SAAhBA,OAAQ,IAAAkD,GAAQA,EACbjB,EAAIC,EAAAA,OAAAT,EAXT,wIAeMxD,EAAQkF,EAAAA,WACRC,EAAa5B,EAAc,CAC/BxD,aAAYA,EACZU,YAAWA,EACXgD,WAAUA,EACVH,gBAAeA,EACfhB,cAAaA,EACbtB,gBAAeA,EACfhB,MAAKA,EACL+B,SAAQA,IAGV,OACEqD,MAACxB,EAAUF,EAAAA,SAAA,CAAC2B,IAAKb,EAAcT,IAAUL,EAAAA,SAAAA,EAAAA,SAAA,GAAAyB,GAAepB,IAAWC,EAAI,CAAEhE,MAAOA,GAC7E,CAAAyE,SAAAA,IAGP"}
1
+ {"version":3,"file":"ct-design-card.browser.cjs.js","sources":["../packages/components/Card/src/Card.tsx","../packages/components/Card/src/constants.ts","../packages/components/Card/src/style.ts"],"sourcesContent":[null,null,null],"names":["Card","forwardRef","children","styleConfig","onClick","forwardedRef","root","_jsx","Container","ref","CardSize","CardRadius","CardBorderWidth","CardShadowDirection","CardShadowVariant","CardBorderDirection","displayName","CardBorderColors","PRIMARY","colors","black","SECONDARY","success","TERTIARY","warning","getCardBorderRadius","cornerRadius","theme","NONE","border","radius","SMALL","MEDIUM","LARGE","EXTRA_LARGE","getCardBorderWidth","borderWidth","width","none","sm","md","lg","getBorderDirectionStyles","_borderDirection","borderStyle","borderColor","getCardBorderStyles","cardBorderWidth","borderDirection","noBorder","borderRadius","style","solid","Object","assign","showShadow","shadowColor","shadowOffset","shadowOpacity","elevation","shadowStyles","shadowRadius","borderStyles","size","height"],"mappings":"wJAMA,MAAMA,EAAOC,EAAUA,WAA2B,EAAGC,WAAUC,cAAaC,WAAWC,KACrF,MAAMC,KAAEA,EAAO,IAAOH,GAAe,CAAA,EAErC,OACEI,EAAAA,IAACC,EAAAA,UAAU,CAAAC,IAAKJ,EAAcD,QAASA,EAASD,YAAa,CAAEG,KAAM,IAAIA,IACtEJ,SAAAA,MCTP,IAAYQ,EAQAC,EAQAC,EAOAC,EAKAC,EAOAC,EDrBZf,EAAKgB,YAAc,OCdPN,QAMXA,cAAA,GANWA,EAAAA,mBAAAA,QAAAA,SAMX,CAAA,IALC,KAAA,OACAA,EAAA,MAAA,KACAA,EAAA,OAAA,KACAA,EAAA,MAAA,KACAA,EAAA,YAAA,KAGUC,QAMXA,gBAAA,GANWA,EAAAA,qBAAAA,QAAAA,WAMX,CAAA,IALC,KAAA,OACAA,EAAA,MAAA,KACAA,EAAA,OAAA,KACAA,EAAA,MAAA,KACAA,EAAA,YAAA,KAGUC,QAKXA,qBAAA,GALWA,EAAAA,0BAAAA,QAAAA,gBAKX,CAAA,IAJC,KAAA,OACAA,EAAA,MAAA,KACAA,EAAA,OAAA,KACAA,EAAA,MAAA,KAGUC,QAGXA,yBAAA,GAHWA,EAAAA,8BAAAA,QAAAA,oBAGX,CAAA,IAFC,IAAA,MACAA,EAAA,OAA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,EACAsB,KAEA,MAAMC,EAAezB,EAAoBC,EAAcC,GACjDiB,EAAcjB,EAAME,OAAOsB,MAAMC,MACjChB,EAAcD,EAAmBY,EAAiBpB,GAClDE,EAASa,EAAyBM,EAAiBZ,EAAaQ,EAAaC,GACnF,OAAOI,EACH,CAAEC,gBAEAG,OAAAC,OAAA,CAAAJ,gBACGrB,gMAmDkB,EAC3BgB,cACAnB,eACAU,cACAmB,aACAC,cACAC,eACAC,gBACAC,YACAX,kBACArB,YAaA,MAAMiC,EAAeL,EACjB,CACEC,cACAC,eACAC,gBACAG,aAAc,EACdF,aAEF,GAEEG,EAAehB,EAAoBV,EAAaV,EAAcsB,EAAiBH,EAAalB,GAElG,OACK0B,OAAAC,OAAAD,OAAAC,OAAA,CAAA,EAAAM,GACAE,iCA9E6B,CAACnC,EAAcoC,KACjD,OAAQA,GACN,KAAKrD,QAAQA,SAACuB,MACZ,MAAO,CACL+B,OAAQrC,EAAMoC,KAAK,IACnBb,aAAcvB,EAAME,OAAOC,OAAO,IAClCc,YAAajB,EAAME,OAAOsB,MAAMC,OAEpC,KAAK1C,QAAQA,SAACsB,OACZ,MAAO,CACLgC,OAAQrC,EAAMoC,KAAK,IACnBb,aAAcvB,EAAME,OAAOC,OAAO,IAClCc,YAAajB,EAAME,OAAOsB,MAAMC,OAEpC,KAAK1C,QAAQA,SAACqB,MACZ,MAAO,CACLiC,OAAQrC,EAAMoC,KAAK,GACnBb,aAAcvB,EAAME,OAAOC,OAAO,IAClCc,YAAajB,EAAME,OAAOsB,MAAMC,OAEpC,QACE,MAAO,CACLY,OAAQrC,EAAMoC,KAAK,IACnBb,aAAcvB,EAAME,OAAOC,OAAO,IAClCc,YAAajB,EAAME,OAAOsB,MAAMC"}
@@ -1,2 +1,2 @@
1
- import{__rest as r,__assign as o}from"tslib";import{jsx as e}from"react/jsx-runtime";import{forwardRef as t}from"react";import{useTheme as n}from"@cleartrip/ct-design-theme";import d from"styled-components";var a,c,i,s,u;!function(r){r.NONE="none",r.SMALL="sm",r.MEDIUM="md",r.LARGE="lg",r.EXTRA_LARGE="xl"}(a||(a={})),function(r){r.NONE="none",r.SMALL="sm",r.MEDIUM="md",r.LARGE="lg"}(c||(c={})),function(r){r.TOP="top",r.BOTTOM="bottom"}(i||(i={})),function(r){r.E1="E1",r.E2="E2",r.E3="E3",r.E4="E4"}(s||(s={})),function(r){r.TOP="top",r.BOTTOM="bottom",r.LEFT="left",r.RIGHT="right",r.DEFAULT="default"}(u||(u={}));var b=function(r,o){switch(r){case a.NONE:return o.border.radius[0];case a.SMALL:return o.border.radius[6];case a.MEDIUM:return o.border.radius[8];case a.LARGE:return o.border.radius[12];case a.EXTRA_LARGE:return o.border.radius[16];default:return o.border.radius[8]}},h=function(r,o){switch(r){case a.NONE:return o.border.width.none;case a.SMALL:return o.border.width.sm;case a.MEDIUM:return o.border.width.md;case a.LARGE:return o.border.width.lg;default:return o.border.width.md}},E=function(r,o,e,t){switch(r){case u.DEFAULT:return{border:"".concat(o," ").concat(e," ").concat(t)};case u.TOP:return{borderTop:"".concat(o," ").concat(e," ").concat(t)};case u.BOTTOM:return{borderBottom:"".concat(o," ").concat(e," ").concat(t)};case u.LEFT:return{borderLeft:"".concat(o," ").concat(e," ").concat(t)};case u.RIGHT:return{borderRight:"".concat(o," ").concat(e," ").concat(t)};default:return{border:"".concat(o," ").concat(e," ").concat(t)}}},m=function(r,e,t,n,d){var a=b(e,n),c=n.border.style.solid,i=n.color.border.default,s=h(r,n),u=E(t,s,c,i);return d?{borderRadius:a}:o({borderRadius:a},u)},l=function(r,o){switch(r){case s.E1:return o.elevation.topE1;case s.E2:return o.elevation.topE2;case s.E3:return o.elevation.topE3;case s.E4:return o.elevation.topE4;default:return o.elevation.topE2}},f=function(r,o){switch(r){case s.E1:return o.elevation.bottomE1;case s.E2:return o.elevation.bottomE2;case s.E3:return o.elevation.bottomE3;case s.E4:return o.elevation.bottomE4;default:return o.elevation.bottomE2}},w=function(r,o,e){switch(r){case i.TOP:return l(o,e);case i.BOTTOM:default:return f(o,e)}},v=function(r){var e=r.cornerRadius,t=r.borderWidth,n=r.showShadow,d=r.shadowDirection,a=r.shadowVariant,c=r.borderDirection,i=r.theme,s=r.noBorder;return o({boxShadow:n?w(d,a,i):"none"},m(t,e,c,i,s))},T=d.div((function(e){var t=e.css,n=e.theme,d=r(e,["css","theme"]);return function(e){var t=e.borderRadius,n=e.border,d=e.borderTop,a=e.borderBottom,c=e.borderLeft,i=e.borderRight,s=e.boxShadow,u=e.borderColor,b=e.theme,h=r(e,["borderRadius","border","borderTop","borderBottom","borderLeft","borderRight","boxShadow","borderColor","theme"]);return o({borderRadius:t,border:n,borderTop:d,borderBottom:a,borderLeft:c,borderRight:i,boxShadow:s,borderColor:u,backgroundColor:b.color.background.neutral},h)}(o(o(o({},t),{theme:n}),d))})),L=t((function(t,d){var b=t.children,h=t.cornerRadius,E=void 0===h?a.MEDIUM:h,m=t.borderWidth,l=void 0===m?c.MEDIUM:m,f=t.showShadow,w=void 0===f||f,L=t.shadowDirection,R=void 0===L?i.TOP:L,M=t.shadowVariant,p=void 0===M?s.E2:M,D=t.borderDirection,O=void 0===D?u.DEFAULT:D,A=t.css;t.onChange;var g=t.noBorder,B=void 0!==g&&g,S=r(t,["children","cornerRadius","borderWidth","showShadow","shadowDirection","shadowVariant","borderDirection","css","onChange","noBorder"]),U=n(),G=v({cornerRadius:E,borderWidth:l,showShadow:w,shadowDirection:R,shadowVariant:p,borderDirection:O,theme:U,noBorder:B});return e(T,o({ref:d,css:o(o({},G),A)},S,{theme:U},{children:b}))}));export{L as Card,u as CardBorderDirection,c as CardBorderWidth,a as CardRadius,i as CardShadowDirection,s as CardShadowVariant,E as getBorderDirectionStyles,f as getBottomShadow,b as getCardBorderRadius,m as getCardBorderStyles,h as getCardBorderWidth,w as getCardShadowStyles,v as getCardStyles,l as getTopShadow};
1
+ import{jsx as r}from"react/jsx-runtime";import{forwardRef as e}from"react";import{Container as o}from"@cleartrip/ct-design-container";import{colors as t}from"@cleartrip/ct-design-tokens";const d=e(({children:e,styleConfig:t,onClick:d},s)=>{const{root:i=[]}=t||{};return r(o,{ref:s,onClick:d,styleConfig:{root:[...i]},children:e})});var s,i,n,a,u,c;d.displayName="Card",function(r){r.NONE="none",r.SMALL="sm",r.MEDIUM="md",r.LARGE="lg",r.EXTRA_LARGE="xl"}(s||(s={})),function(r){r.NONE="none",r.SMALL="sm",r.MEDIUM="md",r.LARGE="lg",r.EXTRA_LARGE="xl"}(i||(i={})),function(r){r.NONE="none",r.SMALL="sm",r.MEDIUM="md",r.LARGE="lg"}(n||(n={})),function(r){r.TOP="top",r.BOTTOM="bottom"}(a||(a={})),function(r){r.E1="E1",r.E2="E2",r.E3="E3",r.E4="E4"}(u||(u={})),function(r){r.TOP="top",r.BOTTOM="bottom",r.LEFT="left",r.RIGHT="right",r.DEFAULT="default"}(c||(c={}));const b={PRIMARY:t.black,SECONDARY:t.success,TERTIARY:t.warning},l=(r,e)=>{switch(r){case s.NONE:return e.border.radius[0];case s.SMALL:return e.border.radius[6];case s.MEDIUM:return e.border.radius[8];case s.LARGE:return e.border.radius[12];case s.EXTRA_LARGE:return e.border.radius[16];default:return e.border.radius[8]}},E=(r,e)=>{switch(r){case s.NONE:return e.border.width.none;case s.SMALL:return e.border.width.sm;case s.MEDIUM:return e.border.width.md;case s.LARGE:return e.border.width.lg;default:return e.border.width.md}},h=(r,e,o,t)=>({borderWidth:e,borderStyle:o,borderColor:t}),R=(r,e,o,t,d,s)=>{const i=l(e,d),n=d.border.style.solid,a=E(r,d),u=h(0,a,n,t);return s?{borderRadius:i}:Object.assign({borderRadius:i},u)},L=(r,e)=>{switch(e){case s.LARGE:return{height:r.size[12],borderRadius:r.border.radius[24],borderStyle:r.border.style.solid};case s.MEDIUM:return{height:r.size[10],borderRadius:r.border.radius[20],borderStyle:r.border.style.solid};case s.SMALL:return{height:r.size[8],borderRadius:r.border.radius[16],borderStyle:r.border.style.solid};default:return{height:r.size[10],borderRadius:r.border.radius[20],borderStyle:r.border.style.solid}}},f=({borderColor:r,cornerRadius:e,borderWidth:o,showShadow:t,shadowColor:d,shadowOffset:s,shadowOpacity:i,elevation:n,borderDirection:a,theme:u})=>{const c=t?{shadowColor:d,shadowOffset:s,shadowOpacity:i,shadowRadius:2,elevation:n}:{},b=R(o,e,0,r,u);return Object.assign(Object.assign({},c),b)};export{d as Card,b as CardBorderColors,c as CardBorderDirection,n as CardBorderWidth,i as CardRadius,a as CardShadowDirection,u as CardShadowVariant,s as CardSize,h as getBorderDirectionStyles,l as getCardBorderRadius,R as getCardBorderStyles,E as getCardBorderWidth,f as getCardStyles,L as getDefaultCardStyles};
2
2
  //# sourceMappingURL=ct-design-card.browser.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ct-design-card.browser.esm.js","sources":["../packages/components/Card/src/StyledCard/style.ts","../packages/components/Card/src/type.ts","../packages/components/Card/src/style.ts","../packages/components/Card/src/Card.tsx"],"sourcesContent":[null,null,null,null],"names":["CardRadius","CardBorderWidth","CardShadowDirection","CardShadowVariant","CardBorderDirection","getCardBorderRadius","cornerRadius","theme","NONE","border","radius","SMALL","MEDIUM","LARGE","EXTRA_LARGE","getCardBorderWidth","borderWidth","width","none","sm","md","lg","getBorderDirectionStyles","borderDirection","borderStyle","borderColor","DEFAULT","concat","TOP","borderTop","BOTTOM","borderBottom","LEFT","borderLeft","RIGHT","borderRight","getCardBorderStyles","cardBorderWidth","noBorder","borderRadius","style","solid","color","default","getTopShadow","shadowVariant","E1","elevation","topE1","E2","topE2","E3","topE3","E4","topE4","getBottomShadow","bottomE1","bottomE2","bottomE3","bottomE4","getCardShadowStyles","shadowDirection","getCardStyles","_a","showShadow","__assign","boxShadow","StyledCard","styled","div","css","rest","__rest","backgroundColor","background","neutral","getStyledCardStyled","Card","forwardRef","forwardedRef","children","_b","_c","_d","_e","_f","_g","onChange","_h","useTheme","cardStyles","_jsx","ref"],"mappings":"+MAGO,ICDKA,EAUAC,EASAC,EAOAC,EASAC,GAnC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E1B,aAAYA,EACZ9B,SACAoB,UAASA,EACTE,aAAYA,EACZE,WAAUA,EACVE,YAAWA,EACX+B,YACAzC,YAAWA,EACXgD,gBAAiBlE,EAAMmC,MAAMgC,WAAWC,SACrCJ,EAEP,CGTEK,UAAyBN,GAAG,CAAE/D,MAAKA,IAAKgE,GAAO,IAG3CM,EAAOC,GACX,SACEf,EAaAgB,GAZE,IAAAC,EAAQjB,EAAAiB,SACRC,EAAAlB,EAAAzD,aAAAA,OAAY,IAAA2E,EAAGjF,EAAWY,OAAMqE,EAChCC,EAAAnB,EAAA/C,YAAAA,OAAW,IAAAkE,EAAGjF,EAAgBW,OAAMsE,EACpCC,EAAApB,EAAAC,WAAAA,OAAU,IAAAmB,GAAOA,EACjBC,EAAyCrB,EAAAF,gBAAzCA,OAAe,IAAAuB,EAAGlF,EAAoB0B,IAAGwD,EACzCC,EAAoCtB,EAAAlB,cAApCA,OAAa,IAAAwC,EAAGlF,EAAkB8C,GAAEoC,EACpCC,oBAAA/D,OAAkB,IAAA+D,EAAAlF,EAAoBsB,QAAO4D,EAC7ChB,EAAGP,EAAAO,IACKP,EAAAwB,aACRC,EAAgBzB,EAAAzB,SAAhBA,OAAQ,IAAAkD,GAAQA,EACbjB,EAAIC,EAAAT,EAXT,wIAeMxD,EAAQkF,IACRC,EAAa5B,EAAc,CAC/BxD,aAAYA,EACZU,YAAWA,EACXgD,WAAUA,EACVH,gBAAeA,EACfhB,cAAaA,EACbtB,gBAAeA,EACfhB,MAAKA,EACL+B,SAAQA,IAGV,OACEqD,EAACxB,EAAUF,EAAA,CAAC2B,IAAKb,EAAcT,IAAUL,EAAAA,EAAA,GAAAyB,GAAepB,IAAWC,EAAI,CAAEhE,MAAOA,GAC7E,CAAAyE,SAAAA,IAGP"}
1
+ {"version":3,"file":"ct-design-card.browser.esm.js","sources":["../packages/components/Card/src/Card.tsx","../packages/components/Card/src/constants.ts","../packages/components/Card/src/style.ts"],"sourcesContent":[null,null,null],"names":["Card","forwardRef","children","styleConfig","onClick","forwardedRef","root","_jsx","Container","ref","CardSize","CardRadius","CardBorderWidth","CardShadowDirection","CardShadowVariant","CardBorderDirection","displayName","CardBorderColors","PRIMARY","colors","black","SECONDARY","success","TERTIARY","warning","getCardBorderRadius","cornerRadius","theme","NONE","border","radius","SMALL","MEDIUM","LARGE","EXTRA_LARGE","getCardBorderWidth","borderWidth","width","none","sm","md","lg","getBorderDirectionStyles","_borderDirection","borderStyle","borderColor","getCardBorderStyles","cardBorderWidth","borderDirection","noBorder","borderRadius","style","solid","Object","assign","getDefaultCardStyles","size","height","getCardStyles","showShadow","shadowColor","shadowOffset","shadowOpacity","elevation","shadowStyles","shadowRadius","borderStyles"],"mappings":"2LAMA,MAAMA,EAAOC,EAAqC,EAAGC,WAAUC,cAAaC,WAAWC,KACrF,MAAMC,KAAEA,EAAO,IAAOH,GAAe,CAAA,EAErC,OACEI,EAACC,EAAU,CAAAC,IAAKJ,EAAcD,QAASA,EAASD,YAAa,CAAEG,KAAM,IAAIA,IACtEJ,SAAAA,UCTKQ,EAQAC,EAQAC,EAOAC,EAKAC,EAOAC,EDrBZf,EAAKgB,YAAc,OCdnB,SAAYN,GACVA,EAAA,KAAA,OACAA,EAAA,MAAA,KACAA,EAAA,OAAA,KACAA,EAAA,MAAA,KACAA,EAAA,YAAA,IACD,CAND,CAAYA,IAAAA,EAMX,CAAA,IAED,SAAYC,GACVA,EAAA,KAAA,OACAA,EAAA,MAAA,KACAA,EAAA,OAAA,KACAA,EAAA,MAAA,KACAA,EAAA,YAAA,IACD,CAND,CAAYA,IAAAA,EAMX,CAAA,IAED,SAAYC,GACVA,EAAA,KAAA,OACAA,EAAA,MAAA,KACAA,EAAA,OAAA,KACAA,EAAA,MAAA,IACD,CALD,CAAYA,IAAAA,EAKX,CAAA,IAED,SAAYC,GACVA,EAAA,IAAA,MACAA,EAAA,OAAA,QACD,CAHD,CAAYA,IAAAA,EAGX,CAAA,IAED,SAAYC,GACVA,EAAA,GAAA,KACAA,EA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BZ,EAAaQ,EAAaC,GACnF,OAAOI,EACH,CAAEC,gBAEAG,OAAAC,OAAA,CAAAJ,gBACGrB,IAUE0B,EAAuB,CAAC5B,EAAc6B,KACjD,OAAQA,GACN,KAAK9C,EAASuB,MACZ,MAAO,CACLwB,OAAQ9B,EAAM6B,KAAK,IACnBN,aAAcvB,EAAME,OAAOC,OAAO,IAClCc,YAAajB,EAAME,OAAOsB,MAAMC,OAEpC,KAAK1C,EAASsB,OACZ,MAAO,CACLyB,OAAQ9B,EAAM6B,KAAK,IACnBN,aAAcvB,EAAME,OAAOC,OAAO,IAClCc,YAAajB,EAAME,OAAOsB,MAAMC,OAEpC,KAAK1C,EAASqB,MACZ,MAAO,CACL0B,OAAQ9B,EAAM6B,KAAK,GACnBN,aAAcvB,EAAME,OAAOC,OAAO,IAClCc,YAAajB,EAAME,OAAOsB,MAAMC,OAEpC,QACE,MAAO,CACLK,OAAQ9B,EAAM6B,KAAK,IACnBN,aAAcvB,EAAME,OAAOC,OAAO,IAClCc,YAAajB,EAAME,OAAOsB,MAAMC,SAiB3BM,EAAgB,EAC3Bb,cACAnB,eACAU,cACAuB,aACAC,cACAC,eACAC,gBACAC,YACAf,kBACArB,YAaA,MAAMqC,EAAeL,EACjB,CACEC,cACAC,eACAC,gBACAG,aAAc,EACdF,aAEF,GAEEG,EAAepB,EAAoBV,EAAaV,EAAcsB,EAAiBH,EAAalB,GAElG,OACK0B,OAAAC,OAAAD,OAAAC,OAAA,CAAA,EAAAU,GACAE"}
@@ -1,20 +1,24 @@
1
1
  'use strict';
2
2
 
3
- var tslib = require('tslib');
4
3
  var jsxRuntime = require('react/jsx-runtime');
5
4
  var react = require('react');
6
- var ctDesignTheme = require('@cleartrip/ct-design-theme');
7
- var styled = require('styled-components');
5
+ var ctDesignContainer = require('@cleartrip/ct-design-container');
6
+ var ctDesignTokens = require('@cleartrip/ct-design-tokens');
8
7
 
9
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
-
11
- var styled__default = /*#__PURE__*/_interopDefault(styled);
12
-
13
- var getStyledCardStyled = function (_a) {
14
- var borderRadius = _a.borderRadius, border = _a.border, borderTop = _a.borderTop, borderBottom = _a.borderBottom, borderLeft = _a.borderLeft, borderRight = _a.borderRight, boxShadow = _a.boxShadow, borderColor = _a.borderColor, theme = _a.theme, rest = tslib.__rest(_a, ["borderRadius", "border", "borderTop", "borderBottom", "borderLeft", "borderRight", "boxShadow", "borderColor", "theme"]);
15
- return tslib.__assign({ borderRadius: borderRadius, border: border, borderTop: borderTop, borderBottom: borderBottom, borderLeft: borderLeft, borderRight: borderRight, boxShadow: boxShadow, borderColor: borderColor, backgroundColor: theme.color.background.neutral }, rest);
16
- };
8
+ const Card = react.forwardRef(({ children, styleConfig, onClick }, forwardedRef) => {
9
+ const { root = [] } = styleConfig || {};
10
+ return (jsxRuntime.jsx(ctDesignContainer.Container, { ref: forwardedRef, onClick: onClick, styleConfig: { root: [...root] }, children: children }));
11
+ });
12
+ Card.displayName = 'Card';
17
13
 
14
+ exports.CardSize = void 0;
15
+ (function (CardSize) {
16
+ CardSize["NONE"] = "none";
17
+ CardSize["SMALL"] = "sm";
18
+ CardSize["MEDIUM"] = "md";
19
+ CardSize["LARGE"] = "lg";
20
+ CardSize["EXTRA_LARGE"] = "xl";
21
+ })(exports.CardSize || (exports.CardSize = {}));
18
22
  exports.CardRadius = void 0;
19
23
  (function (CardRadius) {
20
24
  CardRadius["NONE"] = "none";
@@ -50,22 +54,27 @@ exports.CardBorderDirection = void 0;
50
54
  CardBorderDirection["RIGHT"] = "right";
51
55
  CardBorderDirection["DEFAULT"] = "default";
52
56
  })(exports.CardBorderDirection || (exports.CardBorderDirection = {}));
57
+ const CardBorderColors = {
58
+ PRIMARY: ctDesignTokens.colors.black,
59
+ SECONDARY: ctDesignTokens.colors.success,
60
+ TERTIARY: ctDesignTokens.colors.warning,
61
+ };
53
62
 
54
- var getCardBorderRadius = function (cornerRadius, theme) {
63
+ const getCardBorderRadius = (cornerRadius, theme) => {
55
64
  switch (cornerRadius) {
56
- case exports.CardRadius.NONE: {
65
+ case exports.CardSize.NONE: {
57
66
  return theme.border.radius[0];
58
67
  }
59
- case exports.CardRadius.SMALL: {
68
+ case exports.CardSize.SMALL: {
60
69
  return theme.border.radius[6];
61
70
  }
62
- case exports.CardRadius.MEDIUM: {
71
+ case exports.CardSize.MEDIUM: {
63
72
  return theme.border.radius[8];
64
73
  }
65
- case exports.CardRadius.LARGE: {
74
+ case exports.CardSize.LARGE: {
66
75
  return theme.border.radius[12];
67
76
  }
68
- case exports.CardRadius.EXTRA_LARGE: {
77
+ case exports.CardSize.EXTRA_LARGE: {
69
78
  return theme.border.radius[16];
70
79
  }
71
80
  default: {
@@ -73,18 +82,18 @@ var getCardBorderRadius = function (cornerRadius, theme) {
73
82
  }
74
83
  }
75
84
  };
76
- var getCardBorderWidth = function (borderWidth, theme) {
85
+ const getCardBorderWidth = (borderWidth, theme) => {
77
86
  switch (borderWidth) {
78
- case exports.CardRadius.NONE: {
87
+ case exports.CardSize.NONE: {
79
88
  return theme.border.width.none;
80
89
  }
81
- case exports.CardRadius.SMALL: {
90
+ case exports.CardSize.SMALL: {
82
91
  return theme.border.width.sm;
83
92
  }
84
- case exports.CardRadius.MEDIUM: {
93
+ case exports.CardSize.MEDIUM: {
85
94
  return theme.border.width.md;
86
95
  }
87
- case exports.CardRadius.LARGE: {
96
+ case exports.CardSize.LARGE: {
88
97
  return theme.border.width.lg;
89
98
  }
90
99
  default: {
@@ -92,133 +101,70 @@ var getCardBorderWidth = function (borderWidth, theme) {
92
101
  }
93
102
  }
94
103
  };
95
- var getBorderDirectionStyles = function (borderDirection, borderWidth, borderStyle, borderColor) {
96
- switch (borderDirection) {
97
- case exports.CardBorderDirection.DEFAULT: {
98
- return {
99
- border: "".concat(borderWidth, " ").concat(borderStyle, " ").concat(borderColor),
100
- };
101
- }
102
- case exports.CardBorderDirection.TOP: {
103
- return {
104
- borderTop: "".concat(borderWidth, " ").concat(borderStyle, " ").concat(borderColor),
105
- };
106
- }
107
- case exports.CardBorderDirection.BOTTOM: {
104
+ const getBorderDirectionStyles = (_borderDirection, borderWidth, borderStyle, borderColor) => {
105
+ return {
106
+ borderWidth,
107
+ borderStyle,
108
+ borderColor,
109
+ };
110
+ };
111
+ const getCardBorderStyles = (cardBorderWidth, cornerRadius, borderDirection, borderColor, theme, noBorder) => {
112
+ const borderRadius = getCardBorderRadius(cornerRadius, theme);
113
+ const borderStyle = theme.border.style.solid;
114
+ const borderWidth = getCardBorderWidth(cardBorderWidth, theme);
115
+ const border = getBorderDirectionStyles(borderDirection, borderWidth, borderStyle, borderColor);
116
+ return noBorder
117
+ ? { borderRadius }
118
+ : Object.assign({ borderRadius }, border);
119
+ };
120
+ const getDefaultCardStyles = (theme, size) => {
121
+ switch (size) {
122
+ case exports.CardSize.LARGE:
108
123
  return {
109
- borderBottom: "".concat(borderWidth, " ").concat(borderStyle, " ").concat(borderColor),
124
+ height: theme.size[12],
125
+ borderRadius: theme.border.radius[24],
126
+ borderStyle: theme.border.style.solid,
110
127
  };
111
- }
112
- case exports.CardBorderDirection.LEFT: {
128
+ case exports.CardSize.MEDIUM:
113
129
  return {
114
- borderLeft: "".concat(borderWidth, " ").concat(borderStyle, " ").concat(borderColor),
130
+ height: theme.size[10],
131
+ borderRadius: theme.border.radius[20],
132
+ borderStyle: theme.border.style.solid,
115
133
  };
116
- }
117
- case exports.CardBorderDirection.RIGHT: {
134
+ case exports.CardSize.SMALL:
118
135
  return {
119
- borderRight: "".concat(borderWidth, " ").concat(borderStyle, " ").concat(borderColor),
136
+ height: theme.size[8],
137
+ borderRadius: theme.border.radius[16],
138
+ borderStyle: theme.border.style.solid,
120
139
  };
121
- }
122
- default: {
140
+ default:
123
141
  return {
124
- border: "".concat(borderWidth, " ").concat(borderStyle, " ").concat(borderColor),
142
+ height: theme.size[10],
143
+ borderRadius: theme.border.radius[20],
144
+ borderStyle: theme.border.style.solid,
125
145
  };
126
- }
127
- }
128
- };
129
- var getCardBorderStyles = function (cardBorderWidth, cornerRadius, borderDirection, theme, noBorder) {
130
- var borderRadius = getCardBorderRadius(cornerRadius, theme);
131
- var borderStyle = theme.border.style.solid;
132
- var borderColor = theme.color.border.default;
133
- var borderWidth = getCardBorderWidth(cardBorderWidth, theme);
134
- var border = getBorderDirectionStyles(borderDirection, borderWidth, borderStyle, borderColor);
135
- return noBorder
136
- ? { borderRadius: borderRadius }
137
- : tslib.__assign({ borderRadius: borderRadius }, border);
138
- };
139
- var getTopShadow = function (shadowVariant, theme) {
140
- switch (shadowVariant) {
141
- case exports.CardShadowVariant.E1: {
142
- return theme.elevation.topE1;
143
- }
144
- case exports.CardShadowVariant.E2: {
145
- return theme.elevation.topE2;
146
- }
147
- case exports.CardShadowVariant.E3: {
148
- return theme.elevation.topE3;
149
- }
150
- case exports.CardShadowVariant.E4: {
151
- return theme.elevation.topE4;
152
- }
153
- default: {
154
- return theme.elevation.topE2;
155
- }
156
146
  }
157
147
  };
158
- var getBottomShadow = function (shadowVariant, theme) {
159
- switch (shadowVariant) {
160
- case exports.CardShadowVariant.E1: {
161
- return theme.elevation.bottomE1;
162
- }
163
- case exports.CardShadowVariant.E2: {
164
- return theme.elevation.bottomE2;
165
- }
166
- case exports.CardShadowVariant.E3: {
167
- return theme.elevation.bottomE3;
168
- }
169
- case exports.CardShadowVariant.E4: {
170
- return theme.elevation.bottomE4;
171
- }
172
- default: {
173
- return theme.elevation.bottomE2;
174
- }
175
- }
148
+ const getCardStyles = ({ borderColor, cornerRadius, borderWidth, showShadow, shadowColor, shadowOffset, shadowOpacity, elevation, borderDirection, theme, }) => {
149
+ const shadowStyles = showShadow
150
+ ? {
151
+ shadowColor,
152
+ shadowOffset,
153
+ shadowOpacity,
154
+ shadowRadius: 2,
155
+ elevation,
156
+ }
157
+ : {};
158
+ const borderStyles = getCardBorderStyles(borderWidth, cornerRadius, borderDirection, borderColor, theme);
159
+ return Object.assign(Object.assign({}, shadowStyles), borderStyles);
176
160
  };
177
- var getCardShadowStyles = function (shadowDirection, shadowVariant, theme) {
178
- switch (shadowDirection) {
179
- case exports.CardShadowDirection.TOP: {
180
- return getTopShadow(shadowVariant, theme);
181
- }
182
- case exports.CardShadowDirection.BOTTOM: {
183
- return getBottomShadow(shadowVariant, theme);
184
- }
185
- default: {
186
- return getBottomShadow(shadowVariant, theme);
187
- }
188
- }
189
- };
190
- var getCardStyles = function (_a) {
191
- var cornerRadius = _a.cornerRadius, borderWidth = _a.borderWidth, showShadow = _a.showShadow, shadowDirection = _a.shadowDirection, shadowVariant = _a.shadowVariant, borderDirection = _a.borderDirection, theme = _a.theme, noBorder = _a.noBorder;
192
- return tslib.__assign({ boxShadow: showShadow ? getCardShadowStyles(shadowDirection, shadowVariant, theme) : 'none' }, getCardBorderStyles(borderWidth, cornerRadius, borderDirection, theme, noBorder));
193
- };
194
-
195
- var StyledCard = styled__default.default.div(function (_a) {
196
- var css = _a.css, theme = _a.theme, rest = tslib.__rest(_a, ["css", "theme"]);
197
- return getStyledCardStyled(tslib.__assign(tslib.__assign(tslib.__assign({}, css), { theme: theme }), rest));
198
- });
199
- var Card = react.forwardRef(function (_a, forwardedRef) {
200
- var children = _a.children, _b = _a.cornerRadius, cornerRadius = _b === void 0 ? exports.CardRadius.MEDIUM : _b, _c = _a.borderWidth, borderWidth = _c === void 0 ? exports.CardBorderWidth.MEDIUM : _c, _d = _a.showShadow, showShadow = _d === void 0 ? true : _d, _e = _a.shadowDirection, shadowDirection = _e === void 0 ? exports.CardShadowDirection.TOP : _e, _f = _a.shadowVariant, shadowVariant = _f === void 0 ? exports.CardShadowVariant.E2 : _f, _g = _a.borderDirection, borderDirection = _g === void 0 ? exports.CardBorderDirection.DEFAULT : _g, css = _a.css; _a.onChange; var _h = _a.noBorder, noBorder = _h === void 0 ? false : _h, rest = tslib.__rest(_a, ["children", "cornerRadius", "borderWidth", "showShadow", "shadowDirection", "shadowVariant", "borderDirection", "css", "onChange", "noBorder"]);
201
- var theme = ctDesignTheme.useTheme();
202
- var cardStyles = getCardStyles({
203
- cornerRadius: cornerRadius,
204
- borderWidth: borderWidth,
205
- showShadow: showShadow,
206
- shadowDirection: shadowDirection,
207
- shadowVariant: shadowVariant,
208
- borderDirection: borderDirection,
209
- theme: theme,
210
- noBorder: noBorder,
211
- });
212
- return (jsxRuntime.jsx(StyledCard, tslib.__assign({ ref: forwardedRef, css: tslib.__assign(tslib.__assign({}, cardStyles), css) }, rest, { theme: theme }, { children: children })));
213
- });
214
161
 
215
162
  exports.Card = Card;
163
+ exports.CardBorderColors = CardBorderColors;
216
164
  exports.getBorderDirectionStyles = getBorderDirectionStyles;
217
- exports.getBottomShadow = getBottomShadow;
218
165
  exports.getCardBorderRadius = getCardBorderRadius;
219
166
  exports.getCardBorderStyles = getCardBorderStyles;
220
167
  exports.getCardBorderWidth = getCardBorderWidth;
221
- exports.getCardShadowStyles = getCardShadowStyles;
222
168
  exports.getCardStyles = getCardStyles;
223
- exports.getTopShadow = getTopShadow;
169
+ exports.getDefaultCardStyles = getDefaultCardStyles;
224
170
  //# sourceMappingURL=ct-design-card.cjs.js.map