@cleartrip/ct-design-card 4.0.0 → 5.0.0

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/type.d.ts CHANGED
@@ -1,48 +1,39 @@
1
- import { HtmlCompositeAttributes } from '@cleartrip/ct-design-types';
2
- export declare enum CardRadius {
3
- NONE = "none",
4
- SMALL = "sm",
5
- MEDIUM = "md",
6
- LARGE = "lg",
7
- EXTRA_LARGE = "xl"
8
- }
1
+ import type { ReactNode } from 'react';
2
+ import type { Styles } from '@cleartrip/ct-design-types';
3
+ import type { IContainer } from '@cleartrip/ct-design-container';
4
+ import { CardSize, CardRadius, CardBorderWidth, CardShadowDirection, CardShadowVariant, CardBorderDirection, CardBorderColors } from './constants';
5
+ export type CardSizeType = `${CardSize}`;
9
6
  export type CardRadiusType = `${CardRadius}`;
10
- export declare enum CardBorderWidth {
11
- NONE = "none",
12
- SMALL = "sm",
13
- MEDIUM = "md",
14
- LARGE = "lg"
15
- }
16
7
  export type CardBorderWidthType = `${CardBorderWidth}`;
17
- export declare enum CardShadowDirection {
18
- TOP = "top",
19
- BOTTOM = "bottom"
20
- }
21
8
  export type CardShadowDirectionType = `${CardShadowDirection}`;
22
- export declare enum CardShadowVariant {
23
- E1 = "E1",
24
- E2 = "E2",
25
- E3 = "E3",
26
- E4 = "E4"
27
- }
28
9
  export type CardShadowVariantType = `${CardShadowVariant}`;
29
- export declare enum CardBorderDirection {
30
- TOP = "top",
31
- BOTTOM = "bottom",
32
- LEFT = "left",
33
- RIGHT = "right",
34
- DEFAULT = "default"
35
- }
36
10
  export type CardBorderDirectionType = `${CardBorderDirection}`;
