@cleartrip/ct-design-chip 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/README.md +89 -0
- package/dist/AnimatedContainer.d.ts +6 -0
- package/dist/AnimatedContainer.d.ts.map +1 -0
- package/dist/AnimatedContainer.native.d.ts +6 -0
- package/dist/AnimatedContainer.native.d.ts.map +1 -0
- package/dist/Chip.d.ts +3 -2
- package/dist/Chip.d.ts.map +1 -1
- package/dist/Chip.native.d.ts +6 -0
- package/dist/Chip.native.d.ts.map +1 -0
- package/dist/Shimmer.d.ts +4 -0
- package/dist/Shimmer.d.ts.map +1 -0
- package/dist/constants.d.ts +10 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/ct-design-chip.browser.cjs.js +1 -1
- package/dist/ct-design-chip.browser.cjs.js.map +1 -1
- package/dist/ct-design-chip.browser.esm.js +1 -1
- package/dist/ct-design-chip.browser.esm.js.map +1 -1
- package/dist/ct-design-chip.cjs.js +146 -168
- package/dist/ct-design-chip.cjs.js.map +1 -1
- package/dist/ct-design-chip.esm.js +147 -165
- package/dist/ct-design-chip.esm.js.map +1 -1
- package/dist/ct-design-chip.umd.js +143 -195
- package/dist/ct-design-chip.umd.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/style.d.ts +43 -80
- package/dist/style.d.ts.map +1 -1
- package/dist/type.d.ts +32 -15
- package/dist/type.d.ts.map +1 -1
- package/package.json +35 -11
- package/src/AnimatedContainer.native.tsx +53 -0
- package/src/AnimatedContainer.tsx +28 -0
- package/src/Chip.native.tsx +253 -0
- package/src/Chip.tsx +242 -0
- package/src/Shimmer.tsx +28 -0
- package/src/constants.ts +10 -0
- package/src/index.ts +3 -0
- package/src/style.ts +80 -0
- package/src/type.ts +119 -0
- package/dist/StyledChip/StyledChip.d.ts +0 -7
- package/dist/StyledChip/StyledChip.d.ts.map +0 -1
- package/dist/StyledChip/index.d.ts +0 -2
- package/dist/StyledChip/index.d.ts.map +0 -1
- package/dist/StyledChip/style.d.ts +0 -7
- package/dist/StyledChip/style.d.ts.map +0 -1
- package/dist/StyledChip/type.d.ts +0 -15
- package/dist/StyledChip/type.d.ts.map +0 -1
- package/dist/StyledCounter/StyledCounter.d.ts +0 -7
- package/dist/StyledCounter/StyledCounter.d.ts.map +0 -1
- package/dist/StyledCounter/index.d.ts +0 -2
- package/dist/StyledCounter/index.d.ts.map +0 -1
- package/dist/StyledCounter/style.d.ts +0 -7
- package/dist/StyledCounter/style.d.ts.map +0 -1
- package/dist/StyledCounter/type.d.ts +0 -4
- package/dist/StyledCounter/type.d.ts.map +0 -1
package/src/Chip.tsx
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import React, { forwardRef, useMemo } from 'react';
|
|
2
|
+
|
|
3
|
+
import { Container, ContainerRef } from '@cleartrip/ct-design-container';
|
|
4
|
+
import { Typography, TypographyStyleConfigProps } from '@cleartrip/ct-design-typography';
|
|
5
|
+
import { useStyles } from '@cleartrip/ct-design-style-manager';
|
|
6
|
+
import { makeStyles } from '@cleartrip/ct-design-style-manager';
|
|
7
|
+
import { Cross } from '@cleartrip/ct-design-icons';
|
|
8
|
+
import { Styles } from '@cleartrip/ct-design-types';
|
|
9
|
+
import { useTheme } from '@cleartrip/ct-design-theme';
|
|
10
|
+
|
|
11
|
+
import { getChipStyles, getLabelColor } from './style';
|
|
12
|
+
import { IChipProps } from './type';
|
|
13
|
+
const staticChipStyles = makeStyles((theme) => {
|
|
14
|
+
return {
|
|
15
|
+
relativeContainer: {
|
|
16
|
+
position: 'relative',
|
|
17
|
+
},
|
|
18
|
+
root: {
|
|
19
|
+
display: 'flex',
|
|
20
|
+
alignSelf: 'baseline',
|
|
21
|
+
flexDirection: 'row',
|
|
22
|
+
alignItems: 'center',
|
|
23
|
+
gap: theme?.spacing[2],
|
|
24
|
+
paddingHorizontal: theme?.spacing[2],
|
|
25
|
+
},
|
|
26
|
+
prefixIconContainer: {
|
|
27
|
+
display: 'flex',
|
|
28
|
+
alignItems: 'center',
|
|
29
|
+
justifyContent: 'center',
|
|
30
|
+
},
|
|
31
|
+
suffixIconContainer: {
|
|
32
|
+
display: 'flex',
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
justifyContent: 'center',
|
|
35
|
+
},
|
|
36
|
+
topIconContainer: {
|
|
37
|
+
display: 'flex',
|
|
38
|
+
alignItems: 'center',
|
|
39
|
+
justifyContent: 'center',
|
|
40
|
+
},
|
|
41
|
+
chipCountRoot: {
|
|
42
|
+
display: 'flex',
|
|
43
|
+
alignItems: 'center',
|
|
44
|
+
justifyContent: 'center',
|
|
45
|
+
backgroundColor: theme?.color.chip.selectedPrimaryLabel,
|
|
46
|
+
height: theme?.size[4],
|
|
47
|
+
minWidth: theme?.size[4],
|
|
48
|
+
borderRadius: 50,
|
|
49
|
+
borderColor: '#fff',
|
|
50
|
+
top: 1,
|
|
51
|
+
borderWidth: theme?.border.width.sm,
|
|
52
|
+
paddingHorizontal: theme?.spacing[1],
|
|
53
|
+
marginLeft: -theme?.spacing[2],
|
|
54
|
+
},
|
|
55
|
+
labelContainerStyles: {
|
|
56
|
+
paddingLeft: theme?.spacing[1],
|
|
57
|
+
paddingRight: theme?.spacing[1],
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const ChipCounter = ({
|
|
63
|
+
count,
|
|
64
|
+
styleConfig,
|
|
65
|
+
}: {
|
|
66
|
+
count: number;
|
|
67
|
+
styleConfig: {
|
|
68
|
+
root: Styles[];
|
|
69
|
+
typography: TypographyStyleConfigProps;
|
|
70
|
+
};
|
|
71
|
+
}) => {
|
|
72
|
+
const { root = [], typography = {} } = styleConfig || {};
|
|
73
|
+
return (
|
|
74
|
+
<Container
|
|
75
|
+
styleConfig={{
|
|
76
|
+
root: [staticChipStyles.chipCountRoot, ...root],
|
|
77
|
+
}}
|
|
78
|
+
>
|
|
79
|
+
<Typography variant='TAG' color='neutral' styleConfig={typography}>
|
|
80
|
+
{count}
|
|
81
|
+
</Typography>
|
|
82
|
+
</Container>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const Chip = forwardRef(
|
|
87
|
+
(
|
|
88
|
+
{
|
|
89
|
+
id,
|
|
90
|
+
label,
|
|
91
|
+
onClick,
|
|
92
|
+
size = 'sm',
|
|
93
|
+
labelVariant = 'B2',
|
|
94
|
+
isSelected = false,
|
|
95
|
+
disabled = false,
|
|
96
|
+
prefixIcon,
|
|
97
|
+
suffixIcon,
|
|
98
|
+
topIcon,
|
|
99
|
+
styleConfig,
|
|
100
|
+
showCounter,
|
|
101
|
+
count = 0,
|
|
102
|
+
isDismissible = false,
|
|
103
|
+
onDismiss,
|
|
104
|
+
}: IChipProps,
|
|
105
|
+
ref: React.ForwardedRef<ContainerRef>,
|
|
106
|
+
) => {
|
|
107
|
+
const theme = useTheme();
|
|
108
|
+
const {
|
|
109
|
+
relativeContainer: customRelativeContainerStyles = [],
|
|
110
|
+
root: customRootStyles = [],
|
|
111
|
+
labelContainer: customLabelContainerStyles = [],
|
|
112
|
+
prefixIconContainer: customPrefixIconContainerStyles = [],
|
|
113
|
+
suffixIconContainer: customSuffixIconContainerStyles = [],
|
|
114
|
+
topIconContainer: customTopIconContainerStyles = [],
|
|
115
|
+
counter: customChipCountRootStyles = [],
|
|
116
|
+
counterTypography: customChipCountTypographyStyles = {},
|
|
117
|
+
} = styleConfig || {};
|
|
118
|
+
|
|
119
|
+
const labelColor = useMemo(() => {
|
|
120
|
+
return getLabelColor(disabled);
|
|
121
|
+
}, [disabled]);
|
|
122
|
+
|
|
123
|
+
const isTopIcon = Boolean(topIcon);
|
|
124
|
+
|
|
125
|
+
const chipStyles = useStyles(
|
|
126
|
+
(theme) => {
|
|
127
|
+
return {
|
|
128
|
+
root: getChipStyles({
|
|
129
|
+
theme,
|
|
130
|
+
size,
|
|
131
|
+
isDisabled: disabled,
|
|
132
|
+
isSelected,
|
|
133
|
+
topIcon: isTopIcon,
|
|
134
|
+
}),
|
|
135
|
+
};
|
|
136
|
+
},
|
|
137
|
+
[size, isSelected, disabled, isTopIcon],
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
const chipStylesForTopIcon = useStyles(
|
|
141
|
+
(theme) => {
|
|
142
|
+
if (topIcon) {
|
|
143
|
+
return {
|
|
144
|
+
root: {
|
|
145
|
+
flexDirection: 'column',
|
|
146
|
+
alignItems: 'flex-start',
|
|
147
|
+
gap: theme?.spacing[0],
|
|
148
|
+
borderRadius: theme?.border.radius[16],
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
return {};
|
|
153
|
+
},
|
|
154
|
+
[topIcon],
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
return (
|
|
158
|
+
<Container
|
|
159
|
+
styleConfig={{
|
|
160
|
+
root: [staticChipStyles?.relativeContainer, ...customRelativeContainerStyles],
|
|
161
|
+
}}
|
|
162
|
+
id={id}
|
|
163
|
+
>
|
|
164
|
+
<Container
|
|
165
|
+
ref={ref}
|
|
166
|
+
onClick={onClick ? onClick : undefined}
|
|
167
|
+
styleConfig={{
|
|
168
|
+
root: [staticChipStyles?.root, chipStyles.root, chipStylesForTopIcon?.root, ...customRootStyles],
|
|
169
|
+
}}
|
|
170
|
+
>
|
|
171
|
+
{!!topIcon && (
|
|
172
|
+
<Container
|
|
173
|
+
styleConfig={{
|
|
174
|
+
root: [staticChipStyles?.topIconContainer, ...customTopIconContainerStyles],
|
|
175
|
+
}}
|
|
176
|
+
>
|
|
177
|
+
{topIcon}
|
|
178
|
+
</Container>
|
|
179
|
+
)}
|
|
180
|
+
{!!prefixIcon && (
|
|
181
|
+
<Container
|
|
182
|
+
styleConfig={{
|
|
183
|
+
root: [staticChipStyles?.prefixIconContainer, ...customPrefixIconContainerStyles],
|
|
184
|
+
}}
|
|
185
|
+
>
|
|
186
|
+
{prefixIcon}
|
|
187
|
+
</Container>
|
|
188
|
+
)}
|
|
189
|
+
{!!label && (
|
|
190
|
+
<Container
|
|
191
|
+
styleConfig={{
|
|
192
|
+
root: [staticChipStyles?.labelContainerStyles, ...customLabelContainerStyles],
|
|
193
|
+
}}
|
|
194
|
+
>
|
|
195
|
+
{typeof label === 'string' ? (
|
|
196
|
+
<Typography lineClamp={1} variant={labelVariant} color={labelColor}>
|
|
197
|
+
{label}
|
|
198
|
+
</Typography>
|
|
199
|
+
) : (
|
|
200
|
+
label
|
|
201
|
+
)}
|
|
202
|
+
</Container>
|
|
203
|
+
)}
|
|
204
|
+
{showCounter && !!count && (
|
|
205
|
+
<ChipCounter
|
|
206
|
+
count={count}
|
|
207
|
+
styleConfig={{ root: customChipCountRootStyles, typography: customChipCountTypographyStyles }}
|
|
208
|
+
/>
|
|
209
|
+
)}
|
|
210
|
+
{!!suffixIcon && (
|
|
211
|
+
<Container
|
|
212
|
+
styleConfig={{
|
|
213
|
+
root: [staticChipStyles?.suffixIconContainer, ...customSuffixIconContainerStyles],
|
|
214
|
+
}}
|
|
215
|
+
>
|
|
216
|
+
{suffixIcon}
|
|
217
|
+
</Container>
|
|
218
|
+
)}
|
|
219
|
+
{isDismissible && (
|
|
220
|
+
<button
|
|
221
|
+
onClick={() => {
|
|
222
|
+
onDismiss?.();
|
|
223
|
+
}}
|
|
224
|
+
>
|
|
225
|
+
<Cross
|
|
226
|
+
height={16}
|
|
227
|
+
width={16}
|
|
228
|
+
crossColor={
|
|
229
|
+
isSelected ? theme.color.chip.selectedPrimaryLabel : theme.color.chip.nonSelectedPrimaryLabel
|
|
230
|
+
}
|
|
231
|
+
/>
|
|
232
|
+
</button>
|
|
233
|
+
)}
|
|
234
|
+
</Container>
|
|
235
|
+
</Container>
|
|
236
|
+
);
|
|
237
|
+
},
|
|
238
|
+
);
|
|
239
|
+
|
|
240
|
+
Chip.displayName = 'Chip';
|
|
241
|
+
|
|
242
|
+
export default Chip;
|
package/src/Shimmer.tsx
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SVGProps } from 'react';
|
|
2
|
+
|
|
3
|
+
const ChipShimmer = (props: SVGProps<SVGSVGElement>) => {
|
|
4
|
+
return (
|
|
5
|
+
<svg width='50' height='50' viewBox='0 0 69 98' fill='none' xmlns='http://www.w3.org/2000/svg' {...props}>
|
|
6
|
+
<g opacity='1' filter='url(#filter0_f_13505_53133)'>
|
|
7
|
+
<rect x='43' y='16.6328' width='10.541' height='66' transform='rotate(24 43 16.6328)' fill='white'></rect>
|
|
8
|
+
</g>
|
|
9
|
+
<defs>
|
|
10
|
+
<filter
|
|
11
|
+
id='filter0_f_13505_53133'
|
|
12
|
+
x='0.15625'
|
|
13
|
+
y='0.632812'
|
|
14
|
+
width='68.4727'
|
|
15
|
+
height='96.5813'
|
|
16
|
+
filterUnits='userSpaceOnUse'
|
|
17
|
+
colorInterpolationFilters='sRGB'
|
|
18
|
+
>
|
|
19
|
+
<feFlood floodOpacity='0' result='BackgroundImageFix'></feFlood>
|
|
20
|
+
<feBlend mode='normal' in='SourceGraphic' in2='BackgroundImageFix' result='shape'></feBlend>
|
|
21
|
+
<feGaussianBlur stdDeviation='8' result='effect1_foregroundBlur_13505_53133'></feGaussianBlur>
|
|
22
|
+
</filter>
|
|
23
|
+
</defs>
|
|
24
|
+
</svg>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default ChipShimmer;
|
package/src/constants.ts
ADDED
package/src/index.ts
ADDED
package/src/style.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Theme } from '@cleartrip/ct-design-theme';
|
|
2
|
+
import { TypographyColor } from '@cleartrip/ct-design-typography';
|
|
3
|
+
|
|
4
|
+
import { ChipSize } from './type';
|
|
5
|
+
interface ChipStyleProps {
|
|
6
|
+
theme: Theme;
|
|
7
|
+
size: ChipSize;
|
|
8
|
+
isSelected: boolean;
|
|
9
|
+
isDisabled: boolean;
|
|
10
|
+
topIcon?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const getDefaultChipStyles = (theme: Theme, size: ChipSize, topIcon = false) => {
|
|
14
|
+
const baseStyles = {
|
|
15
|
+
borderRadius: 50,
|
|
16
|
+
borderStyle: theme.border.style.solid,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
if (topIcon) {
|
|
20
|
+
return {
|
|
21
|
+
...baseStyles,
|
|
22
|
+
paddingVertical: theme.spacing[2],
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
...baseStyles,
|
|
28
|
+
height: theme.size[8],
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const getBorderStyles = (theme: Theme, isSelected: boolean, isDisabled: boolean) => {
|
|
33
|
+
if (isDisabled) {
|
|
34
|
+
return {
|
|
35
|
+
borderWidth: theme.border.width.none,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (isSelected) {
|
|
40
|
+
return {
|
|
41
|
+
borderColor: theme.color.border.primary,
|
|
42
|
+
borderWidth: theme.border.width.md,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
borderColor: theme.color.border.disabledDark,
|
|
48
|
+
borderWidth: theme.border.width.sm,
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const getBackgroundColorStyles = (theme: Theme, isSelected: boolean, isDisabled: boolean) => {
|
|
53
|
+
if (isDisabled) {
|
|
54
|
+
return {
|
|
55
|
+
backgroundColor: theme.color.background.disabled,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (isSelected) {
|
|
60
|
+
return {
|
|
61
|
+
backgroundColor: theme.color.chip.selectedPrimaryBg,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return {
|
|
66
|
+
backgroundColor: theme.color.background.neutral,
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const getLabelColor = (isDisabled: boolean): TypographyColor => {
|
|
71
|
+
return isDisabled ? TypographyColor.DISABLED : TypographyColor.PRIMARY;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const getChipStyles = ({ theme, size, isDisabled, isSelected, topIcon = false }: ChipStyleProps) => ({
|
|
75
|
+
...getDefaultChipStyles(theme, size, topIcon),
|
|
76
|
+
...getBorderStyles(theme, isSelected, isDisabled),
|
|
77
|
+
...getBackgroundColorStyles(theme, isSelected, isDisabled),
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
export { getLabelColor };
|
package/src/type.ts
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { ReactNode, SVGProps } from 'react';
|
|
2
|
+
import type { IconPosition, Styles } from '@cleartrip/ct-design-types';
|
|
3
|
+
import type { TypographyStyleConfigProps, TypographyVariantType } from '@cleartrip/ct-design-typography';
|
|
4
|
+
|
|
5
|
+
import { ChipVariant, ChipSizeType } from './constants';
|
|
6
|
+
|
|
7
|
+
export type ChipVariantType = `${ChipVariant}`;
|
|
8
|
+
|
|
9
|
+
export type ChipSize = `${ChipSizeType}`;
|
|
10
|
+
|
|
11
|
+
export type ChipBorderWidth = 'none' | 'sm' | 'md' | 'lg';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Style configuration for the Chip's composable slots.
|
|
15
|
+
*/
|
|
16
|
+
export interface IChipStyleConfig {
|
|
17
|
+
/** Styles for the absolute-positioning relative container wrapping the chip. */
|
|
18
|
+
relativeContainer?: Styles[];
|
|
19
|
+
/** Styles for the root chip container. */
|
|
20
|
+
root?: Styles[];
|
|
21
|
+
/** Styles for the inner flex row container holding icon + label. */
|
|
22
|
+
chipContainer?: Styles[];
|
|
23
|
+
/** Styles for the prefix icon container (yagami-style API). */
|
|
24
|
+
prefixIconContainer?: Styles[];
|
|
25
|
+
/** Styles for the suffix icon container (yagami-style API). */
|
|
26
|
+
suffixIconContainer?: Styles[];
|
|
27
|
+
/** Styles for the top icon container. */
|
|
28
|
+
topIconContainer?: Styles[];
|
|
29
|
+
/** Styles for the label text wrapper. */
|
|
30
|
+
labelContainer?: Styles[];
|
|
31
|
+
/** Styles for the label Typography. */
|
|
32
|
+
labelTypography?: TypographyStyleConfigProps;
|
|
33
|
+
/** Styles for the cross (dismiss) icon wrapper. */
|
|
34
|
+
crossContainer?: Styles[];
|
|
35
|
+
/** Styles for the absolute counter container. */
|
|
36
|
+
counterContainer?: Styles[];
|
|
37
|
+
/** Styles for the counter bubble. */
|
|
38
|
+
counter?: Styles[];
|
|
39
|
+
/** Styles for the counter Typography. */
|
|
40
|
+
counterTypography?: TypographyStyleConfigProps;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface IChipProps {
|
|
44
|
+
/** Unique identifier for the chip. */
|
|
45
|
+
id?: string;
|
|
46
|
+
/** Props spread onto the cross icon SVG. */
|
|
47
|
+
crossIconProps?: SVGProps<SVGSVGElement>;
|
|
48
|
+
|
|
49
|
+
/** The label content of the chip. */
|
|
50
|
+
label?: ReactNode | string;
|
|
51
|
+
|
|
52
|
+
/** Typography variant for string labels. Defaults to 'B2'. */
|
|
53
|
+
labelVariant?: TypographyVariantType;
|
|
54
|
+
|
|
55
|
+
/** If true, shows the `Icon` at the specified `iconPosition`. */
|
|
56
|
+
showIcon?: boolean;
|
|
57
|
+
|
|
58
|
+
/** Position of the icon within the chip. */
|
|
59
|
+
iconPosition?: `${IconPosition}`;
|
|
60
|
+
|
|
61
|
+
/** The ReactNode representing the icon within the chip. */
|
|
62
|
+
Icon?: ReactNode;
|
|
63
|
+
|
|
64
|
+
/** Icon rendered before the label (takes precedence over `Icon` + iconPosition='left'). */
|
|
65
|
+
prefixIcon?: ReactNode;
|
|
66
|
+
|
|
67
|
+
/** Icon rendered after the label (takes precedence over `Icon` + iconPosition='right'). */
|
|
68
|
+
suffixIcon?: ReactNode;
|
|
69
|
+
|
|
70
|
+
/** Icon rendered above the label (takes precedence over `Icon` + iconPosition='top'). */
|
|
71
|
+
topIcon?: ReactNode;
|
|
72
|
+
|
|
73
|
+
/** If true, shows a counter within the chip. */
|
|
74
|
+
showCounter?: boolean;
|
|
75
|
+
|
|
76
|
+
/** The count value displayed in the counter. */
|
|
77
|
+
count?: number;
|
|
78
|
+
|
|
79
|
+
/** If true, the chip can be dismissed. */
|
|
80
|
+
isDismissible?: boolean;
|
|
81
|
+
|
|
82
|
+
/** If true, the chip is selected. */
|
|
83
|
+
isSelected?: boolean;
|
|
84
|
+
|
|
85
|
+
/** If true, the chip is disabled. */
|
|
86
|
+
isDisabled?: boolean;
|
|
87
|
+
|
|
88
|
+
/** Alias for `isDisabled` — kept for yagami parity. */
|
|
89
|
+
disabled?: boolean;
|
|
90
|
+
|
|
91
|
+
/** Callback function triggered on chip click. */
|
|
92
|
+
onClick?: () => void;
|
|
93
|
+
|
|
94
|
+
/** Callback function triggered on chip dismissal. */
|
|
95
|
+
onDismiss?: () => void;
|
|
96
|
+
|
|
97
|
+
/** The border width of the chip. */
|
|
98
|
+
borderWidth?: ChipBorderWidth;
|
|
99
|
+
|
|
100
|
+
/** Visual variant for the chip. */
|
|
101
|
+
variant?: ChipVariantType;
|
|
102
|
+
|
|
103
|
+
/** Size preset (sm | md). */
|
|
104
|
+
size?: ChipSize;
|
|
105
|
+
|
|
106
|
+
/** Style configuration for different parts of the chip. */
|
|
107
|
+
styleConfig?: IChipStyleConfig;
|
|
108
|
+
|
|
109
|
+
/** Show shimmer animation (web only). */
|
|
110
|
+
showShimmerAnimation?: boolean;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @deprecated Use `IChipProps`. Kept as an alias for legacy consumers that
|
|
115
|
+
* imported `ChipProps` from `@cleartrip/ct-design-chip`. The `styleConfig`
|
|
116
|
+
* slots have been migrated from `{ css, className }` objects to `Styles[]`
|
|
117
|
+
* arrays; legacy call sites will need to migrate.
|
|
118
|
+
*/
|
|
119
|
+
export type ChipProps = IChipProps;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { CSSProperties } from 'styled-components';
|
|
2
|
-
import { StyledChipProps } from './type';
|
|
3
|
-
declare const StyledChip: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, StyledChipProps & {
|
|
4
|
-
css?: CSSProperties | undefined;
|
|
5
|
-
}, never>;
|
|
6
|
-
export default StyledChip;
|
|
7
|
-
//# sourceMappingURL=StyledChip.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StyledChip.d.ts","sourceRoot":"","sources":["../../packages/components/Chip/src/StyledChip/StyledChip.tsx"],"names":[],"mappings":"AAAA,OAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAEzC,QAAA,MAAM,UAAU;;SAgCf,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/components/Chip/src/StyledChip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { CSSObject } from 'styled-components';
|
|
2
|
-
import { Theme } from '@cleartrip/ct-design-theme';
|
|
3
|
-
import { StyledChipProps } from './type';
|
|
4
|
-
export declare const getStyledChipStyles: ({ theme, backgroundColor, borderColor, borderRadius, borderWidth, cursor, paddingTop, paddingBottom, paddingLeft, paddingRight, boxShadow, webkitBoxShadow, }: StyledChipProps & {
|
|
5
|
-
theme: Theme;
|
|
6
|
-
}) => CSSObject;
|
|
7
|
-
//# sourceMappingURL=style.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../packages/components/Chip/src/StyledChip/style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAEzC,eAAO,MAAM,mBAAmB;WAaF,KAAK;MAAK,SAiBvC,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { CSSObject } from 'styled-components';
|
|
2
|
-
export interface StyledChipProps {
|
|
3
|
-
borderColor?: string;
|
|
4
|
-
borderRadius?: string;
|
|
5
|
-
borderWidth?: string;
|
|
6
|
-
backgroundColor?: string;
|
|
7
|
-
paddingTop?: string;
|
|
8
|
-
paddingBottom?: string;
|
|
9
|
-
paddingLeft?: string;
|
|
10
|
-
paddingRight?: string;
|
|
11
|
-
cursor?: CSSObject['cursor'];
|
|
12
|
-
boxShadow?: string;
|
|
13
|
-
webkitBoxShadow?: string;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=type.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../packages/components/Chip/src/StyledChip/type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,MAAM,WAAW,eAAe;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { CSSProperties } from 'styled-components';
|
|
2
|
-
import { StyledCounterProps } from './type';
|
|
3
|
-
declare const StyledCounter: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, StyledCounterProps & {
|
|
4
|
-
css?: CSSProperties | undefined;
|
|
5
|
-
}, never>;
|
|
6
|
-
export default StyledCounter;
|
|
7
|
-
//# sourceMappingURL=StyledCounter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StyledCounter.d.ts","sourceRoot":"","sources":["../../packages/components/Chip/src/StyledCounter/StyledCounter.tsx"],"names":[],"mappings":"AAAA,OAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAE5C,QAAA,MAAM,aAAa;;SAElB,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/components/Chip/src/StyledCounter/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { CSSObject } from 'styled-components';
|
|
2
|
-
import { Theme } from '@cleartrip/ct-design-theme';
|
|
3
|
-
import { StyledCounterProps } from './type';
|
|
4
|
-
export declare const getStyledCounterStyles: ({ backgroundColor, theme, }: StyledCounterProps & {
|
|
5
|
-
theme: Theme;
|
|
6
|
-
}) => CSSObject;
|
|
7
|
-
//# sourceMappingURL=style.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../packages/components/Chip/src/StyledCounter/style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAE5C,eAAO,MAAM,sBAAsB;WAGF,KAAK;MAAK,SAU1C,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../packages/components/Chip/src/StyledCounter/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B"}
|