@dxc-technology/halstack-react 0.0.0-63eb520 → 0.0.0-646cad5

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 (309) hide show
  1. package/README.md +46 -0
  2. package/dist/index.d.mts +6670 -0
  3. package/dist/index.d.ts +6670 -0
  4. package/dist/index.js +14353 -0
  5. package/dist/index.mjs +14296 -0
  6. package/package.json +69 -71
  7. package/BackgroundColorContext.d.ts +0 -10
  8. package/BackgroundColorContext.js +0 -47
  9. package/HalstackContext.d.ts +0 -10
  10. package/HalstackContext.js +0 -243
  11. package/accordion/Accordion.d.ts +0 -4
  12. package/accordion/Accordion.js +0 -226
  13. package/accordion/Accordion.stories.tsx +0 -307
  14. package/accordion/Accordion.test.js +0 -72
  15. package/accordion/types.d.ts +0 -68
  16. package/accordion/types.js +0 -5
  17. package/accordion-group/AccordionGroup.d.ts +0 -7
  18. package/accordion-group/AccordionGroup.js +0 -168
  19. package/accordion-group/AccordionGroup.stories.tsx +0 -225
  20. package/accordion-group/AccordionGroup.test.js +0 -151
  21. package/accordion-group/types.d.ts +0 -72
  22. package/accordion-group/types.js +0 -5
  23. package/alert/Alert.d.ts +0 -4
  24. package/alert/Alert.js +0 -290
  25. package/alert/Alert.stories.tsx +0 -170
  26. package/alert/Alert.test.js +0 -92
  27. package/alert/types.d.ts +0 -49
  28. package/alert/types.js +0 -5
  29. package/badge/Badge.d.ts +0 -4
  30. package/badge/Badge.js +0 -59
  31. package/badge/types.d.ts +0 -4
  32. package/badge/types.js +0 -5
  33. package/bleed/Bleed.d.ts +0 -3
  34. package/bleed/Bleed.js +0 -84
  35. package/bleed/Bleed.stories.tsx +0 -342
  36. package/bleed/types.d.ts +0 -37
  37. package/bleed/types.js +0 -5
  38. package/box/Box.d.ts +0 -4
  39. package/box/Box.js +0 -126
  40. package/box/Box.stories.tsx +0 -132
  41. package/box/Box.test.js +0 -18
  42. package/box/types.d.ts +0 -43
  43. package/box/types.js +0 -5
  44. package/button/Button.d.ts +0 -4
  45. package/button/Button.js +0 -174
  46. package/button/Button.stories.tsx +0 -274
  47. package/button/Button.test.js +0 -35
  48. package/button/types.d.ts +0 -53
  49. package/button/types.js +0 -5
  50. package/card/Card.d.ts +0 -4
  51. package/card/Card.js +0 -163
  52. package/card/Card.stories.tsx +0 -201
  53. package/card/Card.test.js +0 -50
  54. package/card/ice-cream.jpg +0 -0
  55. package/card/types.d.ts +0 -67
  56. package/card/types.js +0 -5
  57. package/checkbox/Checkbox.d.ts +0 -4
  58. package/checkbox/Checkbox.js +0 -254
  59. package/checkbox/Checkbox.stories.tsx +0 -188
  60. package/checkbox/Checkbox.test.js +0 -78
  61. package/checkbox/types.d.ts +0 -64
  62. package/checkbox/types.js +0 -5
  63. package/chip/Chip.d.ts +0 -4
  64. package/chip/Chip.js +0 -161
  65. package/chip/Chip.stories.tsx +0 -119
  66. package/chip/Chip.test.js +0 -56
  67. package/chip/types.d.ts +0 -45
  68. package/chip/types.js +0 -5
  69. package/common/OpenSans.css +0 -81
  70. package/common/RequiredComponent.js +0 -32
  71. package/common/fonts/OpenSans-Bold.ttf +0 -0
  72. package/common/fonts/OpenSans-BoldItalic.ttf +0 -0
  73. package/common/fonts/OpenSans-ExtraBold.ttf +0 -0
  74. package/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
  75. package/common/fonts/OpenSans-Italic.ttf +0 -0
  76. package/common/fonts/OpenSans-Light.ttf +0 -0
  77. package/common/fonts/OpenSans-LightItalic.ttf +0 -0
  78. package/common/fonts/OpenSans-Regular.ttf +0 -0
  79. package/common/fonts/OpenSans-SemiBold.ttf +0 -0
  80. package/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
  81. package/common/utils.js +0 -22
  82. package/common/variables.js +0 -1372
  83. package/date-input/DateInput.d.ts +0 -4
  84. package/date-input/DateInput.js +0 -369
  85. package/date-input/DateInput.stories.tsx +0 -138
  86. package/date-input/DateInput.test.js +0 -479
  87. package/date-input/types.d.ts +0 -107
  88. package/date-input/types.js +0 -5
  89. package/dialog/Dialog.d.ts +0 -4
  90. package/dialog/Dialog.js +0 -138
  91. package/dialog/Dialog.stories.tsx +0 -212
  92. package/dialog/Dialog.test.js +0 -40
  93. package/dialog/types.d.ts +0 -43
  94. package/dialog/types.js +0 -5
  95. package/dropdown/Dropdown.d.ts +0 -4
  96. package/dropdown/Dropdown.js +0 -391
  97. package/dropdown/Dropdown.stories.tsx +0 -249
  98. package/dropdown/Dropdown.test.js +0 -189
  99. package/dropdown/types.d.ts +0 -80
  100. package/dropdown/types.js +0 -5
  101. package/file-input/FileInput.d.ts +0 -4
  102. package/file-input/FileInput.js +0 -590
  103. package/file-input/FileInput.stories.tsx +0 -507
  104. package/file-input/FileInput.test.js +0 -457
  105. package/file-input/FileItem.d.ts +0 -14
  106. package/file-input/FileItem.js +0 -184
  107. package/file-input/types.d.ts +0 -112
  108. package/file-input/types.js +0 -5
  109. package/footer/Footer.d.ts +0 -4
  110. package/footer/Footer.js +0 -183
  111. package/footer/Footer.stories.tsx +0 -130
  112. package/footer/Footer.test.js +0 -109
  113. package/footer/Icons.d.ts +0 -2
  114. package/footer/Icons.js +0 -77
  115. package/footer/types.d.ts +0 -65
  116. package/footer/types.js +0 -5
  117. package/header/Header.d.ts +0 -7
  118. package/header/Header.js +0 -300
  119. package/header/Header.stories.tsx +0 -172
  120. package/header/Header.test.js +0 -79
  121. package/header/Icons.d.ts +0 -2
  122. package/header/Icons.js +0 -34
  123. package/header/types.d.ts +0 -47
  124. package/header/types.js +0 -5
  125. package/heading/Heading.d.ts +0 -4
  126. package/heading/Heading.js +0 -159
  127. package/heading/Heading.stories.tsx +0 -54
  128. package/heading/Heading.test.js +0 -186
  129. package/heading/types.d.ts +0 -33
  130. package/heading/types.js +0 -5
  131. package/inset/Inset.d.ts +0 -3
  132. package/inset/Inset.js +0 -84
  133. package/inset/Inset.stories.tsx +0 -229
  134. package/inset/types.d.ts +0 -37
  135. package/inset/types.js +0 -5
  136. package/layout/ApplicationLayout.d.ts +0 -10
  137. package/layout/ApplicationLayout.js +0 -218
  138. package/layout/ApplicationLayout.stories.tsx +0 -171
  139. package/layout/Icons.js +0 -55
  140. package/layout/types.d.ts +0 -57
  141. package/layout/types.js +0 -5
  142. package/link/Link.d.ts +0 -4
  143. package/link/Link.js +0 -162
  144. package/link/Link.stories.tsx +0 -186
  145. package/link/Link.test.js +0 -83
  146. package/link/types.d.ts +0 -55
  147. package/link/types.js +0 -5
  148. package/list/List.d.ts +0 -4
  149. package/list/List.js +0 -47
  150. package/list/List.stories.tsx +0 -95
  151. package/list/types.d.ts +0 -7
  152. package/list/types.js +0 -5
  153. package/main.d.ts +0 -47
  154. package/main.js +0 -387
  155. package/number-input/NumberInput.d.ts +0 -4
  156. package/number-input/NumberInput.js +0 -76
  157. package/number-input/NumberInput.stories.tsx +0 -115
  158. package/number-input/NumberInput.test.js +0 -506
  159. package/number-input/NumberInputContext.d.ts +0 -4
  160. package/number-input/NumberInputContext.js +0 -19
  161. package/number-input/numberInputContextTypes.d.ts +0 -19
  162. package/number-input/numberInputContextTypes.js +0 -5
  163. package/number-input/types.d.ts +0 -124
  164. package/number-input/types.js +0 -5
  165. package/paginator/Icons.js +0 -66
  166. package/paginator/Paginator.d.ts +0 -4
  167. package/paginator/Paginator.js +0 -192
  168. package/paginator/Paginator.stories.tsx +0 -63
  169. package/paginator/Paginator.test.js +0 -266
  170. package/paginator/types.d.ts +0 -38
  171. package/paginator/types.js +0 -5
  172. package/password-input/PasswordInput.d.ts +0 -4
  173. package/password-input/PasswordInput.js +0 -163
  174. package/password-input/PasswordInput.stories.tsx +0 -131
  175. package/password-input/PasswordInput.test.js +0 -181
  176. package/password-input/types.d.ts +0 -110
  177. package/password-input/types.js +0 -5
  178. package/progress-bar/ProgressBar.d.ts +0 -4
  179. package/progress-bar/ProgressBar.js +0 -170
  180. package/progress-bar/ProgressBar.stories.jsx +0 -58
  181. package/progress-bar/ProgressBar.test.js +0 -65
  182. package/progress-bar/types.d.ts +0 -37
  183. package/progress-bar/types.js +0 -5
  184. package/quick-nav/QuickNav.d.ts +0 -4
  185. package/quick-nav/QuickNav.js +0 -64
  186. package/quick-nav/QuickNav.stories.tsx +0 -237
  187. package/quick-nav/types.d.ts +0 -21
  188. package/quick-nav/types.js +0 -5
  189. package/quick-nav-container/HeadingLink.d.ts +0 -8
  190. package/quick-nav-container/HeadingLink.js +0 -58
  191. package/quick-nav-container/QuickNavContainer.d.ts +0 -4
  192. package/quick-nav-container/QuickNavContainer.js +0 -69
  193. package/quick-nav-container/Section.d.ts +0 -9
  194. package/quick-nav-container/Section.js +0 -37
  195. package/quick-nav-container/types.d.ts +0 -34
  196. package/quick-nav-container/types.js +0 -5
  197. package/radio/Radio.d.ts +0 -4
  198. package/radio/Radio.js +0 -173
  199. package/radio/Radio.stories.tsx +0 -192
  200. package/radio/Radio.test.js +0 -71
  201. package/radio/types.d.ts +0 -54
  202. package/radio/types.js +0 -5
  203. package/radio-group/Radio.d.ts +0 -4
  204. package/radio-group/Radio.js +0 -141
  205. package/radio-group/RadioGroup.d.ts +0 -4
  206. package/radio-group/RadioGroup.js +0 -280
  207. package/radio-group/RadioGroup.stories.tsx +0 -100
  208. package/radio-group/RadioGroup.test.js +0 -695
  209. package/radio-group/types.d.ts +0 -114
  210. package/radio-group/types.js +0 -5
  211. package/resultsetTable/ResultsetTable.d.ts +0 -4
  212. package/resultsetTable/ResultsetTable.js +0 -254
  213. package/resultsetTable/ResultsetTable.stories.tsx +0 -275
  214. package/resultsetTable/ResultsetTable.test.js +0 -306
  215. package/resultsetTable/types.d.ts +0 -67
  216. package/resultsetTable/types.js +0 -5
  217. package/row/Row.d.ts +0 -3
  218. package/row/Row.js +0 -127
  219. package/row/Row.stories.tsx +0 -237
  220. package/row/types.d.ts +0 -28
  221. package/row/types.js +0 -5
  222. package/select/Icons.d.ts +0 -10
  223. package/select/Icons.js +0 -93
  224. package/select/Listbox.d.ts +0 -4
  225. package/select/Listbox.js +0 -148
  226. package/select/Option.d.ts +0 -4
  227. package/select/Option.js +0 -110
  228. package/select/Select.d.ts +0 -4
  229. package/select/Select.js +0 -655
  230. package/select/Select.stories.tsx +0 -582
  231. package/select/Select.test.js +0 -2057
  232. package/select/types.d.ts +0 -213
  233. package/select/types.js +0 -5
  234. package/sidenav/Sidenav.d.ts +0 -9
  235. package/sidenav/Sidenav.js +0 -136
  236. package/sidenav/Sidenav.stories.tsx +0 -182
  237. package/sidenav/Sidenav.test.js +0 -56
  238. package/sidenav/types.d.ts +0 -50
  239. package/sidenav/types.js +0 -5
  240. package/slider/Slider.d.ts +0 -4
  241. package/slider/Slider.js +0 -318
  242. package/slider/Slider.stories.tsx +0 -177
  243. package/slider/Slider.test.js +0 -150
  244. package/slider/types.d.ts +0 -82
  245. package/slider/types.js +0 -5
  246. package/spinner/Spinner.d.ts +0 -4
  247. package/spinner/Spinner.js +0 -250
  248. package/spinner/Spinner.stories.jsx +0 -103
  249. package/spinner/Spinner.test.js +0 -64
  250. package/spinner/types.d.ts +0 -32
  251. package/spinner/types.js +0 -5
  252. package/stack/Stack.d.ts +0 -3
  253. package/stack/Stack.js +0 -97
  254. package/stack/Stack.stories.tsx +0 -164
  255. package/stack/types.d.ts +0 -24
  256. package/stack/types.js +0 -5
  257. package/switch/Switch.d.ts +0 -4
  258. package/switch/Switch.js +0 -192
  259. package/switch/Switch.stories.tsx +0 -160
  260. package/switch/Switch.test.js +0 -98
  261. package/switch/types.d.ts +0 -62
  262. package/switch/types.js +0 -5
  263. package/table/Table.d.ts +0 -4
  264. package/table/Table.js +0 -118
  265. package/table/Table.stories.jsx +0 -277
  266. package/table/Table.test.js +0 -26
  267. package/table/types.d.ts +0 -21
  268. package/table/types.js +0 -5
  269. package/tabs/Tabs.d.ts +0 -4
  270. package/tabs/Tabs.js +0 -211
  271. package/tabs/Tabs.stories.tsx +0 -112
  272. package/tabs/Tabs.test.js +0 -140
  273. package/tabs/types.d.ts +0 -82
  274. package/tabs/types.js +0 -5
  275. package/tag/Tag.d.ts +0 -4
  276. package/tag/Tag.js +0 -183
  277. package/tag/Tag.stories.tsx +0 -142
  278. package/tag/Tag.test.js +0 -60
  279. package/tag/types.d.ts +0 -69
  280. package/tag/types.js +0 -5
  281. package/text/Text.d.ts +0 -7
  282. package/text/Text.js +0 -30
  283. package/text/Text.stories.tsx +0 -19
  284. package/text-input/TextInput.d.ts +0 -4
  285. package/text-input/TextInput.js +0 -796
  286. package/text-input/TextInput.stories.tsx +0 -474
  287. package/text-input/TextInput.test.js +0 -1712
  288. package/text-input/types.d.ts +0 -166
  289. package/text-input/types.js +0 -5
  290. package/textarea/Textarea.d.ts +0 -4
  291. package/textarea/Textarea.js +0 -286
  292. package/textarea/Textarea.stories.jsx +0 -157
  293. package/textarea/Textarea.test.js +0 -437
  294. package/textarea/types.d.ts +0 -137
  295. package/textarea/types.js +0 -5
  296. package/toggle-group/ToggleGroup.d.ts +0 -4
  297. package/toggle-group/ToggleGroup.js +0 -215
  298. package/toggle-group/ToggleGroup.stories.tsx +0 -173
  299. package/toggle-group/ToggleGroup.test.js +0 -156
  300. package/toggle-group/types.d.ts +0 -105
  301. package/toggle-group/types.js +0 -5
  302. package/useTheme.d.ts +0 -2
  303. package/useTheme.js +0 -22
  304. package/wizard/Wizard.d.ts +0 -4
  305. package/wizard/Wizard.js +0 -290
  306. package/wizard/Wizard.stories.tsx +0 -214
  307. package/wizard/Wizard.test.js +0 -141
  308. package/wizard/types.d.ts +0 -64
  309. package/wizard/types.js +0 -5