37
- export type CardDefaultProps = {
38
- borderWidth?: 'none' | 'sm' | 'md' | 'lg';
39
- cornerRadius?: 'none' | 'sm' | 'md' | 'lg' | 'xl';
11
+ export type CardBorderColor = 'primary' | 'secondary' | 'tertiary';
12
+ export type CardBorderColorType = (typeof CardBorderColors)[keyof typeof CardBorderColors];
13
+ export interface ICardStyleConfig {
14
+ root?: Styles[];
15
+ }
16
+ export interface ICardProps {
17
+ borderWidth?: CardBorderWidthType;
18
+ cornerRadius?: CardRadiusType;
40
19
  showShadow?: boolean;
41
- shadowDirection?: 'top' | 'bottom';
42
- shadowVariant?: 'E1' | 'E2' | 'E3' | 'E4';
43
- borderDirection?: 'top' | 'bottom' | 'left' | 'right' | 'default';
20
+ shadowDirection?: CardShadowDirectionType;
21
+ shadowVariant?: CardShadowVariantType;
22
+ shadowColor?: string;
23
+ shadowOffset?: {
24
+ width: number;
25
+ height: number;
26
+ };
27
+ elevation?: number;
28
+ shadowOpacity?: number;
29
+ borderColor?: CardBorderColorType;
30
+ borderDirection?: CardBorderDirectionType;
44
31
  noBorder?: boolean;
45
- };
46
- export interface CardProps extends HtmlCompositeAttributes<CardDefaultProps, 'Div'>, CardDefaultProps {
32
+ children?: ReactNode;
33
+ styleConfig?: ICardStyleConfig;
34
+ onClick?: IContainer['onClick'];
35
+ onLayout?: IContainer['onLayout'];
47
36
  }
37
+ export type CardDefaultProps = ICardProps;
38
+ export type CardProps = ICardProps;
48
39
  //# sourceMappingURL=type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../packages/components/Card/src/type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAErF,oBAAY,UAAU;IACpB,IAAI,SAAS;IACb,KAAK,OAAO;IACZ,MAAM,OAAO;IACb,KAAK,OAAO;IACZ,WAAW,OAAO;CACnB;AAED,MAAM,MAAM,cAAc,GAAG,GAAG,UAAU,EAAE,CAAC;AAE7C,oBAAY,eAAe;IACzB,IAAI,SAAS;IACb,KAAK,OAAO;IACZ,MAAM,OAAO;IACb,KAAK,OAAO;CACb;AAED,MAAM,MAAM,mBAAmB,GAAG,GAAG,eAAe,EAAE,CAAC;AAEvD,oBAAY,mBAAmB;IAC7B,GAAG,QAAQ;IACX,MAAM,WAA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AC,EAAE,OAAO,CAAC;IAInB,QAAQ,CAAC,EAAE,SAAS,CAAC;IAIrB,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAI/B,OAAO,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IAIhC,QAAQ,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;CACnC;AAMD,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC;AAM1C,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC"}
package/package.json CHANGED
@@ -1,30 +1,46 @@
1
1
  {
2
2
  "name": "@cleartrip/ct-design-card",
3
- "version": "4.0.0",
3
+ "version": "5.0.0",
4
4
  "description": "",
5
5
  "types": "dist/index.d.ts",
6
- "main": "dist/ct-design-card.cjs.js",
6
+ "main": "./dist/ct-design-card.cjs.js",
7
7
  "jsnext:main": "dist/ct-design-card.esm.js",
8
8
  "module": "dist/ct-design-card.esm.js",
9
+ "react-native": "src/index.native.ts",
9
10
  "sideEffects": false,
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/ct-design-card.esm.js",
15
+ "default": "./dist/ct-design-card.cjs.js"
16
+ }
17
+ },
10
18
  "browser": {
11
19
  "./dist/ct-design-card.esm.js": "./dist/ct-design-card.browser.esm.js",
12
20
  "./dist/ct-design-card.cjs.js": "./dist/ct-design-card.browser.cjs.js"
13
21
  },
14
22
  "files": [
15
- "dist"
23
+ "dist",
24
+ "src"
16
25
  ],
17
26
  "dependencies": {
18
- "@cleartrip/ct-design-theme": "4.0.0"
27
+ "@cleartrip/ct-design-container": "5.0.0",
28
+ "@cleartrip/ct-design-style-manager": "5.0.0",
29
+ "@cleartrip/ct-design-theme": "5.0.0",
30
+ "@cleartrip/ct-design-tokens": "5.0.0"
19
31
  },
20
32
  "devDependencies": {
21
- "@cleartrip/ct-design-container": "4.0.0",
22
- "@cleartrip/ct-design-types": "4.0.0"
33
+ "@cleartrip/ct-design-types": "5.0.0"
23
34
  },
24
35
  "peerDependencies": {
25
36
  "react": ">=16.8.0",
26
37
  "react-dom": ">=16.8.0",
27
- "styled-components": "^5.3.6"
38
+ "react-native": ">=0.68.0"
39
+ },
40
+ "peerDependenciesMeta": {
41
+ "react-native": {
42
+ "optional": true
43
+ }
28
44
  },
29
45
  "publishConfig": {
30
46
  "access": "public"
@@ -35,6 +51,8 @@
35
51
  "test": "echo \"Error: no test specified\" && exit 1",
36
52
  "watch-package": "rollup -c -w",
37
53
  "build-package": "rollup -c",
38
- "build-package:clean": "rm -rf dist && rollup -c"
54
+ "build-package:clean": "rm -rf dist && rollup -c",
55
+ "publish-package:local": "yalc publish --no-scripts",
56
+ "publish-package:local:registry": "pnpm publish --registry http://localhost:4873 --no-git-checks --access public"
39
57
  }
40
58
  }
