@bikdotai/bik-component-library 0.0.830-beta.2 → 0.0.830-beta.4

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.
@@ -1,16 +1,16 @@
1
- import { jsxDEV as e, Fragment as x } from "react/jsx-dev-runtime";
2
- import { useState as l, useEffect as y } from "react";
3
- import I from "../../utils/StringUtils.js";
1
+ import { jsxDEV as e, Fragment as y } from "react/jsx-dev-runtime";
2
+ import { useState as l, useEffect as I } from "react";
3
+ import D from "../../utils/StringUtils.js";
4
4
  import { COLORS as a } from "../../constants/Theme.js";
5
- import D from "../../assets/icons/chevronDown.svg.js";
6
- import W from "../../assets/icons/cross.svg.js";
7
- import U from "../../assets/icons/errorInfo.svg.js";
8
- import { InputFooter as O } from "../input/Input.styled.js";
5
+ import W from "../../assets/icons/chevronDown.svg.js";
6
+ import U from "../../assets/icons/cross.svg.js";
7
+ import O from "../../assets/icons/errorInfo.svg.js";
8
+ import { InputFooter as S } from "../input/Input.styled.js";
9
9
  import { BodyCaption as d } from "../TypographyStyle.js";
10
- import { ChipInputWrapper as S } from "./Common.styled.js";
11
- import { Tag as L } from "../tag/Tag.js";
12
- import { Tooltip as E } from "../tooltips/Tooltip.js";
13
- const R = (r) => r.length === 1 ? 100 : r.length === 2 ? 40 : 34, K = ({
10
+ import { ChipInputWrapper as L } from "./Common.styled.js";
11
+ import { Tag as E } from "../tag/Tag.js";
12
+ import { Tooltip as R } from "../tooltips/Tooltip.js";
13
+ const A = (r) => r.length === 1 ? 100 : r.length === 2 ? 40 : 34, P = ({
14
14
  chips: r,
15
15
  onDeleteChip: c,
16
16
  containerStyle: h = {},
@@ -18,29 +18,30 @@ const R = (r) => r.length === 1 ? 100 : r.length === 2 ? 40 : 34, K = ({
18
18
  isDropdownOpened: k,
19
19
  placeholder: b = "Select..",
20
20
  errorMessage: m = "",
21
- showLabelsOnMoreHover: v = !1
21
+ showLabelsOnMoreHover: v = !1,
22
+ placeholderColor: f
22
23
  }) => {
23
- const [f, N] = l(), [p, w] = l(0), [u, C] = l([]);
24
- return y(() => {
24
+ const [N, w] = l(), [p, C] = l(0), [u, g] = l([]);
25
+ return I(() => {
25
26
  if (!r) return;
26
27
  let n = 0;
27
- const o = R(r);
28
+ const o = A(r);
28
29
  let t = r.filter((i) => (n += i.label.length, n <= o));
29
- t.length === 0 && r.length > 0 && (t = [r[0]]), N(t);
30
- const g = r.filter((i) => !t.includes(i)).map((i) => i.label);
31
- C(g), w(r.length - t.length);
32
- }, [r]), /* @__PURE__ */ e(x, { children: [
33
- /* @__PURE__ */ e(S, { style: { ...h }, error: !!m, children: [
30
+ t.length === 0 && r.length > 0 && (t = [r[0]]), w(t);
31
+ const x = r.filter((i) => !t.includes(i)).map((i) => i.label);
32
+ g(x), C(r.length - t.length);
33
+ }, [r]), /* @__PURE__ */ e(y, { children: [
34
+ /* @__PURE__ */ e(L, { style: { ...h }, error: !!m, children: [
34
35
  /* @__PURE__ */ e("div", { className: "chips-container", children: [
35
- f?.map((n, o) => /* @__PURE__ */ e("div", { style: { zIndex: 2 }, children: /* @__PURE__ */ e(
36
- L,
36
+ N?.map((n, o) => /* @__PURE__ */ e("div", { style: { zIndex: 2 }, children: /* @__PURE__ */ e(
37
+ E,
37
38
  {
38
- tagText: I.truncateText(
39
+ tagText: D.truncateText(
39
40
  n.selectedLabel || n.label,
40
41
  40
41
42
  ),
42
43
  TrailingIcon: () => /* @__PURE__ */ e(
43
- W,
44
+ U,
44
45
  {
45
46
  width: 12,
46
47
  height: 12,
@@ -53,7 +54,7 @@ const R = (r) => r.length === 1 ? 100 : r.length === 2 ? 40 : 34, K = ({
53
54
  !1,
54
55
  {
55
56
  fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/dropdown/ChipInput.tsx",
56
- lineNumber: 77,
57
+ lineNumber: 79,
57
58
  columnNumber: 10
58
59
  },
59
60
  void 0
@@ -64,13 +65,13 @@ const R = (r) => r.length === 1 ? 100 : r.length === 2 ? 40 : 34, K = ({
64
65
  !1,
65
66
  {
66
67
  fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/dropdown/ChipInput.tsx",
67
- lineNumber: 71,
68
+ lineNumber: 73,
68
69
  columnNumber: 8
69
70
  },
70
71
  void 0
71
72
  ) }, o, !1, {
72
73
  fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/dropdown/ChipInput.tsx",
73
- lineNumber: 70,
74
+ lineNumber: 72,
74
75
  columnNumber: 7
75
76
  }, void 0)),
76
77
  !!p && /* @__PURE__ */ e(
@@ -82,7 +83,7 @@ const R = (r) => r.length === 1 ? 100 : r.length === 2 ? 40 : 34, K = ({
82
83
  pointerEvents: "auto"
83
84
  },
84
85
  children: /* @__PURE__ */ e(
85
- E,
86
+ R,
86
87
  {
87
88
  body: "",
88
89
  placement: "bottom",
@@ -96,18 +97,18 @@ const R = (r) => r.length === 1 ? 100 : r.length === 2 ? 40 : 34, K = ({
96
97
  !1,
97
98
  {
98
99
  fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/dropdown/ChipInput.tsx",
99
- lineNumber: 106,
100
+ lineNumber: 108,
100
101
  columnNumber: 13
101
102
  },
102
103
  void 0
103
104
  )) }, void 0, !1, {
104
105
  fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/dropdown/ChipInput.tsx",
105
- lineNumber: 104,
106
+ lineNumber: 106,
106
107
  columnNumber: 11
107
108
  }, void 0) : void 0,
108
109
  children: /* @__PURE__ */ e(d, { color: a.content.placeholder, children: `+${p} more` }, void 0, !1, {
109
110
  fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/dropdown/ChipInput.tsx",
110
- lineNumber: 117,
111
+ lineNumber: 119,
111
112
  columnNumber: 9
112
113
  }, void 0)
113
114
  },
@@ -115,7 +116,7 @@ const R = (r) => r.length === 1 ? 100 : r.length === 2 ? 40 : 34, K = ({
115
116
  !1,
116
117
  {
117
118
  fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/dropdown/ChipInput.tsx",
118
- lineNumber: 99,
119
+ lineNumber: 101,
119
120
  columnNumber: 8
120
121
  },
121
122
  void 0
@@ -125,23 +126,33 @@ const R = (r) => r.length === 1 ? 100 : r.length === 2 ? 40 : 34, K = ({
125
126
  !1,
126
127
  {
127
128
  fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/dropdown/ChipInput.tsx",
128
- lineNumber: 92,
129
+ lineNumber: 94,
129
130
  columnNumber: 7
130
131
  },
131
132
  void 0
132
133
  ),
133
- r.length === 0 && /* @__PURE__ */ e("div", { style: { color: a.content.placeholder }, children: b }, void 0, !1, {
134
- fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/dropdown/ChipInput.tsx",
135
- lineNumber: 125,
136
- columnNumber: 7
137
- }, void 0)
134
+ r.length === 0 && /* @__PURE__ */ e(
135
+ "div",
136
+ {
137
+ style: { color: f ?? a.content.placeholder },
138
+ children: b
139
+ },
140
+ void 0,
141
+ !1,
142
+ {
143
+ fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/dropdown/ChipInput.tsx",
144
+ lineNumber: 127,
145
+ columnNumber: 7
146
+ },
147
+ void 0
148
+ )
138
149
  ] }, void 0, !0, {
139
150
  fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/dropdown/ChipInput.tsx",
140
- lineNumber: 68,
151
+ lineNumber: 70,
141
152
  columnNumber: 5
142
153
  }, void 0),
143
154
  /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
144
- D,
155
+ W,
145
156
  {
146
157
  style: {
147
158
  transform: k ? "rotate(180deg)" : "rotate(0deg)"
@@ -154,39 +165,39 @@ const R = (r) => r.length === 1 ? 100 : r.length === 2 ? 40 : 34, K = ({
154
165
  !1,
155
166
  {
156
167
  fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/dropdown/ChipInput.tsx",
157
- lineNumber: 132,
168
+ lineNumber: 136,
158
169
  columnNumber: 6
159
170
  },
160
171
  void 0
161
172
  ) }, void 0, !1, {
162
173
  fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/dropdown/ChipInput.tsx",
163
- lineNumber: 131,
174
+ lineNumber: 135,
164
175
  columnNumber: 5
165
176
  }, void 0)
166
177
  ] }, void 0, !0, {
167
178
  fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/dropdown/ChipInput.tsx",
168
- lineNumber: 67,
179
+ lineNumber: 69,
169
180
  columnNumber: 4
170
181
  }, void 0),
171
- !!m && /* @__PURE__ */ e(O, { invalid: !0, children: [
172
- !!m && /* @__PURE__ */ e(U, { width: 16, height: 16 }, void 0, !1, {
182
+ !!m && /* @__PURE__ */ e(S, { invalid: !0, children: [
183
+ !!m && /* @__PURE__ */ e(O, { width: 16, height: 16 }, void 0, !1, {
173
184
  fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/dropdown/ChipInput.tsx",
174
- lineNumber: 148,
185
+ lineNumber: 152,
175
186
  columnNumber: 25
176
187
  }, void 0),
177
188
  m
178
189
  ] }, void 0, !0, {
179
190
  fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/dropdown/ChipInput.tsx",
180
- lineNumber: 147,
191
+ lineNumber: 151,
181
192
  columnNumber: 5
182
193
  }, void 0)
183
194
  ] }, void 0, !0, {
184
195
  fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/dropdown/ChipInput.tsx",
185
- lineNumber: 66,
196
+ lineNumber: 68,
186
197
  columnNumber: 3
187
198
  }, void 0);
188
199
  };
189
200
  export {
190
- K as default
201
+ P as default
191
202
  };
192
203
  //# sourceMappingURL=ChipInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChipInput.js","sources":["../../../../src/components/dropdown/ChipInput.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport StringUtils from '@src/utils/StringUtils';\nimport { COLORS } from '@src/constants/Theme';\nimport DownIcon from '../../assets/icons/chevronDown.svg';\nimport CrossIcon from '../../assets/icons/cross.svg';\nimport ErrorIcon from '../../assets/icons/errorInfo.svg';\nimport { InputFooter } from '../input/Input.styled';\nimport { Tag } from '../tag';\nimport { Tooltip } from '../tooltips';\nimport { BodyCaption } from '../TypographyStyle';\nimport { ChipInputWrapper } from './Common.styled';\nimport { SingleOption } from './type';\n\ninterface ChipInputProps {\n\tplaceholder?: string;\n\tchips: SingleOption[];\n\tonDeleteChip: (chip: SingleOption) => void;\n\tcontainerStyle?: React.CSSProperties;\n\tisDropdownOpened?: boolean;\n\tsizeToUse?: 'default' | 'small' | 'x-small';\n\terrorMessage?: string;\n\tshowLabelsOnMoreHover?: boolean;\n}\n\nconst getMaxChipsCharCount = (chips: SingleOption[]) => {\n\tif (chips.length === 1) return 100;\n\tif (chips.length === 2) return 40;\n\treturn 34;\n};\n\nconst ChipInput: React.FC<ChipInputProps> = ({\n\tchips,\n\tonDeleteChip,\n\tcontainerStyle = {},\n\tsizeToUse = 'default',\n\tisDropdownOpened,\n\tplaceholder = 'Select..',\n\terrorMessage = '',\n\tshowLabelsOnMoreHover = false,\n}) => {\n\tconst [options, setOptions] = useState<SingleOption[]>();\n\tconst [remainingOptionsCnt, setRemainingOptionsCnt] = useState(0);\n\tconst [remainingOptionsLabels, setRemainingOptionsLabels] = useState<\n\t\tstring[]\n\t>([]);\n\n\tuseEffect(() => {\n\t\tif (!chips) return;\n\t\tlet combineCharCnt = 0;\n\t\tconst MAX_CHAR = getMaxChipsCharCount(chips);\n\t\tlet options = chips.filter((option) => {\n\t\t\tcombineCharCnt += option.label.length;\n\t\t\treturn combineCharCnt <= MAX_CHAR;\n\t\t});\n\t\tif (options.length === 0 && chips.length > 0) {\n\t\t\toptions = [chips[0]];\n\t\t}\n\t\tsetOptions(options);\n\t\tconst remainingChips = chips.filter((option) => !options.includes(option));\n\t\tconst labels = remainingChips.map((option) => option.label);\n\t\tsetRemainingOptionsLabels(labels);\n\t\tsetRemainingOptionsCnt(chips.length - options.length);\n\t}, [chips]);\n\n\treturn (\n\t\t<>\n\t\t\t<ChipInputWrapper style={{ ...containerStyle }} error={!!errorMessage}>\n\t\t\t\t<div className=\"chips-container\">\n\t\t\t\t\t{options?.map((chip, index) => (\n\t\t\t\t\t\t<div key={index} style={{ zIndex: 2 }}>\n\t\t\t\t\t\t\t<Tag\n\t\t\t\t\t\t\t\ttagText={StringUtils.truncateText(\n\t\t\t\t\t\t\t\t\tchip.selectedLabel || chip.label,\n\t\t\t\t\t\t\t\t\t40,\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\tTrailingIcon={() => (\n\t\t\t\t\t\t\t\t\t<CrossIcon\n\t\t\t\t\t\t\t\t\t\twidth={12}\n\t\t\t\t\t\t\t\t\t\theight={12}\n\t\t\t\t\t\t\t\t\t\tstyle={{ cursor: 'pointer' }}\n\t\t\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\t\t\tonDeleteChip(chip);\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{chip.selectedLabel || chip.label}\n\t\t\t\t\t\t\t</Tag>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t))}\n\t\t\t\t\t{!!remainingOptionsCnt && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\tposition: 'relative',\n\t\t\t\t\t\t\t\tzIndex: 2,\n\t\t\t\t\t\t\t\tpointerEvents: 'auto',\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Tooltip\n\t\t\t\t\t\t\t\tbody={''}\n\t\t\t\t\t\t\t\tplacement=\"bottom\"\n\t\t\t\t\t\t\t\ttooltipContent={\n\t\t\t\t\t\t\t\t\tshowLabelsOnMoreHover && remainingOptionsLabels.length > 0 ? (\n\t\t\t\t\t\t\t\t\t\t<div style={{ padding: '4px' }}>\n\t\t\t\t\t\t\t\t\t\t\t{remainingOptionsLabels.map((label, index) => (\n\t\t\t\t\t\t\t\t\t\t\t\t<BodyCaption\n\t\t\t\t\t\t\t\t\t\t\t\t\tstyle={{ color: COLORS.text.white }}\n\t\t\t\t\t\t\t\t\t\t\t\t\tkey={index}\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{label}\n\t\t\t\t\t\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t) : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<BodyCaption color={COLORS.content.placeholder}>\n\t\t\t\t\t\t\t\t\t{`+${remainingOptionsCnt} more`}\n\t\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{chips.length === 0 && (\n\t\t\t\t\t\t<div style={{ color: COLORS.content.placeholder }}>\n\t\t\t\t\t\t\t{placeholder}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\n\t\t\t\t<div>\n\t\t\t\t\t<DownIcon\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\ttransform: isDropdownOpened ? 'rotate(180deg)' : 'rotate(0deg)',\n\t\t\t\t\t\t}}\n\t\t\t\t\t\twidth={\n\t\t\t\t\t\t\tsizeToUse === 'x-small' ? 16 : sizeToUse === 'small' ? 20 : 24\n\t\t\t\t\t\t}\n\t\t\t\t\t\theight={\n\t\t\t\t\t\t\tsizeToUse === 'x-small' ? 16 : sizeToUse === 'small' ? 20 : 24\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcolor={COLORS.content.primary}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</ChipInputWrapper>\n\t\t\t{!!errorMessage && (\n\t\t\t\t<InputFooter invalid={true}>\n\t\t\t\t\t{!!errorMessage && <ErrorIcon width={16} height={16} />}\n\t\t\t\t\t{errorMessage}\n\t\t\t\t</InputFooter>\n\t\t\t)}\n\t\t</>\n\t);\n};\n\nexport default ChipInput;\n"],"names":["getMaxChipsCharCount","chips","ChipInput","onDeleteChip","containerStyle","sizeToUse","isDropdownOpened","placeholder","errorMessage","showLabelsOnMoreHover","options","setOptions","useState","remainingOptionsCnt","setRemainingOptionsCnt","remainingOptionsLabels","setRemainingOptionsLabels","useEffect","combineCharCnt","MAX_CHAR","option","labels","jsxDEV","Fragment","ChipInputWrapper","chip","index","Tag","StringUtils","CrossIcon","this","Tooltip","label","BodyCaption","COLORS","DownIcon","InputFooter","ErrorIcon"],"mappings":";;;;;;;;;;;;AAwBA,MAAMA,IAAuB,CAACC,MACzBA,EAAM,WAAW,IAAU,MAC3BA,EAAM,WAAW,IAAU,KACxB,IAGFC,IAAsC,CAAC;AAAA,EAC5C,OAAAD;AAAA,EACA,cAAAE;AAAA,EACA,gBAAAC,IAAiB,CAAA;AAAA,EACjB,WAAAC,IAAY;AAAA,EACZ,kBAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,cAAAC,IAAe;AAAA,EACf,uBAAAC,IAAwB;AACzB,MAAM;AACL,QAAM,CAACC,G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AA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAAA,GAAAA,MAaA;AAAA,IAAA,EAAA,GA7ED,QAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAA,MA8EA;AAAA,IACC,CAAC,CAACtB,KACF,gBAAAc,EAACc,GAAA,EAAY,SAAS,IACpB,UAAA;AAAA,MAAA,CAAC,CAAC5B,KAAgB,gBAAAc,EAACe,KAAU,OAAO,IAAI,QAAQ,MAA9B,QAAA,IAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAAA,GAAAP,MAAkC;AAAA,MACpDtB;AAAA,IAAA,EAAA,GAFF,QAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAsB,MAGA;AAAA,EAAA,EAAA,GApFF,QAAA,IAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAsFA;AAEF;"}
1
+ {"version":3,"file":"ChipInput.js","sources":["../../../../src/components/dropdown/ChipInput.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport StringUtils from '@src/utils/StringUtils';\nimport { COLORS } from '@src/constants/Theme';\nimport DownIcon from '../../assets/icons/chevronDown.svg';\nimport CrossIcon from '../../assets/icons/cross.svg';\nimport ErrorIcon from '../../assets/icons/errorInfo.svg';\nimport { InputFooter } from '../input/Input.styled';\nimport { Tag } from '../tag';\nimport { Tooltip } from '../tooltips';\nimport { BodyCaption } from '../TypographyStyle';\nimport { ChipInputWrapper } from './Common.styled';\nimport { SingleOption } from './type';\n\ninterface ChipInputProps {\n\tplaceholder?: string;\n\tchips: SingleOption[];\n\tonDeleteChip: (chip: SingleOption) => void;\n\tcontainerStyle?: React.CSSProperties;\n\tisDropdownOpened?: boolean;\n\tsizeToUse?: 'default' | 'small' | 'x-small';\n\terrorMessage?: string;\n\tshowLabelsOnMoreHover?: boolean;\n\tplaceholderColor?: string;\n}\n\nconst getMaxChipsCharCount = (chips: SingleOption[]) => {\n\tif (chips.length === 1) return 100;\n\tif (chips.length === 2) return 40;\n\treturn 34;\n};\n\nconst ChipInput: React.FC<ChipInputProps> = ({\n\tchips,\n\tonDeleteChip,\n\tcontainerStyle = {},\n\tsizeToUse = 'default',\n\tisDropdownOpened,\n\tplaceholder = 'Select..',\n\terrorMessage = '',\n\tshowLabelsOnMoreHover = false,\n\tplaceholderColor,\n}) => {\n\tconst [options, setOptions] = useState<SingleOption[]>();\n\tconst [remainingOptionsCnt, setRemainingOptionsCnt] = useState(0);\n\tconst [remainingOptionsLabels, setRemainingOptionsLabels] = useState<\n\t\tstring[]\n\t>([]);\n\n\tuseEffect(() => {\n\t\tif (!chips) return;\n\t\tlet combineCharCnt = 0;\n\t\tconst MAX_CHAR = getMaxChipsCharCount(chips);\n\t\tlet options = chips.filter((option) => {\n\t\t\tcombineCharCnt += option.label.length;\n\t\t\treturn combineCharCnt <= MAX_CHAR;\n\t\t});\n\t\tif (options.length === 0 && chips.length > 0) {\n\t\t\toptions = [chips[0]];\n\t\t}\n\t\tsetOptions(options);\n\t\tconst remainingChips = chips.filter((option) => !options.includes(option));\n\t\tconst labels = remainingChips.map((option) => option.label);\n\t\tsetRemainingOptionsLabels(labels);\n\t\tsetRemainingOptionsCnt(chips.length - options.length);\n\t}, [chips]);\n\n\treturn (\n\t\t<>\n\t\t\t<ChipInputWrapper style={{ ...containerStyle }} error={!!errorMessage}>\n\t\t\t\t<div className=\"chips-container\">\n\t\t\t\t\t{options?.map((chip, index) => (\n\t\t\t\t\t\t<div key={index} style={{ zIndex: 2 }}>\n\t\t\t\t\t\t\t<Tag\n\t\t\t\t\t\t\t\ttagText={StringUtils.truncateText(\n\t\t\t\t\t\t\t\t\tchip.selectedLabel || chip.label,\n\t\t\t\t\t\t\t\t\t40,\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\tTrailingIcon={() => (\n\t\t\t\t\t\t\t\t\t<CrossIcon\n\t\t\t\t\t\t\t\t\t\twidth={12}\n\t\t\t\t\t\t\t\t\t\theight={12}\n\t\t\t\t\t\t\t\t\t\tstyle={{ cursor: 'pointer' }}\n\t\t\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\t\t\tonDeleteChip(chip);\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{chip.selectedLabel || chip.label}\n\t\t\t\t\t\t\t</Tag>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t))}\n\t\t\t\t\t{!!remainingOptionsCnt && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\tposition: 'relative',\n\t\t\t\t\t\t\t\tzIndex: 2,\n\t\t\t\t\t\t\t\tpointerEvents: 'auto',\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Tooltip\n\t\t\t\t\t\t\t\tbody={''}\n\t\t\t\t\t\t\t\tplacement=\"bottom\"\n\t\t\t\t\t\t\t\ttooltipContent={\n\t\t\t\t\t\t\t\t\tshowLabelsOnMoreHover && remainingOptionsLabels.length > 0 ? (\n\t\t\t\t\t\t\t\t\t\t<div style={{ padding: '4px' }}>\n\t\t\t\t\t\t\t\t\t\t\t{remainingOptionsLabels.map((label, index) => (\n\t\t\t\t\t\t\t\t\t\t\t\t<BodyCaption\n\t\t\t\t\t\t\t\t\t\t\t\t\tstyle={{ color: COLORS.text.white }}\n\t\t\t\t\t\t\t\t\t\t\t\t\tkey={index}\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{label}\n\t\t\t\t\t\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t) : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<BodyCaption color={COLORS.content.placeholder}>\n\t\t\t\t\t\t\t\t\t{`+${remainingOptionsCnt} more`}\n\t\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{chips.length === 0 && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tstyle={{ color: placeholderColor ?? COLORS.content.placeholder }}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{placeholder}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\n\t\t\t\t<div>\n\t\t\t\t\t<DownIcon\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\ttransform: isDropdownOpened ? 'rotate(180deg)' : 'rotate(0deg)',\n\t\t\t\t\t\t}}\n\t\t\t\t\t\twidth={\n\t\t\t\t\t\t\tsizeToUse === 'x-small' ? 16 : sizeToUse === 'small' ? 20 : 24\n\t\t\t\t\t\t}\n\t\t\t\t\t\theight={\n\t\t\t\t\t\t\tsizeToUse === 'x-small' ? 16 : sizeToUse === 'small' ? 20 : 24\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcolor={COLORS.content.primary}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</ChipInputWrapper>\n\t\t\t{!!errorMessage && (\n\t\t\t\t<InputFooter invalid={true}>\n\t\t\t\t\t{!!errorMessage && <ErrorIcon width={16} height={16} />}\n\t\t\t\t\t{errorMessage}\n\t\t\t\t</InputFooter>\n\t\t\t)}\n\t\t</>\n\t);\n};\n\nexport default ChipInput;\n"],"names":["getMaxChipsCharCount","chips","ChipInput","onDeleteChip","containerStyle","sizeToUse","isDropdownOpened","placeholder","errorMessage","showLabelsOnMoreHover","placeholderColor","options","setOptions","useState","remainingOptionsCnt","setRemainingOptionsCnt","remainingOptionsLabels","setRemainingOptionsLabels","useEffect","combineCharCnt","MAX_CHAR","option","labels","jsxDEV","Fragment","ChipInputWrapper","chip","index","Tag","StringUtils","CrossIcon","this","Tooltip","label","BodyCaption","COLORS","DownIcon","InputFooter","ErrorIcon"],"mappings":";;;;;;;;;;;;AAyBA,MAAMA,IAAuB,CAACC,MACzBA,EAAM,WAAW,IAAU,MAC3BA,EAAM,WAAW,IAAU,KACxB,IAGFC,IAAsC,CAAC;AAAA,EAC5C,OAAAD;AAAA,EACA,cAAAE;AAAA,EACA,gBAAAC,IAAiB,CAAA;AAAA,EACjB,WAAAC,IAAY;AAAA,EACZ,kBAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,cAAAC,IAAe;AAAA,EACf,uBAAAC,IAAwB;AAAA,EACxB,kBAAAC;AACD,MAAM;AACL,QAAM,CAACC,GAASC,CAAU,IAAIC,EAAA,GACxB,CAACC,GAAqBC,CAAsB,IAAIF,EAAS,CAAC,GAC1D,CAACG,GAAwBC,CAAyB,IAAIJ,EAE1D,CAAA,CAAE;AAEJ,SAAAK,EAAU,MAAM;AACf,QAAI,CAACjB,EAAO;AACZ,QAAIkB,IAAiB;AACrB,UAAMC,IAAWpB,EAAqBC,CAAK;AAC3C,QAAIU,IAAUV,EAAM,OAAO,CAACoB,OAC3BF,KAAkBE,EAAO,MAAM,QACxBF,KAAkBC,EACzB;AACD,IAAIT,EAAQ,WAAW,KAAKV,EAAM,SAAS,MAC1CU,IAAU,CAACV,EAAM,CAAC,CAAC,IAEpBW,EAAWD,CAAO;AAElB,UAAMW,IADiBrB,EAAM,OAAO,CAACoB,MAAW,CAACV,EAAQ,SAASU,CAAM,CAAC,EAC3C,IAAI,CAACA,MAAWA,EAAO,KAAK;AAC1D,IAAAJ,EAA0BK,CAAM,GAChCP,EAAuBd,EAAM,SAASU,EAAQ,MAAM;AAAA,EACrD,GAAG,CAACV,CAAK,CAA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,EAAA,GAtFF,QAAA,IAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAwFA;AAEF;"}
@@ -4,6 +4,8 @@ export type DropdownProps = OpenDropdownProps & {
4
4
  placeHolder?: string;
5
5
  size?: 'default' | 'small' | 'x-small';
6
6
  disabled?: boolean;
7
+ /** When disabled, render a solid grey box (background.base) with secondary text and no opacity wash. */
8
+ solidDisabled?: boolean;
7
9
  noErrorHint?: boolean;
8
10
  buttonWidth?: string;
9
11
  placeHolderHeight?: string;
@@ -1,138 +1,140 @@
1
- import { jsxDEV as i, Fragment as g } from "react/jsx-dev-runtime";
2
- import { useState as f, useRef as _, useEffect as y } from "react";
3
- import { COLORS as t, BASE_COLORS as q } from "../../constants/Theme.js";
4
- import G from "../../assets/icons/chevronDown.svg.js";
5
- import { InputStyleContext as J } from "../input/context/InputStyleProvider.js";
6
- import K from "./ChipInput.js";
7
- import { DropdownPopover as Q } from "./DropdownPopover/index.js";
8
- import { getSelectedOptionsAsText as X } from "./OpenedDropdown/utils/iterationOnOptions.js";
9
- import { Input as Y } from "../input/Input.js";
10
- function W() {
1
+ import { jsxDEV as t, Fragment as y } from "react/jsx-dev-runtime";
2
+ import { useState as k, useRef as q, useEffect as W } from "react";
3
+ import { COLORS as o, BASE_COLORS as G } from "../../constants/Theme.js";
4
+ import J from "../../assets/icons/chevronDown.svg.js";
5
+ import { InputStyleContext as K } from "../input/context/InputStyleProvider.js";
6
+ import Q from "./ChipInput.js";
7
+ import { DropdownPopover as X } from "./DropdownPopover/index.js";
8
+ import { getSelectedOptionsAsText as Y } from "./OpenedDropdown/utils/iterationOnOptions.js";
9
+ import { Input as Z } from "../input/Input.js";
10
+ function S() {
11
11
  }
12
- const Z = ({
13
- placeHolder: s,
14
- size: D,
15
- onSelect: S,
16
- defaultOptions: a,
17
- disabled: v,
18
- noErrorHint: I,
19
- placeHolderHeight: k,
20
- showPlaceholderWhenSelected: C = !1,
21
- inputStyle: U = {},
22
- inputType: b = "default",
23
- onDeleteChip: E,
24
- truncatedText: O,
25
- showLeadingIconInPlaceholder: M = !1,
26
- showTrailingIconPlaceholder: A = !1,
27
- showLabelsOnMoreHover: R = !1,
28
- value: d,
29
- showSelected: c = !1,
30
- onDropdownVisbilityChange: T,
12
+ const $ = ({
13
+ placeHolder: d,
14
+ size: C,
15
+ onSelect: I,
16
+ defaultOptions: l,
17
+ disabled: i,
18
+ solidDisabled: s,
19
+ noErrorHint: D,
20
+ placeHolderHeight: b,
21
+ showPlaceholderWhenSelected: U = !1,
22
+ inputStyle: E = {},
23
+ inputType: w = "default",
24
+ onDeleteChip: O,
25
+ truncatedText: M,
26
+ showLeadingIconInPlaceholder: A = !1,
27
+ showTrailingIconPlaceholder: R = !1,
28
+ showLabelsOnMoreHover: T = !1,
29
+ value: m,
30
+ showSelected: p = !1,
31
+ onDropdownVisbilityChange: V,
31
32
  ...e
32
33
  }) => {
33
- const [u, V] = f(!1), [w, x] = f(!1), o = D ?? "default", L = _(), [n, l] = f(
34
- a ?? []
34
+ const [h, L] = k(!1), [x, N] = k(!1), n = C ?? "default", z = q(), [a, c] = k(
35
+ l ?? []
35
36
  );
36
- function z(r) {
37
- Array.isArray(r) ? l([...r]) : l([r]), S?.(r);
37
+ function F(r) {
38
+ Array.isArray(r) ? c([...r]) : c([r]), I?.(r);
38
39
  }
39
- y(() => {
40
+ W(() => {
40
41
  const r = [];
41
- e?.options?.forEach((m) => {
42
- m.options ? m.options.forEach((h) => {
43
- h.selected && r.push({
44
- ...h,
45
- label: h.label
42
+ e?.options?.forEach((u) => {
43
+ u.options ? u.options.forEach((v) => {
44
+ v.selected && r.push({
45
+ ...v,
46
+ label: v.label
46
47
  });
47
- }) : m.selected && r.push(m);
48
- }), l([...r]);
49
- }, [e.options]), y(() => {
50
- a && l([...a]);
51
- }, [a]);
52
- const F = X(n), j = C ? s : F ?? s ?? "Select an option", p = e.buttonWidth, N = p ?? e.width ?? "100%", B = e.dropdownWidth ?? N;
53
- return /* @__PURE__ */ i(g, { children: /* @__PURE__ */ i(
54
- J.Provider,
48
+ }) : u.selected && r.push(u);
49
+ }), c([...r]);
50
+ }, [e.options]), W(() => {
51
+ l && c([...l]);
52
+ }, [l]);
53
+ const j = Y(a), B = U ? d : j ?? d ?? "Select an option", f = e.buttonWidth, g = f ?? e.width ?? "100%", _ = e.dropdownWidth ?? g;
54
+ return /* @__PURE__ */ t(y, { children: /* @__PURE__ */ t(
55
+ K.Provider,
55
56
  {
56
57
  value: {
57
58
  InputWrapper: {
58
- height: k || (o === "x-small" ? 24 : o === "small" ? 32 : 48),
59
- width: N,
60
- ...p ? { maxWidth: p } : {},
59
+ height: b || (n === "x-small" ? 24 : n === "small" ? 32 : 48),
60
+ width: g,
61
+ ...f ? { maxWidth: f } : {},
61
62
  zIndex: 1,
62
63
  cursor: "pointer",
63
- padding: o === "x-small" ? "4px 8px" : "6px 8px",
64
- backgroundColor: e.version === "3.0" ? u || w ? t.surface.hovered : t.surface.standard : c && d !== void 0 ? q.positive[100] : w ? t.background.inactive : t.surface.standard,
64
+ padding: n === "x-small" ? "4px 8px" : "6px 8px",
65
+ backgroundColor: i && s ? o.background.base : e.version === "3.0" ? h || x ? o.surface.hovered : o.surface.standard : p && m !== void 0 ? G.positive[100] : x ? o.background.inactive : o.surface.standard,
65
66
  transition: "background-color 0.3s ease",
66
- ...U
67
+ ...E
67
68
  },
68
69
  input: {
69
70
  minHeight: "100%",
70
71
  maxWidth: "100%",
71
- color: c && d !== void 0 ? t.content.positive : "inherit"
72
+ color: i && s ? o.content.secondary : p && m !== void 0 ? o.content.positive : "inherit"
72
73
  }
73
74
  },
74
- children: /* @__PURE__ */ i(
75
+ children: /* @__PURE__ */ t(
75
76
  "div",
76
77
  {
77
- onMouseEnter: () => x(!0),
78
- onMouseLeave: () => x(!1),
78
+ onMouseEnter: () => N(!0),
79
+ onMouseLeave: () => N(!1),
79
80
  style: e.width ? { width: e.width } : void 0,
80
- children: /* @__PURE__ */ i(
81
- Q,
81
+ children: /* @__PURE__ */ t(
82
+ X,
82
83
  {
83
84
  "data-test": e["data-test"],
84
- ref: L,
85
- onSelect: z,
86
- disabled: v,
85
+ ref: z,
86
+ onSelect: F,
87
+ disabled: i,
87
88
  ...e,
88
89
  onDropdownVisbilityChange: (r) => {
89
- V(r), T?.(r);
90
+ L(r), V?.(r);
90
91
  },
91
- width: B,
92
+ width: _,
92
93
  children: [
93
- b == "default" && /* @__PURE__ */ i(
94
- Y,
94
+ w == "default" && /* @__PURE__ */ t(
95
+ Z,
95
96
  {
96
97
  version: e.version,
97
- noErrorHint: I,
98
- state: v ? "disabled" : "none",
99
- value: d === void 0 ? j : d,
98
+ noErrorHint: D,
99
+ state: i ? "disabled" : "none",
100
+ solidDisabled: s,
101
+ value: m === void 0 ? B : m,
100
102
  errorMessage: e.error,
101
- variant: o,
102
- placeholder: s ?? "Select an option",
103
- onChangeText: W,
104
- leftIcon: M && n[0]?.leadingIcon ? {
105
- icon: () => /* @__PURE__ */ i(g, { children: n[0]?.leadingIcon }, void 0, !1, {
103
+ variant: n,
104
+ placeholder: d ?? "Select an option",
105
+ onChangeText: S,
106
+ leftIcon: A && a[0]?.leadingIcon ? {
107
+ icon: () => /* @__PURE__ */ t(y, { children: a[0]?.leadingIcon }, void 0, !1, {
106
108
  fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/dropdown/Dropdown.tsx",
107
- lineNumber: 203,
109
+ lineNumber: 211,
108
110
  columnNumber: 25
109
111
  }, void 0)
110
112
  } : void 0,
111
113
  rightIcon: {
112
- icon: () => /* @__PURE__ */ i(
114
+ icon: () => /* @__PURE__ */ t(
113
115
  "div",
114
116
  {
115
117
  style: {
116
118
  display: "flex"
117
119
  },
118
120
  children: [
119
- A && n[0]?.trailingIcon,
120
- /* @__PURE__ */ i(
121
- G,
121
+ R && a[0]?.trailingIcon,
122
+ /* @__PURE__ */ t(
123
+ J,
122
124
  {
123
125
  style: {
124
- transform: u ? "rotate(180deg)" : "rotate(0deg)"
126
+ transform: h ? "rotate(180deg)" : "rotate(0deg)"
125
127
  },
126
- onClick: W,
127
- width: o === "x-small" ? 16 : o === "small" ? 20 : 24,
128
- height: o === "x-small" ? 16 : o === "small" ? 20 : 24,
129
- color: c ? t.content.positive : t.content.primary
128
+ onClick: S,
129
+ width: n === "x-small" ? 16 : n === "small" ? 20 : 24,
130
+ height: n === "x-small" ? 16 : n === "small" ? 20 : 24,
131
+ color: p ? o.content.positive : o.content.primary
130
132
  },
131
133
  void 0,
132
134
  !1,
133
135
  {
134
136
  fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/dropdown/Dropdown.tsx",
135
- lineNumber: 216,
137
+ lineNumber: 224,
136
138
  columnNumber: 12
137
139
  },
138
140
  void 0
@@ -143,45 +145,50 @@ const Z = ({
143
145
  !0,
144
146
  {
145
147
  fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/dropdown/Dropdown.tsx",
146
- lineNumber: 209,
148
+ lineNumber: 217,
147
149
  columnNumber: 11
148
150
  },
149
151
  void 0
150
152
  )
151
153
  },
152
- truncateText: O ?? !0
154
+ truncateText: M ?? !0
153
155
  },
154
156
  void 0,
155
157
  !1,
156
158
  {
157
159
  fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/dropdown/Dropdown.tsx",
158
- lineNumber: 191,
160
+ lineNumber: 198,
159
161
  columnNumber: 8
160
162
  },
161
163
  void 0
162
164
  ),
163
- b == "chip" && /* @__PURE__ */ i(
164
- K,
165
+ w == "chip" && /* @__PURE__ */ t(
166
+ Q,
165
167
  {
166
- placeholder: s ?? "Select options",
167
- chips: n,
168
+ placeholder: d ?? "Select options",
169
+ placeholderColor: i && s ? o.content.secondary : void 0,
170
+ chips: a,
168
171
  onDeleteChip: (r) => {
169
- E?.(r);
172
+ O?.(r);
170
173
  },
171
174
  errorMessage: e.error,
172
- isDropdownOpened: u,
173
- sizeToUse: o,
175
+ isDropdownOpened: h,
176
+ sizeToUse: n,
174
177
  containerStyle: {
175
178
  width: e.width ?? "100%",
176
- cursor: "pointer"
179
+ cursor: "pointer",
180
+ ...i && s ? {
181
+ backgroundColor: o.background.base,
182
+ pointerEvents: "none"
183
+ } : {}
177
184
  },
178
- showLabelsOnMoreHover: R
185
+ showLabelsOnMoreHover: T
179
186
  },
180
187
  void 0,
181
188
  !1,
182
189
  {
183
190
  fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/dropdown/Dropdown.tsx",
184
- lineNumber: 250,
191
+ lineNumber: 258,
185
192
  columnNumber: 8
186
193
  },
187
194
  void 0
@@ -192,7 +199,7 @@ const Z = ({
192
199
  !0,
193
200
  {
194
201
  fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/dropdown/Dropdown.tsx",
195
- lineNumber: 172,
202
+ lineNumber: 179,
196
203
  columnNumber: 6
197
204
  },
198
205
  void 0
@@ -202,7 +209,7 @@ const Z = ({
202
209
  !1,
203
210
  {
204
211
  fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/dropdown/Dropdown.tsx",
205
- lineNumber: 163,
212
+ lineNumber: 170,
206
213
  columnNumber: 5
207
214
  },
208
215
  void 0
@@ -212,18 +219,18 @@ const Z = ({
212
219
  !1,
213
220
  {
214
221
  fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/dropdown/Dropdown.tsx",
215
- lineNumber: 125,
222
+ lineNumber: 128,
216
223
  columnNumber: 4
217
224
  },
218
225
  void 0
219
226
  ) }, void 0, !1, {
220
227
  fileName: "/Users/himanshusrivastava/Desktop/Work/worktrees/helpdesk-ui-revamp/bik-component-library/src/components/dropdown/Dropdown.tsx",
221
- lineNumber: 124,
228
+ lineNumber: 127,
222
229
  columnNumber: 3
223
230
  }, void 0);
224
231
  };
225
- Z.displayName = "Dropdown";
232
+ $.displayName = "Dropdown";
226
233
  export {
227
- Z as Dropdown
234
+ $ as Dropdown
228
235
  };
229
236
  //# sourceMappingURL=Dropdown.js.map