@cleartrip/ct-design-dropdown 4.0.0-TEST.3 → 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.
Files changed (46) hide show
  1. package/README.md +63 -0
  2. package/dist/Dropdown.d.ts +0 -1
  3. package/dist/Dropdown.d.ts.map +1 -1
  4. package/dist/Dropdown.native.d.ts +4 -0
  5. package/dist/Dropdown.native.d.ts.map +1 -0
  6. package/dist/ct-design-dropdown.browser.cjs.js +1 -1
  7. package/dist/ct-design-dropdown.browser.cjs.js.map +1 -1
  8. package/dist/ct-design-dropdown.browser.esm.js +1 -1
  9. package/dist/ct-design-dropdown.browser.esm.js.map +1 -1
  10. package/dist/ct-design-dropdown.cjs.js +105 -108
  11. package/dist/ct-design-dropdown.cjs.js.map +1 -1
  12. package/dist/ct-design-dropdown.esm.js +109 -107
  13. package/dist/ct-design-dropdown.esm.js.map +1 -1
  14. package/dist/ct-design-dropdown.umd.js +107 -146
  15. package/dist/ct-design-dropdown.umd.js.map +1 -1
  16. package/dist/index.d.ts +1 -1
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.native.d.ts +3 -0
  19. package/dist/index.native.d.ts.map +1 -0
  20. package/dist/style.d.ts +41 -5
  21. package/dist/style.d.ts.map +1 -1
  22. package/dist/type.d.ts +22 -28
  23. package/dist/type.d.ts.map +1 -1
  24. package/package.json +22 -17
  25. package/src/Dropdown.native.tsx +236 -0
  26. package/src/Dropdown.tsx +221 -0
  27. package/src/index.native.ts +2 -0
  28. package/src/index.ts +2 -0
  29. package/src/style.ts +51 -0
  30. package/src/type.ts +70 -0
  31. package/dist/DropdownOption/DropdownOption.d.ts +0 -5
  32. package/dist/DropdownOption/DropdownOption.d.ts.map +0 -1
  33. package/dist/DropdownOption/StyledDropdownOption/StyledDropdownOption.d.ts +0 -8
  34. package/dist/DropdownOption/StyledDropdownOption/StyledDropdownOption.d.ts.map +0 -1
  35. package/dist/DropdownOption/index.d.ts +0 -2
  36. package/dist/DropdownOption/index.d.ts.map +0 -1
  37. package/dist/DropdownOption/type.d.ts +0 -20
  38. package/dist/DropdownOption/type.d.ts.map +0 -1
  39. package/dist/StyledDropdown/StyledDropdown.d.ts +0 -7
  40. package/dist/StyledDropdown/StyledDropdown.d.ts.map +0 -1
  41. package/dist/StyledDropdown/index.d.ts +0 -2
  42. package/dist/StyledDropdown/index.d.ts.map +0 -1
  43. package/dist/StyledDropdown/style.d.ts +0 -7
  44. package/dist/StyledDropdown/style.d.ts.map +0 -1
  45. package/dist/StyledDropdown/type.d.ts +0 -9
  46. package/dist/StyledDropdown/type.d.ts.map +0 -1