@@ -0,0 +1,68 @@
1
+ import { forwardRef } from 'react';
2
+
3
+ import { Container, ContainerRef } from '@cleartrip/ct-design-container';
4
+ import { useStyles } from '@cleartrip/ct-design-style-manager';
5
+ import { colors } from '@cleartrip/ct-design-tokens';
6
+
7
+ import { getCardStyles } from './style';
8
+ import { CardDefaultProps } from './type';
9
+
10
+ const Card = forwardRef<ContainerRef, CardDefaultProps>(
11
+ (
12
+ {
13
+ borderWidth = 'sm',
14
+ borderColor = colors.black,
15
+ borderDirection = 'default',
16
+ cornerRadius = 'md',
17
+ showShadow = true,
18
+ shadowColor = '#000',
19
+ shadowOffset = { width: 0, height: 1 },
20
+ shadowOpacity = 0.8,
21
+ elevation = 1,
22
+ styleConfig,
23
+ children,
24
+ onClick,
25
+ onLayout,
26
+ },
27
+ ref,
28
+ ) => {
29
+ const cardStyles = useStyles(
30
+ (theme) => {
31
+ return {
32
+ root: getCardStyles({
33
+ theme,
34
+ borderWidth,
35
+ borderColor,
36
+ cornerRadius,
37
+ showShadow,
38
+ shadowColor,
39
+ shadowOffset,
40
+ shadowOpacity,
41
+ elevation,
42
+ borderDirection,
43
+ }),
44
+ };
45
+ },
46
+ [cornerRadius, borderWidth, showShadow, shadowColor, shadowOffset, shadowOpacity, elevation, borderDirection],
47
+ );
48
+
49
+ const { root: customRootStyles = [] } = styleConfig || {};
50
+
51
+ return (
52
+ <Container
53
+ styleConfig={{
54
+ root: [cardStyles.root, ...customRootStyles],
55
+ }}
56
+ onClick={onClick}
57
+ ref={ref}
58
+ onLayout={onLayout}
59
+ >
60
+ {children}
61
+ </Container>
62
+ );
63
+ },
64
+ );
65
+
66
+ Card.displayName = 'Card';
67
+
68
+ export default Card;
package/src/Card.tsx ADDED
@@ -0,0 +1,18 @@
1
+ import { forwardRef } from 'react';
2
+
3
+ import { Container, ContainerRef } from '@cleartrip/ct-design-container';
4
+
5
+ import { ICardProps } from './type';
6
+
7
+ const Card = forwardRef<ContainerRef, ICardProps>(({ children, styleConfig, onClick }, forwardedRef) => {
8
+ const { root = [] } = styleConfig || {};
9
+
10
+ return (
11
+ <Container ref={forwardedRef} onClick={onClick} styleConfig={{ root: [...root] }}>
12
+ {children}
13
+ </Container>
14
+ );
15
+ });
16
+
17
+ Card.displayName = 'Card';
18
+ export default Card;
@@ -0,0 +1,50 @@
1
+ import { colors } from '@cleartrip/ct-design-tokens';
2
+
3
+ export enum CardSize {
4
+ NONE = 'none',
5
+ SMALL = 'sm',
6
+ MEDIUM = 'md',
7
+ LARGE = 'lg',
8
+ EXTRA_LARGE = 'xl',
9
+ }
10
+
11
+ export enum CardRadius {
12
+ NONE = 'none',
13
+ SMALL = 'sm',
14
+ MEDIUM = 'md',
15
+ LARGE = 'lg',
16
+ EXTRA_LARGE = 'xl',
17
+ }
18
+
19
+ export enum CardBorderWidth {
20
+ NONE = 'none',
21
+ SMALL = 'sm',
22
+ MEDIUM = 'md',
23
+ LARGE = 'lg',
24
+ }
25
+
26
+ export enum CardShadowDirection {
27
+ TOP = 'top',
28
+ BOTTOM = 'bottom',
29
+ }
30
+
31
+ export enum CardShadowVariant {
32
+ E1 = 'E1',
33
+ E2 = 'E2',
34
+ E3 = 'E3',
35
+ E4 = 'E4',
36
+ }
37
+
38
+ export enum CardBorderDirection {
39
+ TOP = 'top',
40
+ BOTTOM = 'bottom',
41
+ LEFT = 'left',
42
+ RIGHT = 'right',
43
+ DEFAULT = 'default',
44
+ }
45
+
46
+ export const CardBorderColors = {
47
+ PRIMARY: colors.black,
48
+ SECONDARY: colors.success,
49
+ TERTIARY: colors.warning,
50
+ } as const;
@@ -0,0 +1,3 @@
1
+ export { default as Card } from './Card.native';
2
+ export type * from './type';
3
+ export * from './constants';
package/src/index.ts ADDED
@@ -0,0 +1,4 @@
1
+ export { default as Card } from './Card';
2
+ export type * from './type';
3
+ export * from './constants';
4
+ export * from './style';
package/src/style.ts ADDED
@@ -0,0 +1,174 @@
1
+ import { Theme } from '@cleartrip/ct-design-theme';
2
+
3
+ import { CardBorderColorType, CardBorderDirectionType, CardBorderWidthType, CardSizeType } from './type';
4
+ import { CardSize } from './constants';
5
+
6
+ export const getCardBorderRadius = (cornerRadius: CardSizeType, theme: Theme): number => {
7
+ switch (cornerRadius) {
8
+ case CardSize.NONE: {
9
+ return theme.border.radius[0];
10
+ }
11
+ case CardSize.SMALL: {
12
+ return theme.border.radius[6];
13
+ }
14
+ case CardSize.MEDIUM: {
15
+ return theme.border.radius[8];
16
+ }
17
+ case CardSize.LARGE: {
18
+ return theme.border.radius[12];
19
+ }
20
+ case CardSize.EXTRA_LARGE: {
21
+ return theme.border.radius[16];
22
+ }
23
+ default: {
24
+ return theme.border.radius[8];
25
+ }
26
+ }
27
+ };
28
+
29
+ export const getCardBorderWidth = (borderWidth: CardBorderWidthType, theme: Theme): number => {
30
+ switch (borderWidth) {
31
+ case CardSize.NONE: {
32
+ return theme.border.width.none;
33
+ }
34
+ case CardSize.SMALL: {
35
+ return theme.border.width.sm;
36
+ }
37
+ case CardSize.MEDIUM: {
38
+ return theme.border.width.md;
39
+ }
40
+ case CardSize.LARGE: {
41
+ return theme.border.width.lg;
42
+ }
43
+ default: {
44
+ return theme.border.width.md;
45
+ }
46
+ }
47
+ };
48
+
49
+ interface BorderStyleProps {
50
+ borderWidth: number;
51
+ borderStyle: 'solid';
52
+ borderColor: string;
53
+ }
54
+
55
+ export const getBorderDirectionStyles = (
56
+ _borderDirection: CardBorderDirectionType,
57
+ borderWidth: number,
58
+ borderStyle: 'solid',
59
+ borderColor: string,
60
+ ): BorderStyleProps => {
61
+ return {
62
+ borderWidth,
63
+ borderStyle,
64
+ borderColor,
65
+ };
66
+ };
67
+
68
+ export const getCardBorderStyles = (
69
+ cardBorderWidth: CardBorderWidthType,
70
+ cornerRadius: CardSizeType,
71
+ borderDirection: CardBorderDirectionType,
72
+ borderColor: CardBorderColorType,
73
+ theme: Theme,
74
+ noBorder?: boolean,
75
+ ): { borderRadius: number } | ({ borderRadius: number } & BorderStyleProps) => {
76
+ const borderRadius = getCardBorderRadius(cornerRadius, theme);
77
+ const borderStyle = theme.border.style.solid;
78
+ const borderWidth = getCardBorderWidth(cardBorderWidth, theme);
79
+ const border = getBorderDirectionStyles(borderDirection, borderWidth, borderStyle, borderColor);
80
+ return noBorder
81
+ ? { borderRadius }
82
+ : {
83
+ borderRadius,
84
+ ...border,
85
+ };
86
+ };
87
+
88
+ interface CardStyleProps {
89
+ height: number;
90
+ borderRadius: number;
91
+ borderStyle: string;
92
+ }
93
+
94
+ export const getDefaultCardStyles = (theme: Theme, size: CardSizeType): CardStyleProps => {
95
+ switch (size) {
96
+ case CardSize.LARGE:
97
+ return {
98
+ height: theme.size[12],
99
+ borderRadius: theme.border.radius[24],
100
+ borderStyle: theme.border.style.solid,
101
+ };
102
+ case CardSize.MEDIUM:
103
+ return {
104
+ height: theme.size[10],
105
+ borderRadius: theme.border.radius[20],
106
+ borderStyle: theme.border.style.solid,
107
+ };
108
+ case CardSize.SMALL:
109
+ return {
110
+ height: theme.size[8],
111
+ borderRadius: theme.border.radius[16],
112
+ borderStyle: theme.border.style.solid,
113
+ };
114
+ default:
115
+ return {
116
+ height: theme.size[10],
117
+ borderRadius: theme.border.radius[20],
118
+ borderStyle: theme.border.style.solid,
119
+ };
120
+ }
121
+ };
122
+
123
+ interface CardStyleReturnType {
124
+ borderRadius: number;
125
+ borderWidth?: number;
126
+ borderStyle?: 'solid';
127
+ borderColor?: string;
128
+ shadowColor?: string;
129
+ shadowOffset?: { width: number; height: number };
130
+ shadowOpacity?: number;
131
+ shadowRadius?: number;
132
+ elevation?: number;
133
+ }
134
+
135
+ export const getCardStyles = ({
136
+ borderColor,
137
+ cornerRadius,
138
+ borderWidth,
139
+ showShadow,
140
+ shadowColor,
141
+ shadowOffset,
142
+ shadowOpacity,
143
+ elevation,
144
+ borderDirection,
145
+ theme,
146
+ }: {
147
+ borderColor: CardBorderColorType;
148
+ cornerRadius: CardSizeType;
149
+ borderWidth: CardBorderWidthType;
150
+ borderDirection: CardBorderDirectionType;
151
+ showShadow: boolean;
152
+ shadowColor: string;
153
+ shadowOffset: { width: number; height: number };
154
+ shadowOpacity: number;
155
+ elevation: number;
156
+ theme: Theme;
157
+ }): CardStyleReturnType => {
158
+ const shadowStyles = showShadow
159
+ ? {
160
+ shadowColor,
161
+ shadowOffset,
162
+ shadowOpacity,
163
+ shadowRadius: 2,
164
+ elevation,
165
+ }
166
+ : {};
167
+
168
+ const borderStyles = getCardBorderStyles(borderWidth, cornerRadius, borderDirection, borderColor, theme);
169
+
170
+ return {
171
+ ...shadowStyles,
172
+ ...borderStyles,
173
+ };
174
+ };
package/src/type.ts ADDED
@@ -0,0 +1,118 @@
1
+ import type { ReactNode } from 'react';
2
+
3
+ import type { Styles } from '@cleartrip/ct-design-types';
4
+ import type { IContainer } from '@cleartrip/ct-design-container';
5
+
6
+ import {
7
+ CardSize,
8
+ CardRadius,
9
+ CardBorderWidth,
10
+ CardShadowDirection,
11
+ CardShadowVariant,
12
+ CardBorderDirection,
13
+ CardBorderColors,
14
+ } from './constants';
15
+
16
+ export type CardSizeType = `${CardSize}`;
17
+
18
+ export type CardRadiusType = `${CardRadius}`;
19
+
20
+ export type CardBorderWidthType = `${CardBorderWidth}`;
21
+
22
+ export type CardShadowDirectionType = `${CardShadowDirection}`;
23
+
24
+ export type CardShadowVariantType = `${CardShadowVariant}`;
25
+
26
+ export type CardBorderDirectionType = `${CardBorderDirection}`;
27
+
28
+ export type CardBorderColor = 'primary' | 'secondary' | 'tertiary';
29
+
30
+ export type CardBorderColorType = (typeof CardBorderColors)[keyof typeof CardBorderColors];
31
+
32
+ export interface ICardStyleConfig {
33
+ /**
34
+ * Styles for the root container of the card.
35
+ */
36
+ root?: Styles[];
37
+ }
38
+
39
+ export interface ICardProps {
40
+ /**
41
+ * Set border width of card. Defaults to 'md'.
42
+ */
43
+ borderWidth?: CardBorderWidthType;
44
+ /**
45
+ * Set the radius of card corners. Defaults to 'md'.
46
+ */
47
+ cornerRadius?: CardRadiusType;
48
+ /**
49
+ * Show shadow on the card. Defaults to true.
50
+ */
51
+ showShadow?: boolean;
52
+ /**
53
+ * Direction of the shadow. Defaults to 'top' (web only — RN uses standard
54
+ * drop shadow).
55
+ */
56
+ shadowDirection?: CardShadowDirectionType;
57
+ /**
58
+ * Variant of the shadow. Maps to the theme elevation tokens. Defaults to
59
+ * 'E2'.
60
+ */
61
+ shadowVariant?: CardShadowVariantType;
62
+ /**
63
+ * Custom color for the card's shadow.
64
+ */
65
+ shadowColor?: string;
66
+ /**
67
+ * Controls the offset of the shadow from the card.
68
+ */
69
+ shadowOffset?: { width: number; height: number };
70
+ /**
71
+ * Controls the elevation of the card (Android specific).
72
+ */
73
+ elevation?: number;
74
+ /**
75
+ * Controls the opacity of the card's shadow.
76
+ */
77
+ shadowOpacity?: number;
78
+ /**
79
+ * Color of the card's border.
80
+ */
81
+ borderColor?: CardBorderColorType;
82
+ /**
83
+ * Direction of the border. Defaults to 'default' (all sides).
84
+ */
85
+ borderDirection?: CardBorderDirectionType;
86
+ /**
87
+ * When true, skips rendering the border but keeps the rounded corners.
88
+ */
89
+ noBorder?: boolean;
90
+ /**
91
+ * Content rendered inside the card.
92
+ */
93
+ children?: ReactNode;
94
+ /**
95
+ * Style configuration overrides for the root container.
96
+ */
97
+ styleConfig?: ICardStyleConfig;
98
+ /**
99
+ * Callback fired when the card is clicked or pressed.
100
+ */
101
+ onClick?: IContainer['onClick'];
102
+ /**
103
+ * Callback fired when the card is layout changed.
104
+ */
105
+ onLayout?: IContainer['onLayout'];
106
+ }
107
+
108
+ /**
109
+ * @deprecated Retained for backward compatibility with the previous
110
+ * polymorphic props API; use `ICardProps` going forward.
111
+ */
112
+ export type CardDefaultProps = ICardProps;
113
+
114
+ /**
115
+ * @deprecated Retained for backward compatibility with the previous
116
+ * emotion-styled implementation; use `ICardProps` going forward.
117
+ */
118
+ export type CardProps = ICardProps;
@@ -1,4 +0,0 @@
1
- import { CSSWithTheme } from '@cleartrip/ct-design-types';
2
- import { CSSObject } from 'styled-components';
3
- export declare const getStyledCardStyled: ({ borderRadius, border, borderTop, borderBottom, borderLeft, borderRight, boxShadow, borderColor, theme, ...rest }: CSSWithTheme) => CSSObject;
4
- //# sourceMappingURL=style.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../packages/components/Card/src/StyledCard/style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,eAAO,MAAM,mBAAmB,uHAW7B,YAAY,KAAG,SAajB,CAAC"}