@cleartrip/ct-design-dropdown 1.1.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 (38) hide show
  1. package/dist/ct-design-dropdown.browser.cjs.js +2 -0
  2. package/dist/ct-design-dropdown.browser.cjs.js.map +1 -0
  3. package/dist/ct-design-dropdown.browser.esm.js +2 -0
  4. package/dist/ct-design-dropdown.browser.esm.js.map +1 -0
  5. package/dist/ct-design-dropdown.cjs.js +121 -0
  6. package/dist/ct-design-dropdown.cjs.js.map +1 -0
  7. package/dist/ct-design-dropdown.esm.js +113 -0
  8. package/dist/ct-design-dropdown.esm.js.map +1 -0
  9. package/dist/ct-design-dropdown.umd.js +816 -0
  10. package/dist/ct-design-dropdown.umd.js.map +1 -0
  11. package/dist/src/Dropdown.d.ts +5 -0
  12. package/dist/src/Dropdown.d.ts.map +1 -0
  13. package/dist/src/DropdownOption/DropdownOption.d.ts +5 -0
  14. package/dist/src/DropdownOption/DropdownOption.d.ts.map +1 -0
  15. package/dist/src/DropdownOption/StyledDropdownOption/StyledDropdownOption.d.ts +6 -0
  16. package/dist/src/DropdownOption/StyledDropdownOption/StyledDropdownOption.d.ts.map +1 -0
  17. package/dist/src/DropdownOption/index.d.ts +2 -0
  18. package/dist/src/DropdownOption/index.d.ts.map +1 -0
  19. package/dist/src/DropdownOption/type.d.ts +19 -0
  20. package/dist/src/DropdownOption/type.d.ts.map +1 -0
  21. package/dist/src/StyledDropdown/StyledDropdown.d.ts +4 -0
  22. package/dist/src/StyledDropdown/StyledDropdown.d.ts.map +1 -0
  23. package/dist/src/StyledDropdown/index.d.ts +2 -0
  24. package/dist/src/StyledDropdown/index.d.ts.map +1 -0
  25. package/dist/src/StyledDropdown/style.d.ts +7 -0
  26. package/dist/src/StyledDropdown/style.d.ts.map +1 -0
  27. package/dist/src/StyledDropdown/type.d.ts +9 -0
  28. package/dist/src/StyledDropdown/type.d.ts.map +1 -0
  29. package/dist/src/index.d.ts +3 -0
  30. package/dist/src/index.d.ts.map +1 -0
  31. package/dist/src/style.d.ts +13 -0
  32. package/dist/src/style.d.ts.map +1 -0
  33. package/dist/src/type.d.ts +33 -0
  34. package/dist/src/type.d.ts.map +1 -0
  35. package/dist/stats.html +4838 -0
  36. package/dist/stories/Dropdown.stories.d.ts +7 -0
  37. package/dist/stories/Dropdown.stories.d.ts.map +1 -0
  38. package/package.json +44 -0