package/select/Select.js DELETED
@@ -1,655 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- var _typeof3 = require("@babel/runtime/helpers/typeof");
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports["default"] = void 0;
11
-
12
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
13
-
14
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
15
-
16
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
17
-
18
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
19
-
20
- var _react = _interopRequireWildcard(require("react"));
21
-
22
- var _styledComponents = _interopRequireWildcard(require("styled-components"));
23
-
24
- var _useTheme = _interopRequireDefault(require("../useTheme"));
25
-
26
- var _variables = require("../common/variables.js");
27
-
28
- var _uuid = require("uuid");
29
-
30
- var _utils = require("../common/utils.js");
31
-
32
- var _Icons = _interopRequireDefault(require("./Icons"));
33
-
34
- var _Listbox = _interopRequireDefault(require("./Listbox"));
35
-
36
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17;
37
-
38
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
39
-
40
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
41
-
42
- var getNotOptionalErrorMessage = function getNotOptionalErrorMessage() {
43
- return "This field is required. Please, enter a value.";
44
- };
45
-
46
- var groupsHaveOptions = function groupsHaveOptions(innerOptions) {
47
- return innerOptions[0].hasOwnProperty("options") ? innerOptions[0].options ? innerOptions.some(function (groupOption) {
48
- return groupOption.options.length > 0;
49
- }) : false : true;
50
- };
51
-
52
- var filteredGroupsHaveOptions = function filteredGroupsHaveOptions(filteredOptions) {
53
- return filteredOptions !== null && filteredOptions !== void 0 && filteredOptions[0].options ? filteredOptions.some(function (groupOption) {
54
- var _groupOption$options;
55
-
56
- return ((_groupOption$options = groupOption.options) === null || _groupOption$options === void 0 ? void 0 : _groupOption$options.length) > 0;
57
- }) : true;
58
- };
59
-
60
- var filterOptionsBySearchValue = function filterOptionsBySearchValue(options, searchValue) {
61
- if ((options === null || options === void 0 ? void 0 : options.length) > 0) {
62
- if (options[0].options) return options.map(function (optionGroup) {
63
- var group = {
64
- label: optionGroup.label,
65
- options: optionGroup.options.filter(function (option) {
66
- return option.label.toUpperCase().includes(searchValue.toUpperCase());
67
- })
68
- };
69
- return group;
70
- });else return options.filter(function (option) {
71
- return option.label.toUpperCase().includes(searchValue.toUpperCase());
72
- });
73
- }
74
- };
75
-
76
- var getLastOptionIndex = function getLastOptionIndex(options, filteredOptions, searchable, optional, multiple) {
77
- var last = 0;
78
-
79
- var reducer = function reducer(acc, current) {
80
- var _current$options;
81
-
82
- return acc + ((_current$options = current.options) === null || _current$options === void 0 ? void 0 : _current$options.length);
83
- };
84
-
85
- if (searchable && filteredOptions.length > 0) filteredOptions[0].options ? last = filteredOptions.reduce(reducer, 0) - 1 : last = filteredOptions.length - 1;else if ((options === null || options === void 0 ? void 0 : options.length) > 0) options[0].options ? last = options.reduce(reducer, 0) - 1 : last = options.length - 1;
86
- return optional && !multiple ? last + 1 : last;
87
- };
88
-
89
- var getSelectedOption = function getSelectedOption(value, options, multiple, optional, optionalItem) {
90
- var selectedOption = multiple ? [] : {};
91
- var singleSelectionIndex;
92
-
93
- if (multiple) {
94
- if ((options === null || options === void 0 ? void 0 : options.length) > 0) {
95
- options.forEach(function (option) {
96
- if (option.options) {
97
- option.options.forEach(function (singleOption) {
98
- if (value.includes(singleOption.value)) selectedOption.push(singleOption);
99
- });
100
- } else if (value.includes(option.value)) selectedOption.push(option);
101
- });
102
- }
103
- } else {
104
- if (optional && value === "") {
105
- selectedOption = optionalItem;
106
- singleSelectionIndex = 0;
107
- } else if ((options === null || options === void 0 ? void 0 : options.length) > 0) {
108
- var group_index = 0;
109
- options.some(function (option, index) {
110
- if (option.options) {
111
- option.options.some(function (singleOption) {
112
- if (singleOption.value === value) {
113
- selectedOption = singleOption;
114
- singleSelectionIndex = optional ? group_index + 1 : group_index;
115
- return true;
116
- }
117
-
118
- group_index++;
119
- });
120
- } else if (option.value === value) {
121
- selectedOption = option;
122
- singleSelectionIndex = optional ? index + 1 : index;
123
- return true;
124
- }
125
- });
126
- }
127
- }
128
-
129
- return {
130
- selectedOption: selectedOption,
131
- singleSelectionIndex: singleSelectionIndex
132
- };
133
- };
134
-
135
- var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
136
- var _selectedOption$label;
137
-
138
- var label = _ref.label,
139
- _ref$name = _ref.name,
140
- name = _ref$name === void 0 ? "" : _ref$name,
141
- defaultValue = _ref.defaultValue,
142
- value = _ref.value,
143
- options = _ref.options,
144
- helperText = _ref.helperText,
145
- _ref$placeholder = _ref.placeholder,
146
- placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
147
- _ref$disabled = _ref.disabled,
148
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
149
- _ref$optional = _ref.optional,
150
- optional = _ref$optional === void 0 ? false : _ref$optional,
151
- _ref$searchable = _ref.searchable,
152
- searchable = _ref$searchable === void 0 ? false : _ref$searchable,
153
- _ref$multiple = _ref.multiple,
154
- multiple = _ref$multiple === void 0 ? false : _ref$multiple,
155
- onChange = _ref.onChange,
156
- onBlur = _ref.onBlur,
157
- error = _ref.error,
158
- margin = _ref.margin,
159
- _ref$size = _ref.size,
160
- size = _ref$size === void 0 ? "medium" : _ref$size,
161
- _ref$tabIndex = _ref.tabIndex,
162
- tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
163
-
164
- var _useState = (0, _react.useState)("select-".concat((0, _uuid.v4)())),
165
- _useState2 = (0, _slicedToArray2["default"])(_useState, 1),
166
- selectId = _useState2[0];
167
-
168
- var selectLabelId = "label-".concat(selectId);
169
- var errorId = "error-".concat(selectId);
170
- var optionsListId = "".concat(selectId, "-listbox");
171
-
172
- var _useState3 = (0, _react.useState)(defaultValue !== null && defaultValue !== void 0 ? defaultValue : multiple ? [] : ""),
173
- _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
174
- innerValue = _useState4[0],
175
- setInnerValue = _useState4[1];
176
-
177
- var _useState5 = (0, _react.useState)(""),
178
- _useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
179
- searchValue = _useState6[0],
180
- setSearchValue = _useState6[1];
181
-
182
- var _useState7 = (0, _react.useState)(-1),
183
- _useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
184
- visualFocusIndex = _useState8[0],
185
- changeVisualFocusIndex = _useState8[1];
186
-
187
- var _useState9 = (0, _react.useState)(false),
188
- _useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
189
- isOpen = _useState10[0],
190
- changeIsOpen = _useState10[1];
191
-
192
- var selectContainerRef = (0, _react.useRef)(null);
193
- var selectSearchInputRef = (0, _react.useRef)(null);
194
- var selectOptionsListRef = (0, _react.useRef)(null);
195
- var colorsTheme = (0, _useTheme["default"])();
196
- var optionalItem = {
197
- label: placeholder,
198
- value: ""
199
- };
200
- var filteredOptions = (0, _react.useMemo)(function () {
201
- return filterOptionsBySearchValue(options, searchValue);
202
- }, [options, searchValue]);
203
- var lastOptionIndex = (0, _react.useMemo)(function () {
204
- return getLastOptionIndex(options, filteredOptions, searchable, optional, multiple);
205
- }, [options, filteredOptions, searchable, optional, multiple]);
206
-
207
- var _useMemo = (0, _react.useMemo)(function () {
208
- return getSelectedOption(value !== null && value !== void 0 ? value : innerValue, options, multiple, optional, optionalItem);
209
- }, [value, innerValue, options, multiple, optional, optionalItem]),
210
- selectedOption = _useMemo.selectedOption,
211
- singleSelectionIndex = _useMemo.singleSelectionIndex;
212
-
213
- var notOptionalCheck = function notOptionalCheck(value) {
214
- return !optional && value === "";
215
- };
216
-
217
- var notOptionalMultipleCheck = function notOptionalMultipleCheck(value) {
218
- return !optional && value.length === 0;
219
- };
220
-
221
- var canBeOpenOptions = function canBeOpenOptions() {
222
- return !disabled && (options === null || options === void 0 ? void 0 : options.length) > 0 && groupsHaveOptions(options);
223
- };
224
-
225
- var openOptions = function openOptions() {
226
- if (!isOpen && canBeOpenOptions()) changeIsOpen(true);
227
- };
228
-
229
- var closeOptions = function closeOptions() {
230
- if (isOpen) {
231
- changeIsOpen(false);
232
- changeVisualFocusIndex(-1);
233
- }
234
- };
235
-
236
- var handleSelectChangeValue = function handleSelectChangeValue(newOption) {
237
- if (multiple) {
238
- var res = [];
239
- if ((value !== null && value !== void 0 ? value : innerValue).includes(newOption.value)) res = (value !== null && value !== void 0 ? value : innerValue).filter(function (optionVal) {
240
- return optionVal !== newOption.value;
241
- });else res = [].concat((0, _toConsumableArray2["default"])(value !== null && value !== void 0 ? value : innerValue), [newOption.value]);
242
- value !== null && value !== void 0 ? value : setInnerValue(res);
243
- if (notOptionalMultipleCheck(res)) onChange === null || onChange === void 0 ? void 0 : onChange({
244
- value: res,
245
- error: getNotOptionalErrorMessage()
246
- });else onChange === null || onChange === void 0 ? void 0 : onChange({
247
- value: res
248
- });
249
- } else {
250
- value !== null && value !== void 0 ? value : setInnerValue(newOption.value);
251
- if (notOptionalCheck(newOption.value)) onChange === null || onChange === void 0 ? void 0 : onChange({
252
- value: newOption.value,
253
- error: getNotOptionalErrorMessage()
254
- });else onChange === null || onChange === void 0 ? void 0 : onChange({
255
- value: newOption.value
256
- });
257
- }
258
- };
259
-
260
- var handleSelectOnClick = function handleSelectOnClick() {
261
- searchable && selectSearchInputRef.current.focus();
262
-
263
- if (isOpen) {
264
- closeOptions();
265
- setSearchValue("");
266
- } else openOptions();
267
- };
268
-
269
- var handleSelectOnFocus = function handleSelectOnFocus(event) {
270
- if (!event.currentTarget.contains(event.relatedTarget)) searchable && selectSearchInputRef.current.focus();
271
- };
272
-
273
- var handleSelectOnBlur = function handleSelectOnBlur(event) {
274
- // focus leaves container (outside, not to childs)
275
- if (!event.currentTarget.contains(event.relatedTarget)) {
276
- closeOptions();
277
- setSearchValue("");
278
- if (notOptionalCheck(value !== null && value !== void 0 ? value : innerValue)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
279
- value: value !== null && value !== void 0 ? value : innerValue,
280
- error: getNotOptionalErrorMessage()
281
- });else onBlur === null || onBlur === void 0 ? void 0 : onBlur({
282
- value: value !== null && value !== void 0 ? value : innerValue
283
- });
284
- }
285
- };
286
-
287
- var handleSelectOnKeyDown = function handleSelectOnKeyDown(event) {
288
- switch (event.keyCode) {
289
- case 40:
290
- // Arrow Down
291
- event.preventDefault();
292
- singleSelectionIndex !== undefined && (!isOpen || visualFocusIndex === -1 && singleSelectionIndex > -1 && singleSelectionIndex <= lastOptionIndex) ? changeVisualFocusIndex(singleSelectionIndex) : changeVisualFocusIndex(function (visualFocusIndex) {
293
- if (visualFocusIndex < lastOptionIndex) return visualFocusIndex + 1;else if (visualFocusIndex === lastOptionIndex) return 0;
294
- });
295
- openOptions();
296
- break;
297
-
298
- case 38:
299
- // Arrow Up
300
- event.preventDefault();
301
- singleSelectionIndex !== undefined && (!isOpen || visualFocusIndex === -1 && singleSelectionIndex > -1 && singleSelectionIndex <= lastOptionIndex) ? changeVisualFocusIndex(singleSelectionIndex) : changeVisualFocusIndex(function (visualFocusIndex) {
302
- return visualFocusIndex === 0 || visualFocusIndex === -1 ? lastOptionIndex : visualFocusIndex - 1;
303
- });
304
- openOptions();
305
- break;
306
-
307
- case 27:
308
- // Esc
309
- event.preventDefault();
310
- closeOptions();
311
- setSearchValue("");
312
- break;
313
-
314
- case 13:
315
- // Enter
316
- if (isOpen && visualFocusIndex >= 0) {
317
- var accLength = optional && !multiple ? 1 : 0;
318
-
319
- if (searchable) {
320
- if (filteredOptions.length > 0) {
321
- if (optional && !multiple && visualFocusIndex === 0 && filteredGroupsHaveOptions(filteredOptions)) handleSelectChangeValue(optionalItem);else filteredOptions[0].options ? filteredGroupsHaveOptions(filteredOptions) && filteredOptions.some(function (groupOption) {
322
- var groupLength = accLength + groupOption.options.length;
323
- groupLength > visualFocusIndex && handleSelectChangeValue(groupOption.options[visualFocusIndex - accLength]);
324
- accLength = groupLength;
325
- return groupLength > visualFocusIndex;
326
- }) : handleSelectChangeValue(filteredOptions[visualFocusIndex - accLength]);
327
- }
328
- } else {
329
- if (optional && !multiple && visualFocusIndex === 0) handleSelectChangeValue(optionalItem);else options[0].options ? options.some(function (groupOption) {
330
- var groupLength = accLength + groupOption.options.length;
331
- groupLength > visualFocusIndex && handleSelectChangeValue(groupOption.options[visualFocusIndex - accLength]);
332
- accLength = groupLength;
333
- return groupLength > visualFocusIndex;
334
- }) : handleSelectChangeValue(options[visualFocusIndex - accLength]);
335
- }
336
-
337
- !multiple && closeOptions();
338
- setSearchValue("");
339
- }
340
-
341
- break;
342
- }
343
- };
344
-
345
- var handleSearchIOnChange = function handleSearchIOnChange(event) {
346
- setSearchValue(event.target.value);
347
- changeVisualFocusIndex(-1);
348
- openOptions();
349
- };
350
-
351
- var handleClearOptionsActionOnClick = function handleClearOptionsActionOnClick(event) {
352
- event.stopPropagation();
353
- value !== null && value !== void 0 ? value : setInnerValue([]);
354
- !optional ? onChange === null || onChange === void 0 ? void 0 : onChange({
355
- value: [],
356
- error: getNotOptionalErrorMessage()
357
- }) : onChange === null || onChange === void 0 ? void 0 : onChange({
358
- value: []
359
- });
360
- };
361
-
362
- var handleClearSearchActionOnClick = function handleClearSearchActionOnClick(event) {
363
- event.stopPropagation();
364
- setSearchValue("");
365
- };
366
-
367
- var handleOptionOnClick = (0, _react.useCallback)(function (option) {
368
- handleSelectChangeValue(option);
369
- !multiple && closeOptions();
370
- setSearchValue("");
371
- }, [handleSelectChangeValue, closeOptions, multiple]);
372
- (0, _react.useLayoutEffect)(function () {
373
- if (isOpen && singleSelectionIndex) {
374
- var _listEl$scrollTo;
375
-
376
- var listEl = selectOptionsListRef === null || selectOptionsListRef === void 0 ? void 0 : selectOptionsListRef.current;
377
- var selectedListOptionEl = listEl === null || listEl === void 0 ? void 0 : listEl.querySelector("[aria-selected='true']");
378
- listEl === null || listEl === void 0 ? void 0 : (_listEl$scrollTo = listEl.scrollTo) === null || _listEl$scrollTo === void 0 ? void 0 : _listEl$scrollTo.call(listEl, {
379
- top: (selectedListOptionEl === null || selectedListOptionEl === void 0 ? void 0 : selectedListOptionEl.offsetTop) - (listEl === null || listEl === void 0 ? void 0 : listEl.clientHeight) / 2
380
- });
381
- }
382
- }, [isOpen]);
383
- (0, _react.useLayoutEffect)(function () {
384
- var _selectOptionsListRef, _visualFocusedOptionE;
385
-
386
- var visualFocusedOptionEl = selectOptionsListRef === null || selectOptionsListRef === void 0 ? void 0 : (_selectOptionsListRef = selectOptionsListRef.current) === null || _selectOptionsListRef === void 0 ? void 0 : _selectOptionsListRef.querySelectorAll("[role='option']")[visualFocusIndex];
387
- visualFocusedOptionEl === null || visualFocusedOptionEl === void 0 ? void 0 : (_visualFocusedOptionE = visualFocusedOptionEl.scrollIntoView) === null || _visualFocusedOptionE === void 0 ? void 0 : _visualFocusedOptionE.call(visualFocusedOptionEl, {
388
- block: "nearest",
389
- inline: "start"
390
- });
391
- }, [visualFocusIndex]);
392
- return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
393
- theme: colorsTheme.select
394
- }, /*#__PURE__*/_react["default"].createElement(SelectContainer, {
395
- margin: margin,
396
- size: size,
397
- ref: ref
398
- }, label && /*#__PURE__*/_react["default"].createElement(Label, {
399
- id: selectLabelId,
400
- disabled: disabled,
401
- onClick: function onClick() {
402
- selectContainerRef.current.focus();
403
- },
404
- helperText: helperText
405
- }, label, " ", optional && /*#__PURE__*/_react["default"].createElement(OptionalLabel, null, "(Optional)")), helperText && /*#__PURE__*/_react["default"].createElement(HelperText, {
406
- disabled: disabled
407
- }, helperText), /*#__PURE__*/_react["default"].createElement(Select, {
408
- id: selectId,
409
- disabled: disabled,
410
- error: error,
411
- onBlur: handleSelectOnBlur,
412
- onClick: handleSelectOnClick,
413
- onFocus: handleSelectOnFocus,
414
- onKeyDown: handleSelectOnKeyDown,
415
- ref: selectContainerRef,
416
- tabIndex: tabIndex,
417
- role: "combobox",
418
- "aria-controls": optionsListId,
419
- "aria-disabled": disabled,
420
- "aria-expanded": isOpen,
421
- "aria-haspopup": "listbox",
422
- "aria-labelledby": selectLabelId,
423
- "aria-activedescendant": visualFocusIndex >= 0 ? "option-".concat(visualFocusIndex) : undefined,
424
- "aria-invalid": error ? "true" : "false",
425
- "aria-errormessage": error ? errorId : undefined,
426
- "aria-required": !disabled && !optional
427
- }, multiple && selectedOption.length > 0 && /*#__PURE__*/_react["default"].createElement(SelectionIndicator, null, /*#__PURE__*/_react["default"].createElement(SelectionNumber, {
428
- disabled: disabled
429
- }, selectedOption.length), /*#__PURE__*/_react["default"].createElement(ClearOptionsAction, {
430
- disabled: disabled,
431
- onMouseDown: function onMouseDown(event) {
432
- // Avoid input to lose focus when pressed
433
- event.preventDefault();
434
- },
435
- onClick: handleClearOptionsActionOnClick,
436
- tabIndex: -1,
437
- title: "Clear selection",
438
- "aria-label": "Clear selection"
439
- }, _Icons["default"].clear)), /*#__PURE__*/_react["default"].createElement(SearchableValueContainer, null, /*#__PURE__*/_react["default"].createElement(ValueInput, {
440
- name: name,
441
- value: multiple ? (value !== null && value !== void 0 ? value : innerValue).join(",") : value !== null && value !== void 0 ? value : innerValue,
442
- readOnly: true,
443
- "aria-hidden": "true"
444
- }), searchable && /*#__PURE__*/_react["default"].createElement(SearchInput, {
445
- value: searchValue,
446
- disabled: disabled,
447
- onChange: handleSearchIOnChange,
448
- ref: selectSearchInputRef,
449
- autoComplete: "nope",
450
- autoCorrect: "nope",
451
- size: 1
452
- }), (!searchable || searchValue === "") && (multiple ? /*#__PURE__*/_react["default"].createElement(SelectedOption, {
453
- disabled: disabled,
454
- atBackground: (value !== null && value !== void 0 ? value : innerValue).length === 0 || searchable && isOpen
455
- }, /*#__PURE__*/_react["default"].createElement(SelectedOptionLabel, null, selectedOption.map(function (option) {
456
- return option.label;
457
- }).join(", ")), selectedOption.length === 0 && placeholder) : /*#__PURE__*/_react["default"].createElement(SelectedOption, {
458
- disabled: disabled,
459
- atBackground: !(value !== null && value !== void 0 ? value : innerValue) || searchable && isOpen
460
- }, /*#__PURE__*/_react["default"].createElement(SelectedOptionLabel, null, (_selectedOption$label = selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label) !== null && _selectedOption$label !== void 0 ? _selectedOption$label : placeholder)))), !disabled && error && /*#__PURE__*/_react["default"].createElement(ErrorIcon, null, _Icons["default"].error), searchable && searchValue.length > 0 && /*#__PURE__*/_react["default"].createElement(ClearSearchAction, {
461
- onMouseDown: function onMouseDown(event) {
462
- // Avoid input to lose focus
463
- event.preventDefault();
464
- },
465
- onClick: handleClearSearchActionOnClick,
466
- tabIndex: -1,
467
- title: "Clear search",
468
- "aria-label": "Clear search"
469
- }, _Icons["default"].clear), /*#__PURE__*/_react["default"].createElement(CollapseIndicator, {
470
- disabled: disabled
471
- }, isOpen ? _Icons["default"].arrowUp : _Icons["default"].arrowDown), isOpen && /*#__PURE__*/_react["default"].createElement(_Listbox["default"], {
472
- id: optionsListId,
473
- currentValue: value !== null && value !== void 0 ? value : innerValue,
474
- options: searchable ? filteredOptions : options,
475
- visualFocusIndex: visualFocusIndex,
476
- lastOptionIndex: lastOptionIndex,
477
- multiple: multiple,
478
- optional: optional,
479
- optionalItem: optionalItem,
480
- searchable: searchable,
481
- handleOptionOnClick: handleOptionOnClick,
482
- ref: selectOptionsListRef
483
- })), !disabled && typeof error === "string" && /*#__PURE__*/_react["default"].createElement(Error, {
484
- id: errorId,
485
- "aria-live": error ? "assertive" : "off"
486
- }, error)));
487
- });
488
-
489
- var sizes = {
490
- small: "240px",
491
- medium: "360px",
492
- large: "480px",
493
- fillParent: "100%"
494
- };
495
-
496
- var calculateWidth = function calculateWidth(margin, size) {
497
- return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
498
- };
499
-
500
- var SelectContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n box-sizing: border-box;\n\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
501
- return calculateWidth(props.margin, props.size);
502
- }, function (props) {
503
- return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
504
- }, function (props) {
505
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
506
- }, function (props) {
507
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.right ? _variables.spaces[props.margin.right] : "";
508
- }, function (props) {
509
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
510
- }, function (props) {
511
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
512
- });
513
-
514
- var Label = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n cursor: default;\n ", "\n"])), function (props) {
515
- return props.disabled ? props.theme.disabledColor : props.theme.labelFontColor;
516
- }, function (props) {
517
- return props.theme.fontFamily;
518
- }, function (props) {
519
- return props.theme.labelFontSize;
520
- }, function (props) {
521
- return props.theme.labelFontStyle;
522
- }, function (props) {
523
- return props.theme.labelFontWeight;
524
- }, function (props) {
525
- return props.theme.labelLineHeight;
526
- }, function (props) {
527
- return !props.helperText && "margin-bottom: 0.25rem";
528
- });
529
-
530
- var OptionalLabel = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n font-weight: ", ";\n"])), function (props) {
531
- return props.theme.optionalLabelFontWeight;
532
- });
533
-
534
- var HelperText = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n margin-bottom: 0.25rem;\n"])), function (props) {
535
- return props.disabled ? props.theme.disabledColor : props.theme.helperTextFontColor;
536
- }, function (props) {
537
- return props.theme.fontFamily;
538
- }, function (props) {
539
- return props.theme.helperTextFontSize;
540
- }, function (props) {
541
- return props.theme.helperTextFontStyle;
542
- }, function (props) {
543
- return props.theme.helperTextFontWeight;
544
- }, function (props) {
545
- return props.theme.helperTextLineHeight;
546
- });
547
-
548
- var Select = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n position: relative;\n align-items: center;\n height: calc(2.5rem - 2px);\n padding: 0 0.5rem;\n outline: none;\n ", ";\n box-shadow: 0 0 0 2px transparent;\n border-radius: 4px;\n border: 1px solid\n ", ";\n ", "\n ", ";\n\n ", ";\n"])), function (props) {
549
- return props.disabled && "background-color: ".concat(props.theme.disabledInputBackgroundColor);
550
- }, function (props) {
551
- return props.disabled ? props.theme.disabledInputBorderColor : props.theme.enabledInputBorderColor;
552
- }, function (props) {
553
- return props.error && !props.disabled && "border-color: transparent;\n box-shadow: 0 0 0 2px ".concat(props.theme.errorInputBorderColor, ";\n ");
554
- }, function (props) {
555
- return props.disabled ? "cursor: not-allowed;" : "cursor: pointer;";
556
- }, function (props) {
557
- return !props.disabled && "\n &:hover {\n border-color: ".concat(props.error ? "transparent" : props.theme.hoverInputBorderColor, ";\n ").concat(props.error && "box-shadow: 0 0 0 2px ".concat(props.theme.hoverInputErrorBorderColor, ";"), "\n }\n &:focus-within {\n border-color: transparent;\n box-shadow: 0 0 0 2px ").concat(props.theme.focusInputBorderColor, ";\n }\n ");
558
- });
559
-
560
- var SelectionIndicator = _styledComponents["default"].span(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n border: 1px solid ", ";\n border-radius: 2px;\n max-height: 22px;\n width: 46px;\n"])), function (props) {
561
- return props.theme.selectionIndicatorBorderColor;
562
- });
563
-
564
- var SelectionNumber = _styledComponents["default"].span(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n width: 22px;\n height: 22px;\n user-select: none;\n ", ";\n border-right: 1px solid ", ";\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n ", "\n"])), function (props) {
565
- return !props.disabled && "background-color: ".concat(props.theme.selectionIndicatorBackgroundColor);
566
- }, function (props) {
567
- return props.theme.selectionIndicatorBorderColor;
568
- }, function (props) {
569
- return props.disabled ? props.theme.disabledColor : props.theme.selectionIndicatorFontColor;
570
- }, function (props) {
571
- return props.theme.fontFamily;
572
- }, function (props) {
573
- return props.theme.selectionIndicatorFontSize;
574
- }, function (props) {
575
- return props.theme.selectionIndicatorFontStyle;
576
- }, function (props) {
577
- return props.theme.selectionIndicatorFontWeight;
578
- }, function (props) {
579
- return props.disabled ? "cursor: not-allowed;" : "cursor: default;";
580
- });
581
-
582
- var ClearOptionsAction = _styledComponents["default"].button(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n width: 23px;\n height: 22px;\n font-size: 1rem;\n font-family: ", ";\n border: none;\n padding: 0.25rem;\n ", "\n background-color: ", ";\n color: ", ";\n\n :focus-visible {\n outline: none;\n }\n ", "\n\n svg {\n line-height: 18px;\n }\n"])), function (props) {
583
- return props.theme.fontFamily;
584
- }, function (props) {
585
- return props.disabled ? "cursor: not-allowed;" : "cursor: pointer;";
586
- }, function (props) {
587
- return props.disabled ? "transparent" : props.theme.enabledSelectionIndicatorActionBackgroundColor;
588
- }, function (props) {
589
- return props.disabled ? props.theme.disabledColor : props.theme.enabledSelectionIndicatorActionIconColor;
590
- }, function (props) {
591
- return !props.disabled && "\n &:hover {\n background-color: ".concat(props.theme.hoverSelectionIndicatorActionBackgroundColor, ";\n color: ").concat(props.theme.hoverSelectionIndicatorActionIconColor, ";\n }\n &:active {\n background-color: ").concat(props.theme.activeSelectionIndicatorActionBackgroundColor, ";\n color: ").concat(props.theme.activeSelectionIndicatorActionIconColor, ";\n }\n ");
592
- });
593
-
594
- var SearchableValueContainer = _styledComponents["default"].div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n display: grid;\n width: 100%;\n"])));
595
-
596
- var SelectedOption = _styledComponents["default"].span(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n grid-area: 1 / 1 / 1 / 1;\n display: inline-flex;\n align-items: center;\n height: calc(2.5rem - 2px);\n padding: 0 0.5rem;\n user-select: none;\n overflow: hidden;\n\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n"])), function (props) {
597
- if (props.disabled) return props.theme.disabledColor;else if (props.atBackground) return props.theme.placeholderFontColor;else return props.theme.valueFontColor;
598
- }, function (props) {
599
- return props.theme.fontFamily;
600
- }, function (props) {
601
- return props.theme.valueFontSize;
602
- }, function (props) {
603
- return props.theme.valueFontStyle;
604
- }, function (props) {
605
- return props.theme.valueFontWeight;
606
- });
607
-
608
- var SelectedOptionLabel = _styledComponents["default"].span(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n"])));
609
-
610
- var ValueInput = _styledComponents["default"].input(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2["default"])(["\n display: none;\n"])));
611
-
612
- var SearchInput = _styledComponents["default"].input(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2["default"])(["\n grid-area: 1 / 1 / 1 / 1;\n height: calc(2.5rem - 2px);\n background: none;\n border: none;\n outline: none;\n padding: 0 0.5rem;\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: 1.5em;\n"])), function (props) {
613
- return props.disabled ? props.theme.disabledColor : props.theme.valueFontColor;
614
- }, function (props) {
615
- return props.theme.fontFamily;
616
- }, function (props) {
617
- return props.theme.valueFontSize;
618
- }, function (props) {
619
- return props.theme.valueFontStyle;
620
- }, function (props) {
621
- return props.theme.valueFontWeight;
622
- });
623
-
624
- var ErrorIcon = _styledComponents["default"].span(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n padding: 3px;\n height: 18px;\n width: 18px;\n margin-left: 0.25rem;\n pointer-events: none;\n color: ", ";\n\n svg {\n line-height: 18px;\n font-size: 1.25rem;\n }\n"])), function (props) {
625
- return props.theme.errorIconColor;
626
- });
627
-
628
- var Error = _styledComponents["default"].span(_templateObject15 || (_templateObject15 = (0, _taggedTemplateLiteral2["default"])(["\n min-height: 1.5em;\n color: ", ";\n font-family: ", ";\n font-size: 0.75rem;\n font-weight: 400;\n line-height: 1.5em;\n margin-top: 0.25rem;\n"])), function (props) {
629
- return props.theme.errorMessageColor;
630
- }, function (props) {
631
- return props.theme.fontFamily;
632
- });
633
-
634
- var CollapseIndicator = _styledComponents["default"].span(_templateObject16 || (_templateObject16 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 16px;\n width: 16px;\n padding: 4px;\n margin-left: 0.25rem;\n color: ", ";\n"])), function (props) {
635
- return props.disabled ? props.theme.disabledColor : props.theme.collapseIndicatorColor;
636
- });
637
-
638
- var ClearSearchAction = _styledComponents["default"].button(_templateObject17 || (_templateObject17 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 24px;\n width: 24px;\n font-size: 1rem;\n font-family: ", ";\n border: 1px solid transparent;\n border-radius: 2px;\n padding: 3px;\n margin-left: 0.25rem;\n background-color: ", ";\n color: ", ";\n\n cursor: pointer;\n &:hover {\n background-color: ", ";\n color: ", ";\n }\n &:active {\n background-color: ", ";\n color: ", ";\n }\n svg {\n line-height: 18px;\n }\n"])), function (props) {
639
- return props.theme.fontFamily;
640
- }, function (props) {
641
- return props.theme.actionBackgroundColor;
642
- }, function (props) {
643
- return props.theme.actionIconColor;
644
- }, function (props) {
645
- return props.theme.hoverActionBackgroundColor;
646
- }, function (props) {
647
- return props.theme.hoverActionIconColor;
648
- }, function (props) {
649
- return props.theme.activeActionBackgroundColor;
650
- }, function (props) {
651
- return props.theme.activeActionIconColor;
652
- });
653
-
654
- var _default = DxcSelect;
655
- exports["default"] = _default;