@@ -0,0 +1,236 @@
1
+ import { useRef, useState } from 'react';
2
+
3
+ import { Dimensions, GestureResponderEvent, LayoutChangeEvent, Modal, Pressable, ScrollView, View } from 'react-native';
4
+ import { Container } from '@cleartrip/ct-design-container';
5
+ import { Typography, TypographyColor, TypographyVariant } from '@cleartrip/ct-design-typography';
6
+ import { makeStyles, useStyles } from '@cleartrip/ct-design-style-manager';
7
+ import { ChevronDown } from '@cleartrip/ct-design-icons';
8
+
9
+ import { DropdownProps, Item } from './type';
10
+
11
+ const { height: screenHeight } = Dimensions.get('screen');
12
+
13
+ const staticStyle = makeStyles(() => ({
14
+ dropDownItemListContainer: {
15
+ width: '100%',
16
+ maxHeight: screenHeight * 0.19,
17
+ borderRadius: 5,
18
+ position: 'absolute',
19
+ overflow: 'hidden',
20
+ shadowColor: '#000',
21
+ shadowOffset: { width: 0, height: 1 },
22
+ shadowOpacity: 0.22,
23
+ shadowRadius: 2.22,
24
+ elevation: 3,
25
+ backgroundColor: 'white',
26
+ },
27
+ modalBackground: {
28
+ flex: 1,
29
+ backgroundColor: 'rgba(0, 0, 0, 0.0)',
30
+ },
31
+ overlayButtonWrapper: {
32
+ position: 'absolute',
33
+ alignItems: 'center',
34
+ },
35
+ dropDownItemContainer: {
36
+ width: '100%',
37
+ justifyContent: 'center',
38
+ paddingHorizontal: 16,
39
+ paddingVertical: 12,
40
+ },
41
+ rootContainer: {
42
+ width: '100%',
43
+ backgroundColor: '#fff',
44
+ },
45
+ chevronDownContainer: {
46
+ height: 24,
47
+ left: 3,
48
+ paddingRight: 12,
49
+ },
50
+ scrollContent: {
51
+ backgroundColor: '#fff',
52
+ },
53
+ }));
54
+
55
+ const Dropdown: React.FC<DropdownProps> = ({
56
+ placeHolder,
57
+ itemList,
58
+ height = 40,
59
+ styleConfig = {},
60
+ dropDownValue,
61
+ defaultSelectedIndex,
62
+ onItemSelect,
63
+ renderItem,
64
+ showDropDownListOnTop = true,
65
+ }) => {
66
+ const {
67
+ placeHolderContainer = [],
68
+ placeHolderTextContainer = [],
69
+ dropDownItemListContainer = [],
70
+ dropDownItemTextContainer = {},
71
+ dropDownItemContainer = [],
72
+ } = styleConfig;
73
+
74
+ const scrollRef = useRef<ScrollView | null>(null);
75
+ const itemsRef = useRef<number[]>([]);
76
+ const [focus, setFocus] = useState<boolean>(false);
77
+ const [singleSelectIndex, setSingleSelectIndex] = useState<number>(defaultSelectedIndex ?? -1);
78
+ const [isNearToBottom, setIsNearToBottom] = useState<boolean>(false);
79
+ const [isNearToTop, setIsNearToTop] = useState<boolean>(false);
80
+
81
+ const isShowDropDownOnTop = isNearToBottom === isNearToTop ? showDropDownListOnTop : !isNearToTop;
82
+
83
+ const dynamicStyles = useStyles(
84
+ (themeArg) => ({
85
+ placeHolderContainer: {
86
+ width: '100%',
87
+ height,
88
+ backgroundColor: 'white',
89
+ borderRadius: 5,
90
+ flexDirection: 'row',
91
+ alignItems: 'center',
92
+ borderColor: focus ? themeArg.color.border.primary : '#e0e0e0',
93
+ borderWidth: 1,
94
+ },
95
+ placeHolderTextContainer: {
96
+ flex: 1,
97
+ height,
98
+ justifyContent: 'center',
99
+ paddingHorizontal: 12,
100
+ },
101
+ }),
102
+ [focus, height],
103
+ );
104
+
105
+ const singleSelectClickHandler = (item: Item, index: number) => {
106
+ setSingleSelectIndex(index);
107
+ onItemSelect?.(item, index);
108
+ setFocus(false);
109
+ };
110
+
111
+ const scrollToIndex = (targetIndex: number | undefined) => {
112
+ if (targetIndex === undefined) return;
113
+ if (itemsRef.current.length > targetIndex) {
114
+ scrollRef?.current?.scrollTo({ x: 0, y: itemsRef.current[targetIndex], animated: true });
115
+ }
116
+ };
117
+
118
+ const [position, setPosition] = useState({ x: 0, y: 0, width: 0, height: 0 });
119
+
120
+ const toggleDropDown = (e: GestureResponderEvent) => {
121
+ const target = e.currentTarget as unknown as {
122
+ measureInWindow?: (callback: (x: number, y: number, width: number, elementHeight: number) => void) => void;
123
+ };
124
+
125
+ if (target && typeof target.measureInWindow === 'function') {
126
+ target.measureInWindow((x: number, y: number, width: number, elementHeight: number) => {
127
+ const isNearBottom = y + height + (screenHeight * 0.19 + 60) > screenHeight;
128
+ const isNearTop = y - (screenHeight * 0.19 + 60) < 0;
129
+ setIsNearToBottom(isNearBottom);
130
+ setIsNearToTop(isNearTop);
131
+ setPosition({ x, y, width, height: elementHeight });
132
+ setFocus((state) => !state);
133
+ });
134
+ } else {
135
+ const { pageX: px, pageY: py } = e.nativeEvent;
136
+ const isNearBottom = py + height + (screenHeight * 0.19 + 60) > screenHeight;
137
+ const isNearTop = py - (screenHeight * 0.19 + 60) < 0;
138
+ setIsNearToBottom(isNearBottom);
139
+ setIsNearToTop(isNearTop);
140
+ setPosition({ x: px, y: py, width: 100, height });
141
+ setFocus((state) => !state);
142
+ }
143
+ };
144
+
145
+ const dropDownItemList = focus && (
146
+ <Container
147
+ styleConfig={{
148
+ root: [
149
+ staticStyle.dropDownItemListContainer,
150
+ ...dropDownItemListContainer,
151
+ isShowDropDownOnTop ? { bottom: -height } : { top: 0 },
152
+ ],
153
+ }}
154
+ >
155
+ <ScrollView
156
+ ref={scrollRef}
157
+ contentContainerStyle={[staticStyle.scrollContent]}
158
+ showsVerticalScrollIndicator={false}
159
+ >
160
+ {itemList.map((item, index) => {
161
+ const dropdownItem = renderItem?.(item, index) || item?.label;
162
+ const backgroundColor = index === singleSelectIndex ? '#1a1a1a' : 'white';
163
+ const isSelected = index === singleSelectIndex;
164
+
165
+ return (
166
+ <Pressable
167
+ key={`${item.value}-${index}`}
168
+ onLayout={(event: LayoutChangeEvent) => {
169
+ const layout = event.nativeEvent.layout;
170
+ itemsRef.current[index] = layout.y;
171
+ if (itemList.length - 1 === index && focus) {
172
+ scrollToIndex(singleSelectIndex);
173
+ }
174
+ }}
175
+ style={({ pressed }) => [
176
+ { backgroundColor: pressed ? 'rgb(231, 231, 231)' : backgroundColor },
177
+ staticStyle.dropDownItemContainer,
178
+ ...dropDownItemContainer,
179
+ ]}
180
+ onPress={() => singleSelectClickHandler(item, index)}
181
+ >
182
+ <Typography
183
+ styleConfig={dropDownItemTextContainer}
184
+ variant={TypographyVariant.HM4}
185
+ color={isSelected ? TypographyColor.NEUTRAL : TypographyColor.PRIMARY}
186
+ >
187
+ {' '}
188
+ {dropdownItem}
189
+ </Typography>
190
+ </Pressable>
191
+ );
192
+ })}
193
+ </ScrollView>
194
+ </Container>
195
+ );
196
+
197
+ return (
198
+ <Container styleConfig={{ root: [staticStyle.rootContainer] }}>
199
+ <Modal visible={focus} transparent animationType='none' onRequestClose={() => setFocus(false)}>
200
+ <Pressable style={staticStyle.modalBackground} onPress={() => setFocus(false)}>
201
+ <View
202
+ style={[
203
+ staticStyle.overlayButtonWrapper,
204
+ {
205
+ top: isShowDropDownOnTop ? position.y - height : position.y + position.height,
206
+ left: position.x,
207
+ width: position.width,
208
+ },
209
+ ]}
210
+ >
211
+ {dropDownItemList}
212
+ </View>
213
+ </Pressable>
214
+ </Modal>
215
+
216
+ <Pressable onPress={toggleDropDown} style={[dynamicStyles.placeHolderContainer, ...placeHolderContainer]}>
217
+ <Container styleConfig={{ root: [dynamicStyles.placeHolderTextContainer] }}>
218
+ <Typography
219
+ color={dropDownValue.length > 0 ? TypographyColor.PRIMARY : TypographyColor.DISABLED}
220
+ lineClamp={1}
221
+ styleConfig={{ root: placeHolderTextContainer }}
222
+ variant={TypographyVariant.HM4}
223
+ >
224
+ {dropDownValue.length > 0 ? dropDownValue : placeHolder}
225
+ </Typography>
226
+ </Container>
227
+
228
+ <Container styleConfig={{ root: [staticStyle.chevronDownContainer] }}>
229
+ <ChevronDown />
230
+ </Container>
231
+ </Pressable>
232
+ </Container>
233
+ );
234
+ };
235
+
236
+ export default Dropdown;
@@ -0,0 +1,221 @@
1
+ import { useRef, useState, useEffect } from 'react';
2
+
3
+ import { Typography, TypographyVariant, TypographyColor } from '@cleartrip/ct-design-typography';
4
+ import { makeStyles, useStyles, useWebMergeStyles } from '@cleartrip/ct-design-style-manager';
5
+ import { ChevronDown } from '@cleartrip/ct-design-icons';
6
+
7
+ import { getChevronContainerStyles, getPlaceHolderTextContainerStyles } from './style';
8
+ import { DropdownProps, Item } from './type';
9
+
10
+ const staticStyles = makeStyles(() => ({
11
+ root: {
12
+ width: '100%',
13
+ backgroundColor: '#fff',
14
+ position: 'relative',
15
+ },
16
+ dropDownItemListContainer: {
17
+ width: '100%',
18
+ maxHeight: 240,
19
+ borderRadius: 5,
20
+ position: 'absolute',
21
+ overflow: 'hidden',
22
+ shadowColor: '#000',
23
+ shadowOffset: { width: 0, height: 1 },
24
+ shadowOpacity: 0.22,
25
+ shadowRadius: 2.22,
26
+ elevation: 3,
27
+ backgroundColor: '#fff',
28
+ },
29
+ dropDownItemContainer: {
30
+ width: '100%',
31
+ justifyContent: 'center',
32
+ paddingHorizontal: 16,
33
+ paddingVertical: 12,
34
+ },
35
+ chevronDownContainer: getChevronContainerStyles(),
36
+ scrollArea: {
37
+ maxHeight: 240,
38
+ overflowY: 'auto',
39
+ },
40
+ }));
41
+
42
+ const DropdownListItem: React.FC<DropdownListItemProps> = ({
43
+ item,
44
+ index,
45
+ isSelected,
46
+ dropdownItem,
47
+ onSelect,
48
+ customItemContainer = [],
49
+ customItemTextContainer = {},
50
+ }) => {
51
+ const itemDynamicStyles = useStyles(
52
+ () => ({
53
+ root: {
54
+ backgroundColor: isSelected ? '#1a1a1a' : '#fff',
55
+ cursor: 'pointer',
56
+ width: '100%',
57
+ justifyContent: 'center',
58
+ paddingHorizontal: 16,
59
+ paddingVertical: 12,
60
+ },
61
+ }),
62
+ [isSelected],
63
+ );
64
+
65
+ const mergedItemClassName = useWebMergeStyles(
66
+ [itemDynamicStyles.root, ...customItemContainer],
67
+ [itemDynamicStyles.root, customItemContainer],
68
+ );
69
+
70
+ return (
71
+ <div className={mergedItemClassName} onClick={() => onSelect(item, index)}>
72
+ <Typography
73
+ styleConfig={customItemTextContainer}
74
+ variant={TypographyVariant.HM4}
75
+ color={isSelected ? TypographyColor.NEUTRAL : TypographyColor.PRIMARY}
76
+ >
77
+ {dropdownItem}
78
+ </Typography>
79
+ </div>
80
+ );
81
+ };
82
+
83
+ const Dropdown: React.FC<DropdownProps> = ({
84
+ placeHolder,
85
+ itemList,
86
+ height = 40,
87
+ styleConfig = {},
88
+ dropDownValue,
89
+ defaultSelectedIndex,
90
+ onItemSelect,
91
+ renderItem,
92
+ showDropDownListOnTop = true,
93
+ }) => {
94
+ const {
95
+ placeHolderContainer: customPlaceHolderContainer = [],
96
+ placeHolderTextContainer: customPlaceHolderTextContainer = [],
97
+ dropDownItemListContainer: customDropDownItemListContainer = [],
98
+ dropDownItemContainer: customDropDownItemContainer = [],
99
+ dropDownItemTextContainer = {},
100
+ } = styleConfig;
101
+
102
+ const rootRef = useRef<HTMLDivElement | null>(null);
103
+ const [focus, setFocus] = useState<boolean>(false);
104
+ const [singleSelectIndex, setSingleSelectIndex] = useState<number>(defaultSelectedIndex ?? -1);
105
+
106
+ useEffect(() => {
107
+ if (!focus) return;
108
+ const handleOutside = (event: MouseEvent) => {
109
+ if (rootRef.current && !rootRef.current.contains(event.target as Node)) {
110
+ setFocus(false);
111
+ }
112
+ };
113
+ document.addEventListener('mousedown', handleOutside);
114
+ return () => document.removeEventListener('mousedown', handleOutside);
115
+ }, [focus]);
116
+
117
+ const dynamicStyles = useStyles(
118
+ (theme) => ({
119
+ placeHolderContainer: {
120
+ width: '100%',
121
+ height,
122
+ backgroundColor: '#fff',
123
+ borderRadius: 5,
124
+ flexDirection: 'row',
125
+ alignItems: 'center',
126
+ borderColor: focus ? theme.color.border.primary : '#e0e0e0',
127
+ borderWidth: 1,
128
+ },
129
+ placeHolderTextContainer: getPlaceHolderTextContainerStyles(height),
130
+ }),
131
+ [focus, height],
132
+ );
133
+
134
+ const singleSelectClickHandler = (item: Item, index: number) => {
135
+ setSingleSelectIndex(index);
136
+ onItemSelect?.(item, index);
137
+ setFocus(false);
138
+ };
139
+
140
+ const toggleDropDown = () => setFocus((state) => !state);
141
+
142
+ const isShownOnTop = showDropDownListOnTop;
143
+
144
+ const mergedRootClassName = useWebMergeStyles([staticStyles.root], []);
145
+
146
+ const mergedPlaceHolderClassName = useWebMergeStyles(
147
+ [dynamicStyles.placeHolderContainer, ...customPlaceHolderContainer],
148
+ [dynamicStyles.placeHolderContainer, customPlaceHolderContainer],
149
+ );
150
+
151
+ const mergedPlaceHolderTextClassName = useWebMergeStyles(
152
+ [dynamicStyles.placeHolderTextContainer],
153
+ [dynamicStyles.placeHolderTextContainer],
154
+ );
155
+
156
+ const mergedChevronClassName = useWebMergeStyles([staticStyles.chevronDownContainer], []);
157
+
158
+ const listPositionStyle = isShownOnTop ? { bottom: height } : { top: height };
159
+
160
+ const mergedListClassName = useWebMergeStyles(
161
+ [
162
+ staticStyles.dropDownItemListContainer,
163
+ listPositionStyle,
164
+ staticStyles.scrollArea,
165
+ ...customDropDownItemListContainer,
166
+ ],
167
+ [isShownOnTop, height, customDropDownItemListContainer],
168
+ );
169
+
170
+ return (
171
+ <div ref={rootRef} className={mergedRootClassName}>
172
+ <div className={mergedPlaceHolderClassName} onClick={toggleDropDown}>
173
+ <div className={mergedPlaceHolderTextClassName}>
174
+ <Typography
175
+ color={dropDownValue.length > 0 ? TypographyColor.PRIMARY : TypographyColor.DISABLED}
176
+ lineClamp={1}
177
+ styleConfig={{ root: customPlaceHolderTextContainer }}
178
+ variant={TypographyVariant.HM4}
179
+ >
180
+ {dropDownValue.length > 0 ? dropDownValue : placeHolder}
181
+ </Typography>
182
+ </div>
183
+ <div className={mergedChevronClassName}>
184
+ <ChevronDown />
185
+ </div>
186
+ </div>
187
+ {focus && (
188
+ <div className={mergedListClassName}>
189
+ {itemList.map((item, index) => {
190
+ const dropdownItem = renderItem?.(item, index) || item?.label;
191
+ const isSelected = index === singleSelectIndex;
192
+ return (
193
+ <DropdownListItem
194
+ key={`${item.value}-${index}`}
195
+ item={item}
196
+ index={index}
197
+ isSelected={isSelected}
198
+ dropdownItem={dropdownItem}
199
+ onSelect={singleSelectClickHandler}
200
+ customItemContainer={customDropDownItemContainer}
201
+ customItemTextContainer={dropDownItemTextContainer}
202
+ />
203
+ );
204
+ })}
205
+ </div>
206
+ )}
207
+ </div>
208
+ );
209
+ };
210
+
211
+ interface DropdownListItemProps {
212
+ item: Item;
213
+ index: number;
214
+ isSelected: boolean;
215
+ dropdownItem: React.ReactNode;
216
+ onSelect: (item: Item, index: number) => void;
217
+ customItemContainer: NonNullable<DropdownProps['styleConfig']>['dropDownItemContainer'];
218
+ customItemTextContainer: NonNullable<DropdownProps['styleConfig']>['dropDownItemTextContainer'];
219
+ }
220
+
221
+ export default Dropdown;
@@ -0,0 +1,2 @@
1
+ export { default as Dropdown } from './Dropdown.native';
2
+ export type * from './type';
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { default as Dropdown } from './Dropdown';
2
+ export type * from './type';
package/src/style.ts ADDED
@@ -0,0 +1,51 @@
1
+ import type { Theme } from '@cleartrip/ct-design-theme';
2
+
3
+ export const getDropdownListContainerStyles = () => ({
4
+ width: '100%',
5
+ maxHeight: 240,
6
+ borderRadius: 5,
7
+ position: 'absolute',
8
+ overflow: 'hidden',
9
+ shadowColor: '#000',
10
+ shadowOffset: { width: 0, height: 1 },
11
+ shadowOpacity: 0.22,
12
+ shadowRadius: 2.22,
13
+ elevation: 3,
14
+ backgroundColor: '#fff',
15
+ });
16
+
17
+ export const getDropdownItemContainerStyles = () => ({
18
+ width: '100%',
19
+ justifyContent: 'center',
20
+ paddingHorizontal: 16,
21
+ paddingVertical: 12,
22
+ });
23
+
24
+ export const getRootContainerStyles = () => ({
25
+ width: '100%',
26
+ backgroundColor: '#fff',
27
+ });
28
+
29
+ export const getChevronContainerStyles = () => ({
30
+ height: 24,
31
+ left: 3,
32
+ paddingRight: 12,
33
+ });
34
+
35
+ export const getPlaceHolderContainerStyles = (theme: Theme, height: number, focus: boolean) => ({
36
+ width: '100%',
37
+ height,
38
+ backgroundColor: '#fff',
39
+ borderRadius: 5,
40
+ flexDirection: 'row',
41
+ alignItems: 'center',
42
+ borderColor: focus ? theme.color.border.primary : '#e0e0e0',
43
+ borderWidth: 1,
44
+ });
45
+
46
+ export const getPlaceHolderTextContainerStyles = (height: number) => ({
47
+ flex: 1,
48
+ height,
49
+ justifyContent: 'center' as const,
50
+ paddingHorizontal: 12,
51
+ });
package/src/type.ts ADDED
@@ -0,0 +1,70 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ import type { Styles, TextStyle } from '@cleartrip/ct-design-types';
4
+ import { TypographyStyleConfigProps } from '@cleartrip/ct-design-typography';
5
+
6
+ export interface Item {
7
+ label: string;
8
+ value: string | number;
9
+ disabled?: boolean;
10
+ icon?: ReactNode;
11
+ [key: string]: string | number | boolean | ReactNode | undefined;
12
+ }
13
+
14
+ export interface DropdownProps {
15
+ /**
16
+ * Style configuration for the root Container height (default: 40).
17
+ */
18
+ height?: number;
19
+
20
+ /**
21
+ * The currently selected value(s) in the dropdown
22
+ */
23
+ dropDownValue: string | string[];
24
+
25
+ /**
26
+ * Index of the item selected by default.
27
+ */
28
+ defaultSelectedIndex?: number;
29
+
30
+ /**
31
+ * Placeholder text shown when no value is selected.
32
+ */
33
+ placeHolder?: string;
34
+
35
+ /**
36
+ * List of items to display in the dropdown.
37
+ */
38
+ itemList: Item[];
39
+
40
+ /**
41
+ * Callback when an item is selected.
42
+ */
43
+ onItemSelect: (item: Item, index: number) => void;
44
+
45
+ /**
46
+ * Custom render function for dropdown items.
47
+ */
48
+ renderItem?: (item: Item, index: number) => string | ReactNode;
49
+
50
+ /**
51
+ * Whether to show the dropdown list above the trigger.
52
+ */
53
+ showDropDownListOnTop?: boolean;
54
+
55
+ /**
56
+ * Style configuration for different parts of the dropdown.
57
+ */
58
+ styleConfig?: {
59
+ /** Styles for the placeholder container. */
60
+ placeHolderContainer?: Styles[];
61
+ /** Styles for the placeholder text container. */
62
+ placeHolderTextContainer?: TextStyle[];
63
+ /** Styles for the dropdown list container. */
64
+ dropDownItemListContainer?: Styles[];
65
+ /** Styles for a single dropdown item container. */
66
+ dropDownItemContainer?: Styles[];
67
+ /** Styles for the dropdown item text. */
68
+ dropDownItemTextContainer?: TypographyStyleConfigProps;
69
+ };
70
+ }
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import { DropdownOptionProps } from './type';
3
- declare const DropdownOption: React.FC<DropdownOptionProps>;
4
- export default DropdownOption;
5
- //# sourceMappingURL=DropdownOption.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DropdownOption.d.ts","sourceRoot":"","sources":["../../packages/components/Dropdown/src/DropdownOption/DropdownOption.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAI3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAK7C,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAwIjD,CAAC;AACF,eAAe,cAAc,CAAC"}
@@ -1,8 +0,0 @@
1
- import { CSSProperties } from 'styled-components';
2
- import { DropdownVarient } from '../../type';
3
- export declare const StyledDropdownOption: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
4
- isSelected: boolean;
5
- varient: DropdownVarient;
6
- css?: CSSProperties | undefined;
7
- }, never>;
8
- //# sourceMappingURL=StyledDropdownOption.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StyledDropdownOption.d.ts","sourceRoot":"","sources":["../../../packages/components/Dropdown/src/DropdownOption/StyledDropdownOption/StyledDropdownOption.tsx"],"names":[],"mappings":"AAAA,OAAe,EAAe,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvE,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAG7C,eAAO,MAAM,oBAAoB;gBACpB,OAAO;aACV,eAAe;;SAsBxB,CAAC"}
@@ -1,2 +0,0 @@
1
- export { default } from './DropdownOption';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/components/Dropdown/src/DropdownOption/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1,20 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { DropdownVarient } from '../type';
3
- import { Color, DropdownOptionStyleProps } from '@cleartrip/ct-design-types';
4
- export interface DropdownOptionProps {
5
- key?: string;
6
- label: string;
7
- subLabel?: string;
8
- isSelected?: boolean;
9
- icon?: ReactNode;
10
- iconStyle?: string;
11
- height?: string;
12
- onClick?: () => void;
13
- varient?: DropdownVarient;
14
- customColor?: Color;
15
- isChipSelection?: boolean;
16
- multiSelect?: boolean;
17
- sideShow?: string;
18
- styleConfig?: DropdownOptionStyleProps;
19
- }
20
- //# sourceMappingURL=type.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../packages/components/Dropdown/src/DropdownOption/type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAC,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAC5E,MAAM,WAAW,mBAAmB;IACnC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAC,wBAAwB,CAAA;CACrC"}
@@ -1,7 +0,0 @@
1
- import { CSSProperties } from 'styled-components';
2
- import { StyledDropdownProps } from './type';
3
- declare const StyledDropdown: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, StyledDropdownProps & {
4
- css?: CSSProperties | undefined;
5
- }, never>;
6
- export default StyledDropdown;
7
- //# sourceMappingURL=StyledDropdown.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StyledDropdown.d.ts","sourceRoot":"","sources":["../../packages/components/Dropdown/src/StyledDropdown/StyledDropdown.tsx"],"names":[],"mappings":"AAAA,OAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAE7C,QAAA,MAAM,cAAc;;SAKnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -1,2 +0,0 @@
1
- export { default as StyledDropdown } from './StyledDropdown';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/components/Dropdown/src/StyledDropdown/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1,7 +0,0 @@
1
- import { CSSObject } from 'styled-components';
2
- import type { Theme } from '@cleartrip/ct-design-theme';
3
- import { StyledDropdownProps } from './type';
4
- export declare const getStyledDropdownStyles: ({ backgroundColor, width, theme, varient, height, }: StyledDropdownProps & {
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/Dropdown/src/StyledDropdown/style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAG7C,eAAO,MAAM,uBAAuB;WAMF,KAAK;MAAK,SAU3C,CAAC"}
@@ -1,9 +0,0 @@
1
- import { DropdownVarient } from '../type';
2
- export interface StyledDropdownProps {
3
- backgroundColor: string;
4
- width?: string;
5
- height?: string;
6
- varient?: DropdownVarient;
7
- maxHeight?: string;
8
- }
9
- //# sourceMappingURL=type.d.ts.map