@@ -0,0 +1,816 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react/jsx-runtime'), require('@cleartrip/ct-design-container'), require('@cleartrip/ct-design-checkbox'), require('styled-components'), require('@cleartrip/ct-design-use-theme'), require('react'), require('@cleartrip/ct-design-typography'), require('@cleartrip/ct-design-tokens'), require('@cleartrip/ct-design-divider')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'react/jsx-runtime', '@cleartrip/ct-design-container', '@cleartrip/ct-design-checkbox', 'styled-components', '@cleartrip/ct-design-use-theme', 'react', '@cleartrip/ct-design-typography', '@cleartrip/ct-design-tokens', '@cleartrip/ct-design-divider'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.CTDesignSystemDropdown = {}, global.jsxRuntime, global.ctDesignContainer, global.ctDesignCheckbox, global.styled, global.useTheme, global.React, global.ctDesignTypography, global.ctDesignTokens, global.ctDesignDivider));
5
+ })(this, (function (exports, jsxRuntime, ctDesignContainer, ctDesignCheckbox, styled, useTheme, react, ctDesignTypography, ctDesignTokens, ctDesignDivider) { 'use strict';
6
+
7
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
+
9
+ var styled__default = /*#__PURE__*/_interopDefault(styled);
10
+ var useTheme__default = /*#__PURE__*/_interopDefault(useTheme);
11
+
12
+ /******************************************************************************
13
+ Copyright (c) Microsoft Corporation.
14
+
15
+ Permission to use, copy, modify, and/or distribute this software for any
16
+ purpose with or without fee is hereby granted.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
19
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
20
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
21
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
22
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
23
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
24
+ PERFORMANCE OF THIS SOFTWARE.
25
+ ***************************************************************************** */
26
+ /* global Reflect, Promise, SuppressedError, Symbol */
27
+
28
+ var __assign$1 = function () {
29
+ __assign$1 = Object.assign || function __assign(t) {
30
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
31
+ s = arguments[i];
32
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
33
+ }
34
+ return t;
35
+ };
36
+ return __assign$1.apply(this, arguments);
37
+ };
38
+ function __makeTemplateObject(cooked, raw) {
39
+ if (Object.defineProperty) {
40
+ Object.defineProperty(cooked, "raw", {
41
+ value: raw
42
+ });
43
+ } else {
44
+ cooked.raw = raw;
45
+ }
46
+ return cooked;
47
+ }
48
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
49
+ var e = new Error(message);
50
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
51
+ };
52
+
53
+ exports.DropdownVarient = void 0;
54
+ (function (DropdownVarient) {
55
+ DropdownVarient["FLAT"] = "FLAT";
56
+ DropdownVarient["ROUND"] = "ROUND";
57
+ DropdownVarient["BYLINE"] = "BYLINE";
58
+ DropdownVarient["BYLINE_SIDE"] = "BYLINE_SIDE";
59
+ })(exports.DropdownVarient || (exports.DropdownVarient = {}));
60
+
61
+ var getStyledDropdownStyles = function (_a) {
62
+ var backgroundColor = _a.backgroundColor, width = _a.width, theme = _a.theme, varient = _a.varient, height = _a.height;
63
+ return {
64
+ backgroundColor: backgroundColor,
65
+ width: width,
66
+ padding: varient === exports.DropdownVarient.ROUND ? theme.spacing[2] : 0,
67
+ boxShadow: theme.elevation.bottomE2,
68
+ maxHeight: height,
69
+ overflow: 'auto',
70
+ borderRadius: theme.border.radius[12],
71
+ };
72
+ };
73
+
74
+ var StyledDropdown = styled__default.default.div(function (_a) {
75
+ var theme = _a.theme, backgroundColor = _a.backgroundColor, width = _a.width, varient = _a.varient, height = _a.height;
76
+ return getStyledDropdownStyles({ theme: theme, backgroundColor: backgroundColor, width: width, varient: varient, height: height });
77
+ });
78
+
79
+ var getDefaultDropdownStyles = function (theme, width) {
80
+ return {
81
+ backgroundColor: theme.color.background.neutral,
82
+ width: width,
83
+ };
84
+ };
85
+ var getDropdownStyles = function (_a) {
86
+ var theme = _a.theme, width = _a.width;
87
+ return __assign$1({}, getDefaultDropdownStyles(theme, width));
88
+ };
89
+
90
+ var StyledDropdownOption = styled__default.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &:hover {\n background-color: ", ";\n border-radius: ", ";\n }\n background-color: ", ";\n color: ", ";\n padding-top: 4px;\n padding-bottom: 4px;\n"], ["\n &:hover {\n background-color: ", ";\n border-radius: ", ";\n }\n background-color: ", ";\n color: ", ";\n padding-top: 4px;\n padding-bottom: 4px;\n"])), function (_a) {
91
+ var isSelected = _a.isSelected, varient = _a.varient, theme = _a.theme;
92
+ return isSelected && [exports.DropdownVarient.FLAT, exports.DropdownVarient.BYLINE].includes(varient)
93
+ ? theme.color.background.primary
94
+ : theme.color.chip.selectedPrimaryBg;
95
+ }, function (_a) {
96
+ var varient = _a.varient;
97
+ return (varient === exports.DropdownVarient.ROUND ? '4px' : '');
98
+ }, function (_a) {
99
+ var isSelected = _a.isSelected, varient = _a.varient, theme = _a.theme;
100
+ return isSelected && [exports.DropdownVarient.FLAT, exports.DropdownVarient.BYLINE].includes(varient)
101
+ ? theme.color.background.primary
102
+ : '';
103
+ }, function (props) { return (props.isSelected ? ctDesignTokens.colors.neutral100 : ''); });
104
+ var templateObject_1;
105
+
106
+ var DropdownOption = function (_a) {
107
+ var _b = _a.key, key = _b === void 0 ? '' : _b, _c = _a.label, label = _c === void 0 ? '' : _c, _d = _a.subLabel, subLabel = _d === void 0 ? '' : _d, _e = _a.isSelected, isSelected = _e === void 0 ? false : _e, _f = _a.height, height = _f === void 0 ? '' : _f, _g = _a.icon, icon = _g === void 0 ? null : _g, _h = _a.iconStyle, iconStyle = _h === void 0 ? '' : _h, onClick = _a.onClick, _j = _a.varient, varient = _j === void 0 ? exports.DropdownVarient.FLAT : _j, _k = _a.customColor, customColor = _k === void 0 ? 'primary' : _k, _l = _a.isChipSelection, isChipSelection = _l === void 0 ? false : _l, _m = _a.multiSelect, multiSelect = _m === void 0 ? false : _m, _o = _a.sideShow, sideShow = _o === void 0 ? '' : _o;
108
+ var theme = useTheme__default.default();
109
+ var noIconPresent = !icon && !multiSelect;
110
+ var scrollIntoOption = react.useCallback(function (htmlNode) {
111
+ if (htmlNode && isSelected && varient !== exports.DropdownVarient.BYLINE_SIDE) {
112
+ htmlNode.scrollIntoView({ block: 'center' });
113
+ }
114
+ }, [isSelected]);
115
+ return (jsxRuntime.jsx(StyledDropdownOption, __assign$1({ isSelected: isSelected, varient: varient }, { children: jsxRuntime.jsxs(ctDesignContainer.Container, __assign$1({ cursor: 'pointer', display: 'flex', alignItems: 'center', height: height, marginLeft: theme.spacing[4], onClick: onClick, ref: scrollIntoOption }, { children: [isChipSelection && (jsxRuntime.jsxs(ctDesignContainer.Container, __assign$1({ display: 'flex', alignItems: 'center', width: '24px', className: iconStyle }, { children: [isSelected && icon && jsxRuntime.jsx(jsxRuntime.Fragment, { children: icon }), multiSelect && !isSelected && jsxRuntime.jsx(ctDesignCheckbox.Checkbox, { id: 'not-checked', checked: false })] }))), jsxRuntime.jsx(ctDesignContainer.Container, __assign$1({ paddingTop: !noIconPresent ? theme.spacing[2] : '', paddingBottom: !noIconPresent ? theme.spacing[2] : '', paddingRight: !noIconPresent ? theme.spacing[2] : '', paddingLeft: !noIconPresent ? theme.spacing[4] : '', width: '100%' }, { children: varient !== exports.DropdownVarient.BYLINE_SIDE ? (jsxRuntime.jsxs(ctDesignContainer.Container, { children: [jsxRuntime.jsx(ctDesignTypography.Typography, __assign$1({ variant: exports.DropdownVarient.BYLINE ? 'HM4' : 'B2', color: isSelected && [exports.DropdownVarient.FLAT, exports.DropdownVarient.BYLINE].includes(varient)
116
+ ? 'neutral'
117
+ : customColor }, { children: label })), varient === exports.DropdownVarient.BYLINE && subLabel && (jsxRuntime.jsx(ctDesignTypography.Typography, __assign$1({ variant: 'B3', color: isSelected ? 'disabled' : 'tertiary' }, { children: subLabel })))] })) : (jsxRuntime.jsxs(ctDesignContainer.Container, __assign$1({ display: 'flex', justifyContent: 'space-between' }, { children: [jsxRuntime.jsxs(ctDesignContainer.Container, { children: [jsxRuntime.jsx(ctDesignTypography.Typography, __assign$1({ variant: 'HM4', color: customColor }, { children: label })), subLabel && (jsxRuntime.jsx(ctDesignTypography.Typography, __assign$1({ variant: 'B3', color: 'tertiary' }, { children: subLabel })))] }), jsxRuntime.jsx(ctDesignContainer.Container, __assign$1({ display: 'flex', justifyContent: 'center', alignItems: 'center' }, { children: jsxRuntime.jsx(ctDesignTypography.Typography, __assign$1({ variant: 'B3', color: 'primary' }, { children: sideShow })) }))] }))) }))] }), key) })));
118
+ };
119
+
120
+ var propTypesExports = {};
121
+ var propTypes = {
122
+ get exports(){ return propTypesExports; },
123
+ set exports(v){ propTypesExports = v; },
124
+ };
125
+
126
+ /**
127
+ * Copyright (c) 2013-present, Facebook, Inc.
128
+ *
129
+ * This source code is licensed under the MIT license found in the
130
+ * LICENSE file in the root directory of this source tree.
131
+ */
132
+ var ReactPropTypesSecret_1;
133
+ var hasRequiredReactPropTypesSecret;
134
+ function requireReactPropTypesSecret() {
135
+ if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
136
+ hasRequiredReactPropTypesSecret = 1;
137
+ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
138
+ ReactPropTypesSecret_1 = ReactPropTypesSecret;
139
+ return ReactPropTypesSecret_1;
140
+ }
141
+
142
+ /**
143
+ * Copyright (c) 2013-present, Facebook, Inc.
144
+ *
145
+ * This source code is licensed under the MIT license found in the
146
+ * LICENSE file in the root directory of this source tree.
147
+ */
148
+ var factoryWithThrowingShims;
149
+ var hasRequiredFactoryWithThrowingShims;
150
+ function requireFactoryWithThrowingShims() {
151
+ if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
152
+ hasRequiredFactoryWithThrowingShims = 1;
153
+ var ReactPropTypesSecret = requireReactPropTypesSecret();
154
+ function emptyFunction() {}
155
+ function emptyFunctionWithReset() {}
156
+ emptyFunctionWithReset.resetWarningCache = emptyFunction;
157
+ factoryWithThrowingShims = function () {
158
+ function shim(props, propName, componentName, location, propFullName, secret) {
159
+ if (secret === ReactPropTypesSecret) {
160
+ // It is still safe when called from React.
161
+ return;
162
+ }
163
+ var err = new Error('Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use PropTypes.checkPropTypes() to call them. ' + 'Read more at http://fb.me/use-check-prop-types');
164
+ err.name = 'Invariant Violation';
165
+ throw err;
166
+ }
167
+ shim.isRequired = shim;
168
+ function getShim() {
169
+ return shim;
170
+ }
171
+ // Important!
172
+ // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
173
+ var ReactPropTypes = {
174
+ array: shim,
175
+ bigint: shim,
176
+ bool: shim,
177
+ func: shim,
178
+ number: shim,
179
+ object: shim,
180
+ string: shim,
181
+ symbol: shim,
182
+ any: shim,
183
+ arrayOf: getShim,
184
+ element: shim,
185
+ elementType: shim,
186
+ instanceOf: getShim,
187
+ node: shim,
188
+ objectOf: getShim,
189
+ oneOf: getShim,
190
+ oneOfType: getShim,
191
+ shape: getShim,
192
+ exact: getShim,
193
+ checkPropTypes: emptyFunctionWithReset,
194
+ resetWarningCache: emptyFunction
195
+ };
196
+ ReactPropTypes.PropTypes = ReactPropTypes;
197
+ return ReactPropTypes;
198
+ };
199
+ return factoryWithThrowingShims;
200
+ }
201
+
202
+ /**
203
+ * Copyright (c) 2013-present, Facebook, Inc.
204
+ *
205
+ * This source code is licensed under the MIT license found in the
206
+ * LICENSE file in the root directory of this source tree.
207
+ */
208
+ {
209
+ // By explicitly using `prop-types` you are opting into new production behavior.
210
+ // http://fb.me/prop-types-in-prod
211
+ propTypes.exports = requireFactoryWithThrowingShims()();
212
+ }
213
+
214
+ /*! *****************************************************************************
215
+ Copyright (c) Microsoft Corporation. All rights reserved.
216
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
217
+ this file except in compliance with the License. You may obtain a copy of the
218
+ License at http://www.apache.org/licenses/LICENSE-2.0
219
+
220
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
221
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
222
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
223
+ MERCHANTABLITY OR NON-INFRINGEMENT.
224
+
225
+ See the Apache Version 2.0 License for specific language governing permissions
226
+ and limitations under the License.
227
+ ***************************************************************************** */
228
+ /* global Reflect, Promise */
229
+
230
+ var extendStatics = function (d, b) {
231
+ extendStatics = Object.setPrototypeOf || {
232
+ __proto__: []
233
+ } instanceof Array && function (d, b) {
234
+ d.__proto__ = b;
235
+ } || function (d, b) {
236
+ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
237
+ };
238
+ return extendStatics(d, b);
239
+ };
240
+ function __extends(d, b) {
241
+ extendStatics(d, b);
242
+ function __() {
243
+ this.constructor = d;
244
+ }
245
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
246
+ }
247
+ var __assign = function () {
248
+ __assign = Object.assign || function __assign(t) {
249
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
250
+ s = arguments[i];
251
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
252
+ }
253
+ return t;
254
+ };
255
+ return __assign.apply(this, arguments);
256
+ };
257
+ function __rest(s, e) {
258
+ var t = {};
259
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
260
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]];
261
+ return t;
262
+ }
263
+ var ALIGNMENT;
264
+ (function (ALIGNMENT) {
265
+ ALIGNMENT["AUTO"] = "auto";
266
+ ALIGNMENT["START"] = "start";
267
+ ALIGNMENT["CENTER"] = "center";
268
+ ALIGNMENT["END"] = "end";
269
+ })(ALIGNMENT || (ALIGNMENT = {}));
270
+ var DIRECTION;
271
+ (function (DIRECTION) {
272
+ DIRECTION["HORIZONTAL"] = "horizontal";
273
+ DIRECTION["VERTICAL"] = "vertical";
274
+ })(DIRECTION || (DIRECTION = {}));
275
+ var SCROLL_CHANGE_REASON;
276
+ (function (SCROLL_CHANGE_REASON) {
277
+ SCROLL_CHANGE_REASON["OBSERVED"] = "observed";
278
+ SCROLL_CHANGE_REASON["REQUESTED"] = "requested";
279
+ })(SCROLL_CHANGE_REASON || (SCROLL_CHANGE_REASON = {}));
280
+ var scrollProp = (_a = {}, _a[DIRECTION.VERTICAL] = 'scrollTop', _a[DIRECTION.HORIZONTAL] = 'scrollLeft', _a);
281
+ var sizeProp = (_b = {}, _b[DIRECTION.VERTICAL] = 'height', _b[DIRECTION.HORIZONTAL] = 'width', _b);
282
+ var positionProp = (_c = {}, _c[DIRECTION.VERTICAL] = 'top', _c[DIRECTION.HORIZONTAL] = 'left', _c);
283
+ var marginProp = (_d = {}, _d[DIRECTION.VERTICAL] = 'marginTop', _d[DIRECTION.HORIZONTAL] = 'marginLeft', _d);
284
+ var oppositeMarginProp = (_e = {}, _e[DIRECTION.VERTICAL] = 'marginBottom', _e[DIRECTION.HORIZONTAL] = 'marginRight', _e);
285
+ var _a;
286
+ var _b;
287
+ var _c;
288
+ var _d;
289
+ var _e;
290
+
291
+ /* Forked from react-virtualized 💖 */
292
+ var SizeAndPositionManager = /** @class */function () {
293
+ function SizeAndPositionManager(_a) {
294
+ var itemCount = _a.itemCount,
295
+ itemSizeGetter = _a.itemSizeGetter,
296
+ estimatedItemSize = _a.estimatedItemSize;
297
+ this.itemSizeGetter = itemSizeGetter;
298
+ this.itemCount = itemCount;
299
+ this.estimatedItemSize = estimatedItemSize;
300
+ // Cache of size and position data for items, mapped by item index.
301
+ this.itemSizeAndPositionData = {};
302
+ // Measurements for items up to this index can be trusted; items afterward should be estimated.
303
+ this.lastMeasuredIndex = -1;
304
+ }
305
+ SizeAndPositionManager.prototype.updateConfig = function (_a) {
306
+ var itemCount = _a.itemCount,
307
+ itemSizeGetter = _a.itemSizeGetter,
308
+ estimatedItemSize = _a.estimatedItemSize;
309
+ if (itemCount != null) {
310
+ this.itemCount = itemCount;
311
+ }
312
+ if (estimatedItemSize != null) {
313
+ this.estimatedItemSize = estimatedItemSize;
314
+ }
315
+ if (itemSizeGetter != null) {
316
+ this.itemSizeGetter = itemSizeGetter;
317
+ }
318
+ };
319
+ SizeAndPositionManager.prototype.getLastMeasuredIndex = function () {
320
+ return this.lastMeasuredIndex;
321
+ };
322
+ /**
323
+ * This method returns the size and position for the item at the specified index.
324
+ * It just-in-time calculates (or used cached values) for items leading up to the index.
325
+ */
326
+ SizeAndPositionManager.prototype.getSizeAndPositionForIndex = function (index) {
327
+ if (index < 0 || index >= this.itemCount) {
328
+ throw Error("Requested index " + index + " is outside of range 0.." + this.itemCount);
329
+ }
330
+ if (index > this.lastMeasuredIndex) {
331
+ var lastMeasuredSizeAndPosition = this.getSizeAndPositionOfLastMeasuredItem();
332
+ var offset = lastMeasuredSizeAndPosition.offset + lastMeasuredSizeAndPosition.size;
333
+ for (var i = this.lastMeasuredIndex + 1; i <= index; i++) {
334
+ var size = this.itemSizeGetter(i);
335
+ if (size == null || isNaN(size)) {
336
+ throw Error("Invalid size returned for index " + i + " of value " + size);
337
+ }
338
+ this.itemSizeAndPositionData[i] = {
339
+ offset: offset,
340
+ size: size
341
+ };
342
+ offset += size;
343
+ }
344
+ this.lastMeasuredIndex = index;
345
+ }
346
+ return this.itemSizeAndPositionData[index];
347
+ };
348
+ SizeAndPositionManager.prototype.getSizeAndPositionOfLastMeasuredItem = function () {
349
+ return this.lastMeasuredIndex >= 0 ? this.itemSizeAndPositionData[this.lastMeasuredIndex] : {
350
+ offset: 0,
351
+ size: 0
352
+ };
353
+ };
354
+ /**
355
+ * Total size of all items being measured.
356
+ * This value will be completedly estimated initially.
357
+ * As items as measured the estimate will be updated.
358
+ */
359
+ SizeAndPositionManager.prototype.getTotalSize = function () {
360
+ var lastMeasuredSizeAndPosition = this.getSizeAndPositionOfLastMeasuredItem();
361
+ return lastMeasuredSizeAndPosition.offset + lastMeasuredSizeAndPosition.size + (this.itemCount - this.lastMeasuredIndex - 1) * this.estimatedItemSize;
362
+ };
363
+ /**
364
+ * Determines a new offset that ensures a certain item is visible, given the alignment.
365
+ *
366
+ * @param align Desired alignment within container; one of "start" (default), "center", or "end"
367
+ * @param containerSize Size (width or height) of the container viewport
368
+ * @return Offset to use to ensure the specified item is visible
369
+ */
370
+ SizeAndPositionManager.prototype.getUpdatedOffsetForIndex = function (_a) {
371
+ var _b = _a.align,
372
+ align = _b === void 0 ? ALIGNMENT.START : _b,
373
+ containerSize = _a.containerSize,
374
+ currentOffset = _a.currentOffset,
375
+ targetIndex = _a.targetIndex;
376
+ if (containerSize <= 0) {
377
+ return 0;
378
+ }
379
+ var datum = this.getSizeAndPositionForIndex(targetIndex);
380
+ var maxOffset = datum.offset;
381
+ var minOffset = maxOffset - containerSize + datum.size;
382
+ var idealOffset;
383
+ switch (align) {
384
+ case ALIGNMENT.END:
385
+ idealOffset = minOffset;
386
+ break;
387
+ case ALIGNMENT.CENTER:
388
+ idealOffset = maxOffset - (containerSize - datum.size) / 2;
389
+ break;
390
+ case ALIGNMENT.START:
391
+ idealOffset = maxOffset;
392
+ break;
393
+ default:
394
+ idealOffset = Math.max(minOffset, Math.min(maxOffset, currentOffset));
395
+ }
396
+ var totalSize = this.getTotalSize();
397
+ return Math.max(0, Math.min(totalSize - containerSize, idealOffset));
398
+ };
399
+ SizeAndPositionManager.prototype.getVisibleRange = function (_a) {
400
+ var containerSize = _a.containerSize,
401
+ offset = _a.offset,
402
+ overscanCount = _a.overscanCount;
403
+ var totalSize = this.getTotalSize();
404
+ if (totalSize === 0) {
405
+ return {};
406
+ }
407
+ var maxOffset = offset + containerSize;
408
+ var start = this.findNearestItem(offset);
409
+ if (typeof start === 'undefined') {
410
+ throw Error("Invalid offset " + offset + " specified");
411
+ }
412
+ var datum = this.getSizeAndPositionForIndex(start);
413
+ offset = datum.offset + datum.size;
414
+ var stop = start;
415
+ while (offset < maxOffset && stop < this.itemCount - 1) {
416
+ stop++;
417
+ offset += this.getSizeAndPositionForIndex(stop).size;
418
+ }
419
+ if (overscanCount) {
420
+ start = Math.max(0, start - overscanCount);
421
+ stop = Math.min(stop + overscanCount, this.itemCount - 1);
422
+ }
423
+ return {
424
+ start: start,
425
+ stop: stop
426
+ };
427
+ };
428
+ /**
429
+ * Clear all cached values for items after the specified index.
430
+ * This method should be called for any item that has changed its size.
431
+ * It will not immediately perform any calculations; they'll be performed the next time getSizeAndPositionForIndex() is called.
432
+ */
433
+ SizeAndPositionManager.prototype.resetItem = function (index) {
434
+ this.lastMeasuredIndex = Math.min(this.lastMeasuredIndex, index - 1);
435
+ };
436
+ /**
437
+ * Searches for the item (index) nearest the specified offset.
438
+ *
439
+ * If no exact match is found the next lowest item index will be returned.
440
+ * This allows partially visible items (with offsets just before/above the fold) to be visible.
441
+ */
442
+ SizeAndPositionManager.prototype.findNearestItem = function (offset) {
443
+ if (isNaN(offset)) {
444
+ throw Error("Invalid offset " + offset + " specified");
445
+ }
446
+ // Our search algorithms find the nearest match at or below the specified offset.
447
+ // So make sure the offset is at least 0 or no match will be found.
448
+ offset = Math.max(0, offset);
449
+ var lastMeasuredSizeAndPosition = this.getSizeAndPositionOfLastMeasuredItem();
450
+ var lastMeasuredIndex = Math.max(0, this.lastMeasuredIndex);
451
+ if (lastMeasuredSizeAndPosition.offset >= offset) {
452
+ // If we've already measured items within this range just use a binary search as it's faster.
453
+ return this.binarySearch({
454
+ high: lastMeasuredIndex,
455
+ low: 0,
456
+ offset: offset
457
+ });
458
+ } else {
459
+ // If we haven't yet measured this high, fallback to an exponential search with an inner binary search.
460
+ // The exponential search avoids pre-computing sizes for the full set of items as a binary search would.
461
+ // The overall complexity for this approach is O(log n).
462
+ return this.exponentialSearch({
463
+ index: lastMeasuredIndex,
464
+ offset: offset
465
+ });
466
+ }
467
+ };
468
+ SizeAndPositionManager.prototype.binarySearch = function (_a) {
469
+ var low = _a.low,
470
+ high = _a.high,
471
+ offset = _a.offset;
472
+ var middle = 0;
473
+ var currentOffset = 0;
474
+ while (low <= high) {
475
+ middle = low + Math.floor((high - low) / 2);
476
+ currentOffset = this.getSizeAndPositionForIndex(middle).offset;
477
+ if (currentOffset === offset) {
478
+ return middle;
479
+ } else if (currentOffset < offset) {
480
+ low = middle + 1;
481
+ } else if (currentOffset > offset) {
482
+ high = middle - 1;
483
+ }
484
+ }
485
+ if (low > 0) {
486
+ return low - 1;
487
+ }
488
+ return 0;
489
+ };
490
+ SizeAndPositionManager.prototype.exponentialSearch = function (_a) {
491
+ var index = _a.index,
492
+ offset = _a.offset;
493
+ var interval = 1;
494
+ while (index < this.itemCount && this.getSizeAndPositionForIndex(index).offset < offset) {
495
+ index += interval;
496
+ interval *= 2;
497
+ }
498
+ return this.binarySearch({
499
+ high: Math.min(index, this.itemCount - 1),
500
+ low: Math.floor(index / 2),
501
+ offset: offset
502
+ });
503
+ };
504
+ return SizeAndPositionManager;
505
+ }();
506
+ var STYLE_WRAPPER = {
507
+ overflow: 'auto',
508
+ willChange: 'transform',
509
+ WebkitOverflowScrolling: 'touch'
510
+ };
511
+ var STYLE_INNER = {
512
+ position: 'relative',
513
+ width: '100%',
514
+ minHeight: '100%'
515
+ };
516
+ var STYLE_ITEM = {
517
+ position: 'absolute',
518
+ top: 0,
519
+ left: 0,
520
+ width: '100%'
521
+ };
522
+ var STYLE_STICKY_ITEM = __assign({}, STYLE_ITEM, {
523
+ position: 'sticky'
524
+ });
525
+ var VirtualList = /** @class */function (_super) {
526
+ __extends(VirtualList, _super);
527
+ function VirtualList() {
528
+ var _this = _super !== null && _super.apply(this, arguments) || this;
529
+ _this.itemSizeGetter = function (itemSize) {
530
+ return function (index) {
531
+ return _this.getSize(index, itemSize);
532
+ };
533
+ };
534
+ _this.sizeAndPositionManager = new SizeAndPositionManager({
535
+ itemCount: _this.props.itemCount,
536
+ itemSizeGetter: _this.itemSizeGetter(_this.props.itemSize),
537
+ estimatedItemSize: _this.getEstimatedItemSize()
538
+ });
539
+ _this.state = {
540
+ offset: _this.props.scrollOffset || _this.props.scrollToIndex != null && _this.getOffsetForIndex(_this.props.scrollToIndex) || 0,
541
+ scrollChangeReason: SCROLL_CHANGE_REASON.REQUESTED
542
+ };
543
+ _this.styleCache = {};
544
+ _this.getRef = function (node) {
545
+ _this.rootNode = node;
546
+ };
547
+ _this.handleScroll = function (event) {
548
+ var onScroll = _this.props.onScroll;
549
+ var offset = _this.getNodeOffset();
550
+ if (offset < 0 || _this.state.offset === offset || event.target !== _this.rootNode) {
551
+ return;
552
+ }
553
+ _this.setState({
554
+ offset: offset,
555
+ scrollChangeReason: SCROLL_CHANGE_REASON.OBSERVED
556
+ });
557
+ if (typeof onScroll === 'function') {
558
+ onScroll(offset, event);
559
+ }
560
+ };
561
+ return _this;
562
+ }
563
+ VirtualList.prototype.componentDidMount = function () {
564
+ var _a = this.props,
565
+ scrollOffset = _a.scrollOffset,
566
+ scrollToIndex = _a.scrollToIndex;
567
+ this.rootNode.addEventListener('scroll', this.handleScroll, {
568
+ passive: true
569
+ });
570
+ if (scrollOffset != null) {
571
+ this.scrollTo(scrollOffset);
572
+ } else if (scrollToIndex != null) {
573
+ this.scrollTo(this.getOffsetForIndex(scrollToIndex));
574
+ }
575
+ };
576
+ VirtualList.prototype.componentWillReceiveProps = function (nextProps) {
577
+ var _a = this.props,
578
+ estimatedItemSize = _a.estimatedItemSize,
579
+ itemCount = _a.itemCount,
580
+ itemSize = _a.itemSize,
581
+ scrollOffset = _a.scrollOffset,
582
+ scrollToAlignment = _a.scrollToAlignment,
583
+ scrollToIndex = _a.scrollToIndex;
584
+ var scrollPropsHaveChanged = nextProps.scrollToIndex !== scrollToIndex || nextProps.scrollToAlignment !== scrollToAlignment;
585
+ var itemPropsHaveChanged = nextProps.itemCount !== itemCount || nextProps.itemSize !== itemSize || nextProps.estimatedItemSize !== estimatedItemSize;
586
+ if (nextProps.itemSize !== itemSize) {
587
+ this.sizeAndPositionManager.updateConfig({
588
+ itemSizeGetter: this.itemSizeGetter(nextProps.itemSize)
589
+ });
590
+ }
591
+ if (nextProps.itemCount !== itemCount || nextProps.estimatedItemSize !== estimatedItemSize) {
592
+ this.sizeAndPositionManager.updateConfig({
593
+ itemCount: nextProps.itemCount,
594
+ estimatedItemSize: this.getEstimatedItemSize(nextProps)
595
+ });
596
+ }
597
+ if (itemPropsHaveChanged) {
598
+ this.recomputeSizes();
599
+ }
600
+ if (nextProps.scrollOffset !== scrollOffset) {
601
+ this.setState({
602
+ offset: nextProps.scrollOffset || 0,
603
+ scrollChangeReason: SCROLL_CHANGE_REASON.REQUESTED
604
+ });
605
+ } else if (typeof nextProps.scrollToIndex === 'number' && (scrollPropsHaveChanged || itemPropsHaveChanged)) {
606
+ this.setState({
607
+ offset: this.getOffsetForIndex(nextProps.scrollToIndex, nextProps.scrollToAlignment, nextProps.itemCount),
608
+ scrollChangeReason: SCROLL_CHANGE_REASON.REQUESTED
609
+ });
610
+ }
611
+ };
612
+ VirtualList.prototype.componentDidUpdate = function (_, prevState) {
613
+ var _a = this.state,
614
+ offset = _a.offset,
615
+ scrollChangeReason = _a.scrollChangeReason;
616
+ if (prevState.offset !== offset && scrollChangeReason === SCROLL_CHANGE_REASON.REQUESTED) {
617
+ this.scrollTo(offset);
618
+ }
619
+ };
620
+ VirtualList.prototype.componentWillUnmount = function () {
621
+ this.rootNode.removeEventListener('scroll', this.handleScroll);
622
+ };
623
+ VirtualList.prototype.scrollTo = function (value) {
624
+ var _a = this.props.scrollDirection,
625
+ scrollDirection = _a === void 0 ? DIRECTION.VERTICAL : _a;
626
+ this.rootNode[scrollProp[scrollDirection]] = value;
627
+ };
628
+ VirtualList.prototype.getOffsetForIndex = function (index, scrollToAlignment, itemCount) {
629
+ if (scrollToAlignment === void 0) {
630
+ scrollToAlignment = this.props.scrollToAlignment;
631
+ }
632
+ if (itemCount === void 0) {
633
+ itemCount = this.props.itemCount;
634
+ }
635
+ var _a = this.props.scrollDirection,
636
+ scrollDirection = _a === void 0 ? DIRECTION.VERTICAL : _a;
637
+ if (index < 0 || index >= itemCount) {
638
+ index = 0;
639
+ }
640
+ return this.sizeAndPositionManager.getUpdatedOffsetForIndex({
641
+ align: scrollToAlignment,
642
+ containerSize: this.props[sizeProp[scrollDirection]],
643
+ currentOffset: this.state && this.state.offset || 0,
644
+ targetIndex: index
645
+ });
646
+ };
647
+ VirtualList.prototype.recomputeSizes = function (startIndex) {
648
+ if (startIndex === void 0) {
649
+ startIndex = 0;
650
+ }
651
+ this.styleCache = {};
652
+ this.sizeAndPositionManager.resetItem(startIndex);
653
+ };
654
+ VirtualList.prototype.render = function () {
655
+ var _this = this;
656
+ var _a = this.props;
657
+ _a.estimatedItemSize;
658
+ var height = _a.height,
659
+ _b = _a.overscanCount,
660
+ overscanCount = _b === void 0 ? 3 : _b,
661
+ renderItem = _a.renderItem;
662
+ _a.itemCount;
663
+ _a.itemSize;
664
+ var onItemsRendered = _a.onItemsRendered;
665
+ _a.onScroll;
666
+ var _c = _a.scrollDirection,
667
+ scrollDirection = _c === void 0 ? DIRECTION.VERTICAL : _c;
668
+ _a.scrollOffset;
669
+ _a.scrollToIndex;
670
+ _a.scrollToAlignment;
671
+ var stickyIndices = _a.stickyIndices,
672
+ style = _a.style,
673
+ width = _a.width,
674
+ props = __rest(_a, ["estimatedItemSize", "height", "overscanCount", "renderItem", "itemCount", "itemSize", "onItemsRendered", "onScroll", "scrollDirection", "scrollOffset", "scrollToIndex", "scrollToAlignment", "stickyIndices", "style", "width"]);
675
+ var offset = this.state.offset;
676
+ var _d = this.sizeAndPositionManager.getVisibleRange({
677
+ containerSize: this.props[sizeProp[scrollDirection]] || 0,
678
+ offset: offset,
679
+ overscanCount: overscanCount
680
+ }),
681
+ start = _d.start,
682
+ stop = _d.stop;
683
+ var items = [];
684
+ var wrapperStyle = __assign({}, STYLE_WRAPPER, style, {
685
+ height: height,
686
+ width: width
687
+ });
688
+ var innerStyle = __assign({}, STYLE_INNER, (_e = {}, _e[sizeProp[scrollDirection]] = this.sizeAndPositionManager.getTotalSize(), _e));
689
+ if (stickyIndices != null && stickyIndices.length !== 0) {
690
+ stickyIndices.forEach(function (index) {
691
+ return items.push(renderItem({
692
+ index: index,
693
+ style: _this.getStyle(index, true)
694
+ }));
695
+ });
696
+ if (scrollDirection === DIRECTION.HORIZONTAL) {
697
+ innerStyle.display = 'flex';
698
+ }
699
+ }
700
+ if (typeof start !== 'undefined' && typeof stop !== 'undefined') {
701
+ for (var index = start; index <= stop; index++) {
702
+ if (stickyIndices != null && stickyIndices.includes(index)) {
703
+ continue;
704
+ }
705
+ items.push(renderItem({
706
+ index: index,
707
+ style: this.getStyle(index, false)
708
+ }));
709
+ }
710
+ if (typeof onItemsRendered === 'function') {
711
+ onItemsRendered({
712
+ startIndex: start,
713
+ stopIndex: stop
714
+ });
715
+ }
716
+ }
717
+ return react.createElement("div", __assign({
718
+ ref: this.getRef
719
+ }, props, {
720
+ style: wrapperStyle
721
+ }), react.createElement("div", {
722
+ style: innerStyle
723
+ }, items));
724
+ var _e;
725
+ };
726
+ VirtualList.prototype.getNodeOffset = function () {
727
+ var _a = this.props.scrollDirection,
728
+ scrollDirection = _a === void 0 ? DIRECTION.VERTICAL : _a;
729
+ return this.rootNode[scrollProp[scrollDirection]];
730
+ };
731
+ VirtualList.prototype.getEstimatedItemSize = function (props) {
732
+ if (props === void 0) {
733
+ props = this.props;
734
+ }
735
+ return props.estimatedItemSize || typeof props.itemSize === 'number' && props.itemSize || 50;
736
+ };
737
+ VirtualList.prototype.getSize = function (index, itemSize) {
738
+ if (typeof itemSize === 'function') {
739
+ return itemSize(index);
740
+ }
741
+ return Array.isArray(itemSize) ? itemSize[index] : itemSize;
742
+ };
743
+ VirtualList.prototype.getStyle = function (index, sticky) {
744
+ var style = this.styleCache[index];
745
+ if (style) {
746
+ return style;
747
+ }
748
+ var _a = this.props.scrollDirection,
749
+ scrollDirection = _a === void 0 ? DIRECTION.VERTICAL : _a;
750
+ var _b = this.sizeAndPositionManager.getSizeAndPositionForIndex(index),
751
+ size = _b.size,
752
+ offset = _b.offset;
753
+ return this.styleCache[index] = sticky ? __assign({}, STYLE_STICKY_ITEM, (_c = {}, _c[sizeProp[scrollDirection]] = size, _c[marginProp[scrollDirection]] = offset, _c[oppositeMarginProp[scrollDirection]] = -(offset + size), _c.zIndex = 1, _c)) : __assign({}, STYLE_ITEM, (_d = {}, _d[sizeProp[scrollDirection]] = size, _d[positionProp[scrollDirection]] = offset, _d));
754
+ var _c, _d;
755
+ };
756
+ VirtualList.defaultProps = {
757
+ overscanCount: 3,
758
+ scrollDirection: DIRECTION.VERTICAL,
759
+ width: '100%'
760
+ };
761
+ VirtualList.propTypes = {
762
+ estimatedItemSize: propTypesExports.number,
763
+ height: propTypesExports.oneOfType([propTypesExports.number, propTypesExports.string]).isRequired,
764
+ itemCount: propTypesExports.number.isRequired,
765
+ itemSize: propTypesExports.oneOfType([propTypesExports.number, propTypesExports.array, propTypesExports.func]).isRequired,
766
+ onScroll: propTypesExports.func,
767
+ onItemsRendered: propTypesExports.func,
768
+ overscanCount: propTypesExports.number,
769
+ renderItem: propTypesExports.func.isRequired,
770
+ scrollOffset: propTypesExports.number,
771
+ scrollToIndex: propTypesExports.number,
772
+ scrollToAlignment: propTypesExports.oneOf([ALIGNMENT.AUTO, ALIGNMENT.START, ALIGNMENT.CENTER, ALIGNMENT.END]),
773
+ scrollDirection: propTypesExports.oneOf([DIRECTION.HORIZONTAL, DIRECTION.VERTICAL]),
774
+ stickyIndices: propTypesExports.arrayOf(propTypesExports.number),
775
+ style: propTypesExports.object,
776
+ width: propTypesExports.oneOfType([propTypesExports.number, propTypesExports.string])
777
+ };
778
+ return VirtualList;
779
+ }(react.PureComponent);
780
+
781
+ var Dropdown = function (_a) {
782
+ var _b = _a.optionList, optionList = _b === void 0 ? [] : _b, _c = _a.showDropdown, showDropdown = _c === void 0 ? true : _c, _d = _a.width, width = _d === void 0 ? '' : _d, _e = _a.height, height = _e === void 0 ? '500px' : _e, _f = _a.selectedOption, selectedOption = _f === void 0 ? '' : _f, _g = _a.icon, icon = _g === void 0 ? null : _g, _h = _a.iconStyle, iconStyle = _h === void 0 ? '' : _h, onClick = _a.onClick, _j = _a.varient, varient = _j === void 0 ? exports.DropdownVarient.FLAT : _j, _k = _a.isChipSelection, isChipSelection = _k === void 0 ? false : _k, _l = _a.multiSelect, multiSelect = _l === void 0 ? false : _l, _m = _a.selectAllCustomColor, selectAllCustomColor = _m === void 0 ? 'primary' : _m, _o = _a.selectAllClick, selectAllClick = _o === void 0 ? function () { } : _o, _p = _a.showSelectAll, showSelectAll = _p === void 0 ? false : _p, _q = _a.selectAllText, selectAllText = _q === void 0 ? 'Select All' : _q, _r = _a.virtualised, virtualised = _r === void 0 ? false : _r;
783
+ var theme = useTheme__default.default();
784
+ var dropdownStyles = getDropdownStyles({
785
+ theme: theme,
786
+ width: width,
787
+ });
788
+ var optionRenderer = function (_a) {
789
+ var index = _a.index; _a.style;
790
+ var option = optionList[index];
791
+ if (!option)
792
+ return null;
793
+ var key = option.key, label = option.label, customColor = option.customColor, subLabel = option.subLabel;
794
+ var isSelected = Array.isArray(selectedOption) ? selectedOption.includes(key) : key === selectedOption;
795
+ var setKey = function () {
796
+ onClick === null || onClick === void 0 ? void 0 : onClick(key, isSelected);
797
+ };
798
+ return (jsxRuntime.jsx(DropdownOption, { sideShow: varient === exports.DropdownVarient.BYLINE_SIDE ? key : '', label: label, subLabel: subLabel, isSelected: isSelected, icon: icon, iconStyle: iconStyle, height: theme.size[10], onClick: setKey, varient: varient, customColor: customColor, isChipSelection: isChipSelection, multiSelect: multiSelect }, key));
799
+ };
800
+ var singleItemSize = parseInt(theme.size[10].substring(0, theme.size[10].length - 2)) + 8;
801
+ var heightInt = parseInt(height.substring(0, height.length - 2));
802
+ var virtualListHeight = Math.min(optionList.length * singleItemSize, heightInt);
803
+ return (jsxRuntime.jsx(StyledDropdown, __assign$1({ theme: theme, varient: varient, height: height }, dropdownStyles, { children: showDropdown && (jsxRuntime.jsxs(ctDesignContainer.Container, __assign$1({ style: { overflow: 'scroll' } }, { children: [showSelectAll && (jsxRuntime.jsx(DropdownOption, { label: selectAllText, isSelected: Array.isArray(selectedOption) && selectedOption.length === optionList.length, icon: jsxRuntime.jsx(ctDesignCheckbox.Checkbox, { id: '', checked: Array.isArray(selectedOption) && selectedOption.length === optionList.length, selectAll: true }), iconStyle: iconStyle, height: theme.size[10], onClick: selectAllClick, varient: varient, customColor: selectAllCustomColor, isChipSelection: isChipSelection, multiSelect: true }, '')), jsxRuntime.jsx(ctDesignDivider.Divider, {}), virtualised ? (jsxRuntime.jsx(VirtualList, { width: 'auto', height: virtualListHeight, itemCount: optionList.length, itemSize: singleItemSize, overscanCount: 3, renderItem: optionRenderer })) : (optionList.map(function (option) {
804
+ var key = option.key, label = option.label, customColor = option.customColor, subLabel = option.subLabel;
805
+ var isSelected = Array.isArray(selectedOption) ? selectedOption.includes(key) : key === selectedOption;
806
+ var setKey = function () {
807
+ onClick === null || onClick === void 0 ? void 0 : onClick(key, isSelected);
808
+ };
809
+ return (jsxRuntime.jsx(DropdownOption, { sideShow: varient === exports.DropdownVarient.BYLINE_SIDE ? key : '', label: label, subLabel: subLabel, isSelected: isSelected, icon: icon, iconStyle: iconStyle, height: theme.size[10], onClick: setKey, varient: varient, customColor: customColor, isChipSelection: isChipSelection, multiSelect: multiSelect }, key));
810
+ }))] }))) })));
811
+ };
812
+
813
+ exports.Dropdown = Dropdown;
814
+
815
+ }));
816
+ //# sourceMappingURL=ct-design-dropdown.umd.js.map