@stenajs-webui/select 17.4.1 → 17.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,497 +1,635 @@
1
- import * as React from 'react';
2
- import { useMemo } from 'react';
3
- import SelectComponent, { mergeStyles, components } from 'react-select';
4
- import AsyncComponent from 'react-select/async';
5
- import { faCheck } from '@fortawesome/free-solid-svg-icons/faCheck';
6
- import { Row, Space, Text, Column, Spacing } from '@stenajs-webui/core';
7
- import { Icon, Chip, FlatButton } from '@stenajs-webui/elements';
8
- import { differenceWith, isEqual, uniqWith, intersectionWith } from 'lodash';
9
-
10
- /*! *****************************************************************************
11
- Copyright (c) Microsoft Corporation.
12
-
13
- Permission to use, copy, modify, and/or distribute this software for any
14
- purpose with or without fee is hereby granted.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
17
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
18
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
19
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
20
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
21
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22
- PERFORMANCE OF THIS SOFTWARE.
23
- ***************************************************************************** */
24
-
25
- var __assign = function() {
26
- __assign = Object.assign || function __assign(t) {
27
- for (var s, i = 1, n = arguments.length; i < n; i++) {
28
- s = arguments[i];
29
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
30
- }
31
- return t;
32
- };
33
- return __assign.apply(this, arguments);
34
- };
35
-
36
- function __rest(s, e) {
37
- var t = {};
38
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
39
- t[p] = s[p];
40
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
41
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
42
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
43
- t[p[i]] = s[p[i]];
44
- }
45
- return t;
46
- }
47
-
48
- function __spreadArray(to, from, pack) {
49
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
50
- if (ar || !(i in from)) {
51
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
52
- ar[i] = from[i];
53
- }
54
- }
55
- return to.concat(ar || Array.prototype.slice.call(from));
56
- }
57
-
58
- var defaultSelectTheme = {
59
- arrowColor: {
60
- focused: {
61
- hover: "var(--lhds-color-ui-500)",
62
- standard: "var(--lhds-color-ui-500)",
63
- },
64
- closed: {
65
- hover: "var(--lhds-color-ui-500)",
66
- standard: "var(--lhds-color-ui-500)",
67
- },
68
- },
69
- clearButtonColor: {
70
- hover: "var(--lhds-color-ui-600)",
71
- standard: "var(--lhds-color-ui-500)",
72
- },
73
- input: {
74
- backgroundColor: "var(--swui-field-bg-enabled)",
75
- border: "1px solid var(--swui-select-border-color)",
76
- borderColor: "var(--swui-field-border-color)",
77
- borderColorFocused: "var(--swui-field-border-color-hover)",
78
- disabledBackgroundColor: "var(--swui-field-bg-disabled)",
79
- warningBackgroundColor: "var(--swui-state-alert-light-color)",
80
- errorBackgroundColor: "var(--swui-state-error-light-color)",
81
- successBackgroundColor: "var(--swui-state-success-light-color)",
82
- warningBorderColor: "var(--swui-state-alert-color)",
83
- errorBorderColor: "var(--swui-state-error-color)",
84
- successBorderColor: "var(--swui-state-success-color)",
85
- boxShadowFocused: "var(--swui-field-focus-shadow)",
86
- fontFamily: "var(--swui-font-primary)",
87
- fontSize: "var(--swui-font-size-inputs)",
88
- height: "32px",
89
- minHeight: "32px",
90
- placeholderColor: "var(--swui-field-border-color-disabled)",
91
- textColor: "var(--swui-field-text-color)",
92
- borderRadius: "var(--swui-field-border-radius)",
93
- },
94
- loadingIndicator: {
95
- textColor: "var(--swui-field-text-color)",
96
- },
97
- menu: {
98
- activeBackgroundColor: "var(--lhds-color-blue-100)",
99
- activeTextColor: "var(--swui-field-text-color)",
100
- selectedItemActiveBackgroundColor: "var(--lhds-color-blue-500)",
101
- selectedItemActiveTextColor: "var(--lhds-color-blue-50)",
102
- disabledTextColor: "var(--swui-field-text-color-disabled)",
103
- disabledBackgroundColor: "var(--swui-field-bg-disabled)",
104
- textColor: "var(--swui-field-text-color)",
105
- backgroundColor: "var(--swui-field-bg-enabled)",
106
- hoverTextColor: "var(--swui-field-text-color)",
107
- hoverBackgroundColor: "var(--lhds-color-blue-200)",
108
- selectedItemTextColor: "var(--lhds-color-blue-500)",
109
- selectedItemIconColor: "var(--lhds-color-blue-500)",
110
- selectedItemHoverTextColor: "var(--swui-field-text-color)",
111
- selectedItemHoverIconColor: "var(--swui-field-text-color)",
112
- selectedItemBackgroundColor: "var(--lhds-color-blue-50)",
113
- selectedItemHoverBackgroundColor: "var(--lhds-color-blue-50)",
114
- zIndex: 1,
115
- width: "auto",
116
- minWidth: "100%",
117
- whiteSpace: "nowrap",
118
- },
119
- menuPortal: {
120
- zIndex: 1,
121
- },
122
- multiSelect: {
123
- backgroundColor: "var(--swui-primary-action-color)",
124
- textColor: "var(--lhds-color-blue-50)",
125
- removeButtonBackgroundColor: "transparent",
126
- removeButtonTextColor: "var(--swui-white)",
127
- removeButtonHoverBackgroundColor: "var(--swui-primary-action-color-hover)",
128
- removeButtonHoverTextColor: "var(--swui-white)",
129
- },
1
+ (function(){ try {var elementStyle = document.createElement('style'); elementStyle.appendChild(document.createTextNode("")); document.head.appendChild(elementStyle);} catch(e) {console.error('vite-plugin-css-injected-by-js', e);} })();import * as React from "react";
2
+ import { useMemo } from "react";
3
+ import SelectComponent, { mergeStyles, components } from "react-select";
4
+ import AsyncComponent from "react-select/async";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { Row, Space, Text, Column, Spacing } from "@stenajs-webui/core";
7
+ import { Icon, stenaCheck, Chip, FlatButton } from "@stenajs-webui/elements";
8
+ import { differenceWith, isEqual, uniqWith, intersectionWith } from "lodash";
9
+ const defaultSelectTheme = {
10
+ arrowColor: {
11
+ focused: {
12
+ hover: "var(--lhds-color-ui-500)",
13
+ standard: "var(--lhds-color-ui-500)"
14
+ },
15
+ closed: {
16
+ hover: "var(--lhds-color-ui-500)",
17
+ standard: "var(--lhds-color-ui-500)"
18
+ }
19
+ },
20
+ clearButtonColor: {
21
+ hover: "var(--lhds-color-ui-600)",
22
+ standard: "var(--lhds-color-ui-500)"
23
+ },
24
+ input: {
25
+ backgroundColor: "var(--swui-field-bg-enabled)",
26
+ border: `1px solid var(--swui-select-border-color)`,
27
+ borderColor: "var(--swui-field-border-color)",
28
+ borderColorFocused: "var(--swui-field-border-color-hover)",
29
+ disabledBackgroundColor: "var(--swui-field-bg-disabled)",
30
+ warningBackgroundColor: "var(--swui-state-alert-light-color)",
31
+ errorBackgroundColor: "var(--swui-state-error-light-color)",
32
+ successBackgroundColor: "var(--swui-state-success-light-color)",
33
+ warningBorderColor: "var(--swui-state-alert-color)",
34
+ errorBorderColor: "var(--swui-state-error-color)",
35
+ successBorderColor: "var(--swui-state-success-color)",
36
+ boxShadowFocused: "var(--swui-field-focus-shadow)",
37
+ fontFamily: "var(--swui-font-primary)",
38
+ fontSize: "var(--swui-font-size-inputs)",
39
+ height: "32px",
40
+ minHeight: "32px",
41
+ placeholderColor: "var(--swui-field-border-color-disabled)",
42
+ textColor: "var(--swui-field-text-color)",
43
+ borderRadius: "var(--swui-field-border-radius)"
44
+ },
45
+ loadingIndicator: {
46
+ textColor: "var(--swui-field-text-color)"
47
+ },
48
+ menu: {
49
+ activeBackgroundColor: "var(--lhds-color-blue-100)",
50
+ activeTextColor: "var(--swui-field-text-color)",
51
+ selectedItemActiveBackgroundColor: "var(--lhds-color-blue-500)",
52
+ selectedItemActiveTextColor: "var(--lhds-color-blue-50)",
53
+ disabledTextColor: "var(--swui-field-text-color-disabled)",
54
+ disabledBackgroundColor: "var(--swui-field-bg-disabled)",
55
+ textColor: "var(--swui-field-text-color)",
56
+ backgroundColor: "var(--swui-field-bg-enabled)",
57
+ hoverTextColor: "var(--swui-field-text-color)",
58
+ hoverBackgroundColor: "var(--lhds-color-blue-200)",
59
+ selectedItemTextColor: "var(--lhds-color-blue-500)",
60
+ selectedItemIconColor: "var(--lhds-color-blue-500)",
61
+ selectedItemHoverTextColor: "var(--swui-field-text-color)",
62
+ selectedItemHoverIconColor: "var(--swui-field-text-color)",
63
+ selectedItemBackgroundColor: "var(--lhds-color-blue-50)",
64
+ selectedItemHoverBackgroundColor: "var(--lhds-color-blue-50)",
65
+ zIndex: 1,
66
+ width: "auto",
67
+ minWidth: "100%",
68
+ whiteSpace: "nowrap"
69
+ },
70
+ menuPortal: {
71
+ zIndex: 1
72
+ },
73
+ multiSelect: {
74
+ backgroundColor: "var(--swui-primary-action-color)",
75
+ textColor: "var(--lhds-color-blue-50)",
76
+ removeButtonBackgroundColor: "transparent",
77
+ removeButtonTextColor: "var(--swui-white)",
78
+ removeButtonHoverBackgroundColor: "var(--swui-primary-action-color-hover)",
79
+ removeButtonHoverTextColor: "var(--swui-white)"
80
+ }
81
+ };
82
+ const resolveOptionBackgroundColor = (colors, isDisabled, isSelected, isFocused) => {
83
+ if (isDisabled) {
84
+ return colors.disabledBackgroundColor;
85
+ } else if (isSelected && isFocused) {
86
+ return colors.selectedItemHoverBackgroundColor;
87
+ } else if (isSelected) {
88
+ return colors.selectedItemBackgroundColor;
89
+ } else if (isFocused) {
90
+ return colors.hoverBackgroundColor;
91
+ } else {
92
+ return void 0;
93
+ }
94
+ };
95
+ const resolveOptionColor = (colors, isDisabled, isSelected, isFocused) => {
96
+ if (isDisabled) {
97
+ return colors.disabledTextColor;
98
+ } else if (isSelected && isFocused) {
99
+ return colors.selectedItemHoverTextColor;
100
+ } else if (isSelected) {
101
+ return colors.selectedItemTextColor;
102
+ } else if (isFocused) {
103
+ return colors.hoverTextColor;
104
+ } else {
105
+ return void 0;
106
+ }
107
+ };
108
+ const resolveInputBackgroundColor = (colors, isDisabled, isFocused, variant) => {
109
+ if (isDisabled) {
110
+ return colors.disabledBackgroundColor;
111
+ } else if (isFocused) {
112
+ return colors.backgroundColor;
113
+ } else if (variant === "warning") {
114
+ return colors.warningBackgroundColor;
115
+ } else if (variant === "success") {
116
+ return colors.successBackgroundColor;
117
+ } else if (variant === "error") {
118
+ return colors.errorBackgroundColor;
119
+ } else {
120
+ return colors.backgroundColor;
121
+ }
122
+ };
123
+ const resolveInputBorderColor = (colors, isDisabled, isFocused, isHovered, variant) => {
124
+ if (isDisabled) {
125
+ return colors.borderColor;
126
+ } else if (isFocused) {
127
+ return colors.borderColorFocused;
128
+ } else if (variant === "warning") {
129
+ return colors.warningBorderColor;
130
+ } else if (variant === "success") {
131
+ return colors.successBorderColor;
132
+ } else if (variant === "error") {
133
+ return colors.errorBorderColor;
134
+ } else if (isHovered) {
135
+ return colors.borderColorFocused;
136
+ } else {
137
+ return colors.borderColor;
138
+ }
139
+ };
140
+ const createStylesFromTheme = ({
141
+ menu,
142
+ menuPortal,
143
+ input,
144
+ multiSelect,
145
+ clearButtonColor,
146
+ arrowColor,
147
+ loadingIndicator
148
+ }, variant) => ({
149
+ option: (base, { isDisabled, isFocused, isSelected }) => ({
150
+ ...base,
151
+ fontFamily: input.fontFamily,
152
+ fontSize: input.fontSize,
153
+ backgroundColor: resolveOptionBackgroundColor(menu, isDisabled, isSelected, isFocused),
154
+ color: resolveOptionColor(menu, isDisabled, isSelected, isFocused),
155
+ cursor: isDisabled ? "not-allowed" : "default",
156
+ whiteSpace: menu.whiteSpace || base.whiteSpace,
157
+ ":active": {
158
+ backgroundColor: isDisabled ? void 0 : isSelected ? menu.selectedItemActiveBackgroundColor : menu.activeBackgroundColor,
159
+ color: isDisabled ? void 0 : isSelected ? menu.selectedItemActiveTextColor : menu.activeTextColor
160
+ }
161
+ }),
162
+ control: (base, { isFocused, isDisabled, menuIsOpen }) => ({
163
+ ...base,
164
+ fontFamily: input.fontFamily,
165
+ fontSize: input.fontSize,
166
+ minHeight: input.minHeight,
167
+ backgroundColor: resolveInputBackgroundColor(input, isDisabled, isFocused, variant),
168
+ borderRadius: input.borderRadius,
169
+ border: input.border,
170
+ "--swui-select-border-color": resolveInputBorderColor(input, isDisabled, isFocused || menuIsOpen, false, variant),
171
+ boxShadow: isFocused ? input.boxShadowFocused : void 0,
172
+ "&:hover": {
173
+ "--swui-select-border-color": resolveInputBorderColor(input, false, isFocused || menuIsOpen, true, variant)
174
+ }
175
+ }),
176
+ singleValue: (base) => ({
177
+ ...base,
178
+ fontFamily: input.fontFamily,
179
+ fontSize: input.fontSize,
180
+ color: input.textColor
181
+ }),
182
+ noOptionsMessage: (base) => ({
183
+ ...base,
184
+ fontFamily: input.fontFamily,
185
+ fontSize: input.fontSize
186
+ }),
187
+ input: (base) => ({
188
+ ...base,
189
+ fontFamily: input.fontFamily,
190
+ fontSize: input.fontSize,
191
+ color: input.textColor
192
+ }),
193
+ groupHeading: (base) => ({
194
+ ...base,
195
+ fontFamily: input.fontFamily
196
+ }),
197
+ multiValueLabel: (base) => ({
198
+ ...base,
199
+ backgroundColor: multiSelect.backgroundColor,
200
+ color: multiSelect.textColor,
201
+ fontFamily: input.fontFamily,
202
+ fontSize: "12px"
203
+ }),
204
+ indicatorSeparator: (base) => ({
205
+ ...base,
206
+ display: "none"
207
+ }),
208
+ clearIndicator: (base) => ({
209
+ ...base,
210
+ padding: "5px",
211
+ color: clearButtonColor.standard,
212
+ "&:hover": {
213
+ color: clearButtonColor.hover
214
+ },
215
+ cursor: "pointer"
216
+ }),
217
+ placeholder: (base) => ({
218
+ ...base,
219
+ fontFamily: input.fontFamily,
220
+ fontSize: input.fontSize,
221
+ color: input.placeholderColor
222
+ }),
223
+ container: (base) => ({
224
+ ...base
225
+ }),
226
+ valueContainer: (base) => ({
227
+ ...base,
228
+ padding: "0 8px"
229
+ }),
230
+ dropdownIndicator: (base, { isFocused }) => ({
231
+ ...base,
232
+ padding: "5px",
233
+ color: isFocused ? arrowColor.focused.standard : arrowColor.closed.standard,
234
+ "&:hover": {
235
+ color: isFocused ? arrowColor.focused.hover : arrowColor.closed.hover
236
+ },
237
+ svg: {
238
+ width: 14,
239
+ height: 14
240
+ }
241
+ }),
242
+ menu: (base) => ({
243
+ ...base,
244
+ backgroundColor: menu.backgroundColor,
245
+ color: menu.textColor,
246
+ minWidth: menu.minWidth || base.minWidth,
247
+ zIndex: menu.zIndex,
248
+ width: menu.width || base.width,
249
+ border: input.border,
250
+ borderColor: input.borderColorFocused
251
+ }),
252
+ menuPortal: (base) => ({
253
+ ...base,
254
+ zIndex: menuPortal.zIndex
255
+ }),
256
+ multiValueRemove: (styles) => ({
257
+ ...styles,
258
+ backgroundColor: multiSelect.removeButtonBackgroundColor,
259
+ ":hover": {
260
+ color: multiSelect.removeButtonHoverTextColor,
261
+ backgroundColor: multiSelect.removeButtonHoverBackgroundColor
262
+ },
263
+ color: multiSelect.removeButtonTextColor,
264
+ borderRadius: "50%",
265
+ width: 16,
266
+ height: 16,
267
+ padding: 0,
268
+ margin: 3,
269
+ marginTop: 4,
270
+ display: "flex",
271
+ justifyContent: "center",
272
+ alignItems: "center",
273
+ cursor: "pointer"
274
+ }),
275
+ multiValue: (base) => ({
276
+ ...base,
277
+ backgroundColor: multiSelect.backgroundColor,
278
+ color: multiSelect.textColor,
279
+ fontFamily: input.fontFamily,
280
+ fontSize: "12px",
281
+ alignItems: "center",
282
+ margin: 0,
283
+ marginRight: 2
284
+ }),
285
+ loadingMessage: (base) => ({
286
+ ...base,
287
+ color: loadingIndicator.textColor,
288
+ fontFamily: input.fontFamily,
289
+ fontSize: input.fontSize
290
+ })
291
+ });
292
+ const createStylesFromVariant = (variant) => createStylesFromTheme(defaultSelectTheme, variant);
293
+ const AsyncMultiSelect = ({
294
+ variant = "standard",
295
+ styles,
296
+ isMulti,
297
+ ...selectProps
298
+ }) => {
299
+ const selectStyles = useMemo(() => {
300
+ const sourceStyles = createStylesFromVariant(variant);
301
+ return styles ? mergeStyles(sourceStyles, styles) : sourceStyles;
302
+ }, [variant, styles]);
303
+ return /* @__PURE__ */ jsx(AsyncComponent, {
304
+ styles: selectStyles,
305
+ ...selectProps,
306
+ isMulti: true
307
+ });
130
308
  };
131
-
132
- var resolveOptionBackgroundColor = function (colors, isDisabled, isSelected, isFocused) {
133
- if (isDisabled) {
134
- return colors.disabledBackgroundColor;
135
- }
136
- else if (isSelected && isFocused) {
137
- return colors.selectedItemHoverBackgroundColor;
138
- }
139
- else if (isSelected) {
140
- return colors.selectedItemBackgroundColor;
141
- }
142
- else if (isFocused) {
143
- return colors.hoverBackgroundColor;
144
- }
145
- else {
146
- return undefined;
147
- }
148
- };
149
- var resolveOptionColor = function (colors, isDisabled, isSelected, isFocused) {
150
- if (isDisabled) {
151
- return colors.disabledTextColor;
152
- }
153
- else if (isSelected && isFocused) {
154
- return colors.selectedItemHoverTextColor;
155
- }
156
- else if (isSelected) {
157
- return colors.selectedItemTextColor;
158
- }
159
- else if (isFocused) {
160
- return colors.hoverTextColor;
161
- }
162
- else {
163
- return undefined;
164
- }
165
- };
166
- var resolveInputBackgroundColor = function (colors, isDisabled, isFocused, variant) {
167
- if (isDisabled) {
168
- return colors.disabledBackgroundColor;
169
- }
170
- else if (isFocused) {
171
- return colors.backgroundColor;
172
- }
173
- else if (variant === "warning") {
174
- return colors.warningBackgroundColor;
175
- }
176
- else if (variant === "success") {
177
- return colors.successBackgroundColor;
178
- }
179
- else if (variant === "error") {
180
- return colors.errorBackgroundColor;
181
- }
182
- else {
183
- return colors.backgroundColor;
184
- }
185
- };
186
- var resolveInputBorderColor = function (colors, isDisabled, isFocused, isHovered, variant) {
187
- if (isDisabled) {
188
- return colors.borderColor;
189
- }
190
- else if (isFocused) {
191
- return colors.borderColorFocused;
192
- }
193
- else if (variant === "warning") {
194
- return colors.warningBorderColor;
195
- }
196
- else if (variant === "success") {
197
- return colors.successBorderColor;
198
- }
199
- else if (variant === "error") {
200
- return colors.errorBorderColor;
201
- }
202
- else if (isHovered) {
203
- return colors.borderColorFocused;
204
- }
205
- else {
206
- return colors.borderColor;
207
- }
208
- };
209
- /**
210
- * @deprecated
211
- */
212
- var createStylesFromTheme = function (_a, variant) {
213
- var menu = _a.menu, menuPortal = _a.menuPortal, input = _a.input, multiSelect = _a.multiSelect, clearButtonColor = _a.clearButtonColor, arrowColor = _a.arrowColor, loadingIndicator = _a.loadingIndicator;
214
- return ({
215
- option: function (base, _a) {
216
- var isDisabled = _a.isDisabled, isFocused = _a.isFocused, isSelected = _a.isSelected;
217
- return (__assign(__assign({}, base), { fontFamily: input.fontFamily, fontSize: input.fontSize, backgroundColor: resolveOptionBackgroundColor(menu, isDisabled, isSelected, isFocused), color: resolveOptionColor(menu, isDisabled, isSelected, isFocused), cursor: isDisabled ? "not-allowed" : "default", whiteSpace: menu.whiteSpace || base.whiteSpace, ":active": {
218
- backgroundColor: isDisabled
219
- ? undefined
220
- : isSelected
221
- ? menu.selectedItemActiveBackgroundColor
222
- : menu.activeBackgroundColor,
223
- color: isDisabled
224
- ? undefined
225
- : isSelected
226
- ? menu.selectedItemActiveTextColor
227
- : menu.activeTextColor,
228
- } }));
229
- },
230
- control: function (base, _a) {
231
- var isFocused = _a.isFocused, isDisabled = _a.isDisabled, menuIsOpen = _a.menuIsOpen;
232
- return (__assign(__assign({}, base), {
233
- // none of react-selects styles are passed to <View />
234
- fontFamily: input.fontFamily, fontSize: input.fontSize, minHeight: input.minHeight, backgroundColor: resolveInputBackgroundColor(input, isDisabled, isFocused, variant), borderRadius: input.borderRadius, border: input.border, "--swui-select-border-color": resolveInputBorderColor(input, isDisabled, isFocused || menuIsOpen, false, variant), boxShadow: isFocused ? input.boxShadowFocused : undefined, "&:hover": {
235
- "--swui-select-border-color": resolveInputBorderColor(input, false, isFocused || menuIsOpen, true, variant),
236
- } }));
237
- },
238
- singleValue: function (base) { return (__assign(__assign({}, base), { fontFamily: input.fontFamily, fontSize: input.fontSize, color: input.textColor })); },
239
- noOptionsMessage: function (base) { return (__assign(__assign({}, base), { fontFamily: input.fontFamily, fontSize: input.fontSize })); },
240
- input: function (base) { return (__assign(__assign({}, base), { fontFamily: input.fontFamily, fontSize: input.fontSize, color: input.textColor })); },
241
- groupHeading: function (base) { return (__assign(__assign({}, base), { fontFamily: input.fontFamily })); },
242
- multiValueLabel: function (base) { return (__assign(__assign({}, base), { backgroundColor: multiSelect.backgroundColor, color: multiSelect.textColor, fontFamily: input.fontFamily, fontSize: "12px" })); },
243
- indicatorSeparator: function (base) { return (__assign(__assign({}, base), { display: "none" })); },
244
- clearIndicator: function (base) { return (__assign(__assign({}, base), { padding: "5px", color: clearButtonColor.standard, "&:hover": {
245
- color: clearButtonColor.hover,
246
- }, cursor: "pointer" })); },
247
- placeholder: function (base) { return (__assign(__assign({}, base), { fontFamily: input.fontFamily, fontSize: input.fontSize, color: input.placeholderColor })); },
248
- container: function (base) { return (__assign({}, base)); },
249
- valueContainer: function (base) { return (__assign(__assign({}, base), { padding: "0 8px" })); },
250
- dropdownIndicator: function (base, _a) {
251
- var isFocused = _a.isFocused;
252
- return (__assign(__assign({}, base), { padding: "5px", color: isFocused ? arrowColor.focused.standard : arrowColor.closed.standard, "&:hover": {
253
- color: isFocused ? arrowColor.focused.hover : arrowColor.closed.hover,
254
- }, svg: {
255
- width: 14,
256
- height: 14,
257
- } }));
258
- },
259
- menu: function (base) { return (__assign(__assign({}, base), { backgroundColor: menu.backgroundColor, color: menu.textColor, minWidth: menu.minWidth || base.minWidth, zIndex: menu.zIndex, width: menu.width || base.width, border: input.border, borderColor: input.borderColorFocused })); },
260
- menuPortal: function (base) { return (__assign(__assign({}, base), { zIndex: menuPortal.zIndex })); },
261
- multiValueRemove: function (styles) { return (__assign(__assign({}, styles), { backgroundColor: multiSelect.removeButtonBackgroundColor, ":hover": {
262
- color: multiSelect.removeButtonHoverTextColor,
263
- backgroundColor: multiSelect.removeButtonHoverBackgroundColor,
264
- }, color: multiSelect.removeButtonTextColor, borderRadius: "50%", width: 16, height: 16, padding: 0, margin: 3, marginTop: 4, display: "flex", justifyContent: "center", alignItems: "center", cursor: "pointer" })); },
265
- multiValue: function (base) { return (__assign(__assign({}, base), { backgroundColor: multiSelect.backgroundColor, color: multiSelect.textColor, fontFamily: input.fontFamily, fontSize: "12px", alignItems: "center", margin: 0, marginRight: 2 })); },
266
- loadingMessage: function (base) { return (__assign(__assign({}, base), { color: loadingIndicator.textColor, fontFamily: input.fontFamily, fontSize: input.fontSize })); },
267
- });
268
- };
269
- var createStylesFromVariant = function (variant) {
270
- return createStylesFromTheme(defaultSelectTheme, variant);
309
+ const AsyncSelect = ({
310
+ variant = "standard",
311
+ styles,
312
+ isMulti,
313
+ ...selectProps
314
+ }) => {
315
+ const selectStyles = useMemo(() => {
316
+ const sourceStyles = createStylesFromVariant(variant);
317
+ return styles ? mergeStyles(sourceStyles, styles) : sourceStyles;
318
+ }, [variant, styles]);
319
+ return /* @__PURE__ */ jsx(AsyncComponent, {
320
+ styles: selectStyles,
321
+ ...selectProps,
322
+ isMulti: false
323
+ });
271
324
  };
272
-
273
- var AsyncMultiSelect = function (_a) {
274
- var _b = _a.variant, variant = _b === void 0 ? "standard" : _b, styles = _a.styles; _a.isMulti; var selectProps = __rest(_a, ["variant", "styles", "isMulti"]);
275
- var selectStyles = useMemo(function () {
276
- var sourceStyles = createStylesFromVariant(variant);
277
- return styles ? mergeStyles(sourceStyles, styles) : sourceStyles;
278
- }, [variant, styles]);
279
- return (React.createElement(AsyncComponent, __assign({ styles: selectStyles }, selectProps, { isMulti: true })));
325
+ const MultiSelect = ({
326
+ variant = "standard",
327
+ styles,
328
+ isMulti,
329
+ ...selectProps
330
+ }) => {
331
+ const selectStyles = useMemo(() => {
332
+ const sourceStyles = createStylesFromVariant(variant);
333
+ return styles ? mergeStyles(sourceStyles, styles) : sourceStyles;
334
+ }, [variant, styles]);
335
+ return /* @__PURE__ */ jsx(SelectComponent, {
336
+ styles: selectStyles,
337
+ ...selectProps,
338
+ isMulti: true
339
+ });
280
340
  };
281
-
282
- var AsyncSelect = function (_a) {
283
- var _b = _a.variant, variant = _b === void 0 ? "standard" : _b, styles = _a.styles; _a.isMulti; var selectProps = __rest(_a, ["variant", "styles", "isMulti"]);
284
- var selectStyles = useMemo(function () {
285
- var sourceStyles = createStylesFromVariant(variant);
286
- return styles ? mergeStyles(sourceStyles, styles) : sourceStyles;
287
- }, [variant, styles]);
288
- return (React.createElement(AsyncComponent, __assign({ styles: selectStyles }, selectProps, { isMulti: false })));
341
+ const Select = ({
342
+ variant = "standard",
343
+ styles,
344
+ isMulti,
345
+ ...selectProps
346
+ }) => {
347
+ const selectStyles = useMemo(() => {
348
+ const sourceStyles = createStylesFromVariant(variant);
349
+ return styles ? mergeStyles(sourceStyles, styles) : sourceStyles;
350
+ }, [variant, styles]);
351
+ return /* @__PURE__ */ jsx(SelectComponent, {
352
+ styles: selectStyles,
353
+ ...selectProps,
354
+ isMulti: false
355
+ });
289
356
  };
290
-
291
- var MultiSelect = function (_a) {
292
- var _b = _a.variant, variant = _b === void 0 ? "standard" : _b, styles = _a.styles; _a.isMulti; var selectProps = __rest(_a, ["variant", "styles", "isMulti"]);
293
- var selectStyles = useMemo(function () {
294
- var sourceStyles = createStylesFromVariant(variant);
295
- return styles ? mergeStyles(sourceStyles, styles) : sourceStyles;
296
- }, [variant, styles]);
297
- return (React.createElement(SelectComponent, __assign({ styles: selectStyles }, selectProps, { isMulti: true })));
357
+ const removeGroupedOptionsType = (removedValue, selectedInternalOptions) => differenceWith(selectedInternalOptions, [...removedValue.internalOptions, removedValue], isEqual).map(convertInternalOptionToDropdownOption);
358
+ const removeInternalOptions = (selectedInternalOption) => !("internalOptions" in selectedInternalOption);
359
+ const removeOptionHeaders = (selectedInternalOptions) => selectedInternalOptions.filter(removeInternalOptions).map(convertInternalOptionToDropdownOption);
360
+ const createOnChange = (onChange) => (incomingSelectedInternalOptions, meta) => {
361
+ const selectedInternalOptions = incomingSelectedInternalOptions != null ? incomingSelectedInternalOptions : [];
362
+ switch (meta.action) {
363
+ case "select-option":
364
+ if (meta.option && "internalOptions" in meta.option) {
365
+ const selectedOptions = uniqWith(selectedInternalOptions.reduce((previousValue, currentValue) => {
366
+ if ("internalOptions" in currentValue) {
367
+ return [...previousValue, ...currentValue.internalOptions];
368
+ } else {
369
+ return [
370
+ ...previousValue,
371
+ convertInternalOptionToDropdownOption(currentValue)
372
+ ];
373
+ }
374
+ }, []), isEqual);
375
+ onChange(selectedOptions, meta);
376
+ } else {
377
+ onChange(removeOptionHeaders(selectedInternalOptions), meta);
378
+ }
379
+ break;
380
+ case "deselect-option":
381
+ if (meta.option && "internalOptions" in meta.option) {
382
+ onChange(removeGroupedOptionsType(meta.option, removeOptionHeaders(selectedInternalOptions)), meta);
383
+ } else {
384
+ onChange(removeOptionHeaders(selectedInternalOptions), meta);
385
+ }
386
+ break;
387
+ case "remove-value":
388
+ case "pop-value":
389
+ if (meta.removedValue && "internalOptions" in meta.removedValue) {
390
+ onChange(removeGroupedOptionsType(meta.removedValue, removeOptionHeaders(selectedInternalOptions)), meta);
391
+ } else {
392
+ onChange(removeOptionHeaders(selectedInternalOptions), meta);
393
+ }
394
+ break;
395
+ case "clear":
396
+ onChange(selectedInternalOptions.map(convertInternalOptionToDropdownOption), meta);
397
+ break;
398
+ case "create-option":
399
+ onChange(selectedInternalOptions.map(convertInternalOptionToDropdownOption), meta);
400
+ break;
401
+ }
298
402
  };
299
-
300
- var Select = function (_a) {
301
- var _b = _a.variant, variant = _b === void 0 ? "standard" : _b, styles = _a.styles; _a.isMulti; var selectProps = __rest(_a, ["variant", "styles", "isMulti"]);
302
- var selectStyles = useMemo(function () {
303
- var sourceStyles = createStylesFromVariant(variant);
304
- return styles ? mergeStyles(sourceStyles, styles) : sourceStyles;
305
- }, [variant, styles]);
306
- return (React.createElement(SelectComponent, __assign({ styles: selectStyles }, selectProps, { isMulti: false })));
403
+ const convertGroupedDropdownOptionsToInternalOptions = (options) => {
404
+ return options.reduce((previousValue, currentValue) => {
405
+ return [
406
+ ...previousValue,
407
+ convertGroupedDropdownOptionToInternalOption(currentValue),
408
+ ...currentValue.options.map(convertDropdownOptionToInternalOption)
409
+ ];
410
+ }, []);
307
411
  };
308
-
309
- var removeGroupedOptionsType = function (removedValue, selectedInternalOptions) {
310
- return differenceWith(selectedInternalOptions, __spreadArray(__spreadArray([], removedValue.internalOptions, true), [removedValue], false), isEqual).map(convertInternalOptionToDropdownOption);
311
- };
312
- var removeInternalOptions = function (selectedInternalOption) { return !("internalOptions" in selectedInternalOption); };
313
- var removeOptionHeaders = function (selectedInternalOptions) {
314
- return selectedInternalOptions
315
- .filter(removeInternalOptions)
316
- .map(convertInternalOptionToDropdownOption);
317
- };
318
- var createOnChange = function (onChange) {
319
- return function (incomingSelectedInternalOptions, meta) {
320
- var selectedInternalOptions = incomingSelectedInternalOptions !== null && incomingSelectedInternalOptions !== void 0 ? incomingSelectedInternalOptions : [];
321
- switch (meta.action) {
322
- case "select-option":
323
- if (meta.option && "internalOptions" in meta.option) {
324
- var selectedOptions = uniqWith(selectedInternalOptions.reduce(function (previousValue, currentValue) {
325
- if ("internalOptions" in currentValue) {
326
- return __spreadArray(__spreadArray([], previousValue, true), currentValue.internalOptions, true);
327
- }
328
- else {
329
- return __spreadArray(__spreadArray([], previousValue, true), [
330
- convertInternalOptionToDropdownOption(currentValue),
331
- ], false);
332
- }
333
- }, []), isEqual);
334
- onChange(selectedOptions, meta);
335
- }
336
- else {
337
- onChange(removeOptionHeaders(selectedInternalOptions), meta);
338
- }
339
- break;
340
- case "deselect-option":
341
- if (meta.option && "internalOptions" in meta.option) {
342
- onChange(removeGroupedOptionsType(meta.option, removeOptionHeaders(selectedInternalOptions)), meta);
343
- }
344
- else {
345
- onChange(removeOptionHeaders(selectedInternalOptions), meta);
346
- }
347
- break;
348
- case "remove-value":
349
- case "pop-value":
350
- if (meta.removedValue && "internalOptions" in meta.removedValue) {
351
- onChange(removeGroupedOptionsType(meta.removedValue, removeOptionHeaders(selectedInternalOptions)), meta);
352
- }
353
- else {
354
- onChange(removeOptionHeaders(selectedInternalOptions), meta);
355
- }
356
- break;
357
- case "clear":
358
- onChange(selectedInternalOptions.map(convertInternalOptionToDropdownOption), meta);
359
- break;
360
- case "create-option":
361
- onChange(selectedInternalOptions.map(convertInternalOptionToDropdownOption), meta);
362
- break;
363
- }
364
- };
365
- };
366
- var convertGroupedDropdownOptionsToInternalOptions = function (options) {
367
- return options.reduce(function (previousValue, currentValue) {
368
- return __spreadArray(__spreadArray(__spreadArray([], previousValue, true), [
369
- convertGroupedDropdownOptionToInternalOption(currentValue)
370
- ], false), currentValue.options.map(convertDropdownOptionToInternalOption), true);
371
- }, []);
372
- };
373
- var convertValueToInternalValue = function (options, values) {
374
- if (!values) {
375
- return [];
376
- }
377
- var selectedOptions = [];
378
- options.forEach(function (option) {
379
- if (allOptionsExists(option.options, values)) {
380
- selectedOptions.push(convertGroupedDropdownOptionToInternalOption(option));
381
- }
382
- selectedOptions.push.apply(selectedOptions, intersectionWith(option.options, values, isEqual).map(function (option) {
383
- return convertDropdownOptionToInternalOption(option);
384
- }));
385
- });
386
- return selectedOptions;
387
- };
388
- var allOptionsExists = function (options, selectedValues) {
389
- if (!selectedValues) {
390
- return false;
391
- }
392
- return (intersectionWith(options, selectedValues, isEqual).length === options.length);
393
- };
394
- var convertDropdownOptionToInternalOption = function (option) { return ({
395
- data: option.data,
396
- label: option.label,
397
- value: option.value,
398
- }); };
399
- // TODO: can this be done `any` other way
400
- var convertGroupedDropdownOptionToInternalOption = function (option) { return ({
401
- data: option.label,
402
- label: option.label,
403
- value: option.label,
404
- internalOptions: option.options,
405
- }); };
406
- var convertInternalOptionToDropdownOption = function (option) { return ({
407
- data: option.data,
408
- label: option.label,
409
- value: option.value,
410
- }); };
411
-
412
- var resolveIconColor = function (theme, isFocused) {
413
- return isFocused
414
- ? theme.menu.selectedItemHoverIconColor
415
- : theme.menu.selectedItemIconColor;
416
- };
417
- function formatInnerOptionLabel(props) {
418
- var _a;
419
- var _b = props.selectProps, formatGroupLabel = _b.formatGroupLabel, formatOptionLabel = _b.formatOptionLabel;
420
- if ("internalOptions" in props.data) {
421
- return formatGroupLabel
422
- ? formatGroupLabel({
423
- label: props.data.label,
424
- options: props.data.internalOptions,
425
- })
426
- : props.label;
427
- }
428
- return formatOptionLabel
429
- ? formatOptionLabel(props.data, {
430
- context: "menu",
431
- inputValue: (_a = props.selectProps.inputValue) !== null && _a !== void 0 ? _a : "",
432
- selectValue: props.getValue(),
433
- })
434
- : props.label;
435
- }
436
- var GroupedMultiSelect = function (_a) {
437
- var onChange = _a.onChange, options = _a.options, value = _a.value, _b = _a.variant, variant = _b === void 0 ? "standard" : _b; _a.formatGroupLabel; _a.formatOptionLabel; var selectProps = __rest(_a, ["onChange", "options", "value", "variant", "formatGroupLabel", "formatOptionLabel"]);
438
- var Option = function (props) {
439
- var label = formatInnerOptionLabel(props);
440
- var isGroupOption = "internalOptions" in props.data;
441
- return (React.createElement(components.Option, __assign({}, props),
442
- React.createElement(Row, null,
443
- !isGroupOption && React.createElement(Space, null),
444
- React.createElement(InnerOption, { theme: defaultSelectTheme, size: !isGroupOption ? "small" : undefined, label: label, selected: props.isSelected, focused: props.isFocused }))));
445
- };
446
- var MultiValue = function (props) {
447
- return !("internalOptions" in props.data) ? (React.createElement(components.MultiValue, __assign({}, props))) : null;
448
- };
449
- var internalValue = options
450
- ? convertValueToInternalValue(options, value)
451
- : undefined;
452
- var internalOptions = options
453
- ? convertGroupedDropdownOptionsToInternalOptions(options)
454
- : undefined;
455
- return (React.createElement(MultiSelect, __assign({}, selectProps, { onChange: onChange ? createOnChange(onChange) : undefined, hideSelectedOptions: false, components: __assign(__assign({}, selectProps.components), { MultiValue: MultiValue, Option: Option }), isMulti: true, options: internalOptions, value: internalValue, variant: variant })));
456
- };
457
- var InnerOption = function (_a) {
458
- var focused = _a.focused, label = _a.label, selected = _a.selected, size = _a.size, theme = _a.theme;
459
- return (React.createElement(Row, { alignItems: "center", justifyContent: "space-between", flexGrow: 1 },
460
- React.createElement(Text, { tabIndex: -1, size: size, color: "currentColor" }, label),
461
- selected && (React.createElement(Icon, { color: resolveIconColor(theme, focused), icon: faCheck, size: 12 }))));
412
+ const convertValueToInternalValue = (options, values) => {
413
+ if (!values) {
414
+ return [];
415
+ }
416
+ const selectedOptions = [];
417
+ options.forEach((option) => {
418
+ if (allOptionsExists(option.options, values)) {
419
+ selectedOptions.push(convertGroupedDropdownOptionToInternalOption(option));
420
+ }
421
+ selectedOptions.push(...intersectionWith(option.options, values, isEqual).map((option2) => convertDropdownOptionToInternalOption(option2)));
422
+ });
423
+ return selectedOptions;
462
424
  };
463
-
464
- function ChipRow(_a) {
465
- var value = _a.value, onValueChange = _a.onValueChange, _b = _a.noneSelectedLabel, noneSelectedLabel = _b === void 0 ? "None" : _b, children = _a.children;
466
- return (React.createElement(Column, { flex: 1 },
467
- React.createElement(Row, { flexWrap: "wrap" }, value === null || value === void 0 ? void 0 :
468
- value.map(function (v) { return (React.createElement(Row, { key: v.value },
469
- React.createElement(Spacing, { num: 0.5 },
470
- React.createElement(Chip, { label: v.label, onClickRemove: function () {
471
- var _a;
472
- return onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange((_a = value === null || value === void 0 ? void 0 : value.filter(function (f) { return f.value !== v.value; })) !== null && _a !== void 0 ? _a : []);
473
- } })),
474
- React.createElement(Space, null))); }),
475
- (value === null || value === void 0 ? void 0 : value.length) ? (React.createElement(Spacing, { num: 0.5 },
476
- React.createElement(FlatButton, { size: "small", label: "Clear", onClick: function () { return onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange([]); } }))) : (React.createElement(Spacing, { num: 0.5 },
477
- React.createElement(Chip, { variant: "secondary", label: noneSelectedLabel })))),
478
- React.createElement(Space, { num: 0.5 }),
479
- children));
425
+ const allOptionsExists = (options, selectedValues) => {
426
+ if (!selectedValues) {
427
+ return false;
428
+ }
429
+ return intersectionWith(options, selectedValues, isEqual).length === options.length;
430
+ };
431
+ const convertDropdownOptionToInternalOption = (option) => ({
432
+ data: option.data,
433
+ label: option.label,
434
+ value: option.value
435
+ });
436
+ const convertGroupedDropdownOptionToInternalOption = (option) => ({
437
+ data: option.label,
438
+ label: option.label,
439
+ value: option.label,
440
+ internalOptions: option.options
441
+ });
442
+ const convertInternalOptionToDropdownOption = (option) => ({
443
+ data: option.data,
444
+ label: option.label,
445
+ value: option.value
446
+ });
447
+ const resolveIconColor = (theme, isFocused) => isFocused ? theme.menu.selectedItemHoverIconColor : theme.menu.selectedItemIconColor;
448
+ function formatInnerOptionLabel(props) {
449
+ var _a;
450
+ const {
451
+ formatGroupLabel,
452
+ formatOptionLabel
453
+ } = props.selectProps;
454
+ if ("internalOptions" in props.data) {
455
+ return formatGroupLabel ? formatGroupLabel({
456
+ label: props.data.label,
457
+ options: props.data.internalOptions
458
+ }) : props.label;
459
+ }
460
+ return formatOptionLabel ? formatOptionLabel(props.data, {
461
+ context: "menu",
462
+ inputValue: (_a = props.selectProps.inputValue) != null ? _a : "",
463
+ selectValue: props.getValue()
464
+ }) : props.label;
465
+ }
466
+ const GroupedMultiSelect = ({
467
+ onChange,
468
+ options,
469
+ value,
470
+ variant = "standard",
471
+ formatGroupLabel,
472
+ formatOptionLabel,
473
+ ...selectProps
474
+ }) => {
475
+ const Option = (props) => {
476
+ const label = formatInnerOptionLabel(props);
477
+ const isGroupOption = "internalOptions" in props.data;
478
+ return /* @__PURE__ */ jsx(components.Option, {
479
+ ...props,
480
+ children: /* @__PURE__ */ jsxs(Row, {
481
+ children: [!isGroupOption && /* @__PURE__ */ jsx(Space, {}), /* @__PURE__ */ jsx(InnerOption, {
482
+ theme: defaultSelectTheme,
483
+ size: !isGroupOption ? "small" : void 0,
484
+ label,
485
+ selected: props.isSelected,
486
+ focused: props.isFocused
487
+ })]
488
+ })
489
+ });
490
+ };
491
+ const MultiValue = (props) => {
492
+ return !("internalOptions" in props.data) ? /* @__PURE__ */ jsx(components.MultiValue, {
493
+ ...props
494
+ }) : null;
495
+ };
496
+ const internalValue = options ? convertValueToInternalValue(options, value) : void 0;
497
+ const internalOptions = options ? convertGroupedDropdownOptionsToInternalOptions(options) : void 0;
498
+ return /* @__PURE__ */ jsx(MultiSelect, {
499
+ ...selectProps,
500
+ onChange: onChange ? createOnChange(onChange) : void 0,
501
+ hideSelectedOptions: false,
502
+ components: {
503
+ ...selectProps.components,
504
+ MultiValue,
505
+ Option
506
+ },
507
+ isMulti: true,
508
+ options: internalOptions,
509
+ value: internalValue,
510
+ variant
511
+ });
512
+ };
513
+ const InnerOption = ({
514
+ focused,
515
+ label,
516
+ selected,
517
+ size,
518
+ theme
519
+ }) => /* @__PURE__ */ jsxs(Row, {
520
+ alignItems: "center",
521
+ justifyContent: "space-between",
522
+ flexGrow: 1,
523
+ children: [/* @__PURE__ */ jsx(Text, {
524
+ tabIndex: -1,
525
+ size,
526
+ color: "currentColor",
527
+ children: label
528
+ }), selected && /* @__PURE__ */ jsx(Icon, {
529
+ color: resolveIconColor(theme, focused),
530
+ icon: stenaCheck,
531
+ size: 12
532
+ })]
533
+ });
534
+ function ChipRow({
535
+ value,
536
+ onValueChange,
537
+ noneSelectedLabel = "None",
538
+ children
539
+ }) {
540
+ return /* @__PURE__ */ jsxs(Column, {
541
+ flex: 1,
542
+ children: [/* @__PURE__ */ jsxs(Row, {
543
+ flexWrap: "wrap",
544
+ children: [value == null ? void 0 : value.map((v) => /* @__PURE__ */ jsxs(Row, {
545
+ children: [/* @__PURE__ */ jsx(Spacing, {
546
+ num: 0.5,
547
+ children: /* @__PURE__ */ jsx(Chip, {
548
+ label: v.label,
549
+ onClickRemove: () => {
550
+ var _a;
551
+ return onValueChange == null ? void 0 : onValueChange((_a = value == null ? void 0 : value.filter((f) => f.value !== v.value)) != null ? _a : []);
552
+ }
553
+ })
554
+ }), /* @__PURE__ */ jsx(Space, {})]
555
+ }, v.value)), (value == null ? void 0 : value.length) ? /* @__PURE__ */ jsx(Spacing, {
556
+ num: 0.5,
557
+ children: /* @__PURE__ */ jsx(FlatButton, {
558
+ size: "small",
559
+ label: "Clear",
560
+ onClick: () => onValueChange == null ? void 0 : onValueChange([])
561
+ })
562
+ }) : /* @__PURE__ */ jsx(Spacing, {
563
+ num: 0.5,
564
+ children: /* @__PURE__ */ jsx(Chip, {
565
+ variant: "secondary",
566
+ label: noneSelectedLabel
567
+ })
568
+ })]
569
+ }), /* @__PURE__ */ jsx(Space, {
570
+ num: 0.5
571
+ }), children]
572
+ });
573
+ }
574
+ function _ChipMultiSelect({
575
+ value,
576
+ onValueChange,
577
+ placeholder = "Type to search",
578
+ loading,
579
+ inputValue,
580
+ onInputChange,
581
+ noneSelectedLabel = "None",
582
+ ...selectProps
583
+ }) {
584
+ return /* @__PURE__ */ jsx(ChipRow, {
585
+ noneSelectedLabel,
586
+ onValueChange,
587
+ value,
588
+ children: /* @__PURE__ */ jsx(MultiSelect, {
589
+ ...selectProps,
590
+ isClearable: false,
591
+ value,
592
+ onChange: onValueChange ? (value2) => onValueChange([...value2]) : void 0,
593
+ backspaceRemovesValue: false,
594
+ hideSelectedOptions: true,
595
+ controlShouldRenderValue: false,
596
+ placeholder,
597
+ isLoading: loading,
598
+ inputValue,
599
+ onInputChange
600
+ })
601
+ });
602
+ }
603
+ const ChipMultiSelect = React.memo(_ChipMultiSelect);
604
+ function _GroupedChipMultiSelect({
605
+ value,
606
+ onValueChange,
607
+ placeholder = "Type to search",
608
+ loading,
609
+ inputValue,
610
+ onInputChange,
611
+ noneSelectedLabel = "None",
612
+ ...selectProps
613
+ }) {
614
+ return /* @__PURE__ */ jsx(ChipRow, {
615
+ noneSelectedLabel,
616
+ onValueChange,
617
+ value,
618
+ children: /* @__PURE__ */ jsx(GroupedMultiSelect, {
619
+ ...selectProps,
620
+ isClearable: false,
621
+ value,
622
+ onChange: onValueChange ? (value2) => onValueChange([...value2]) : void 0,
623
+ backspaceRemovesValue: false,
624
+ hideSelectedOptions: true,
625
+ controlShouldRenderValue: false,
626
+ placeholder,
627
+ isLoading: loading,
628
+ inputValue,
629
+ onInputChange
630
+ })
631
+ });
480
632
  }
481
-
482
- function _ChipMultiSelect(_a) {
483
- var value = _a.value, onValueChange = _a.onValueChange, _b = _a.placeholder, placeholder = _b === void 0 ? "Type to search" : _b, loading = _a.loading, inputValue = _a.inputValue, onInputChange = _a.onInputChange, _c = _a.noneSelectedLabel, noneSelectedLabel = _c === void 0 ? "None" : _c, selectProps = __rest(_a, ["value", "onValueChange", "placeholder", "loading", "inputValue", "onInputChange", "noneSelectedLabel"]);
484
- return (React.createElement(ChipRow, { noneSelectedLabel: noneSelectedLabel, onValueChange: onValueChange, value: value },
485
- React.createElement(MultiSelect, __assign({}, selectProps, { isClearable: false, value: value, onChange: onValueChange ? function (value) { return onValueChange(__spreadArray([], value, true)); } : undefined, backspaceRemovesValue: false, hideSelectedOptions: true, controlShouldRenderValue: false, placeholder: placeholder, isLoading: loading, inputValue: inputValue, onInputChange: onInputChange }))));
486
- }
487
- var ChipMultiSelect = React.memo(_ChipMultiSelect);
488
-
489
- function _GroupedChipMultiSelect(_a) {
490
- var value = _a.value, onValueChange = _a.onValueChange, _b = _a.placeholder, placeholder = _b === void 0 ? "Type to search" : _b, loading = _a.loading, inputValue = _a.inputValue, onInputChange = _a.onInputChange, _c = _a.noneSelectedLabel, noneSelectedLabel = _c === void 0 ? "None" : _c, selectProps = __rest(_a, ["value", "onValueChange", "placeholder", "loading", "inputValue", "onInputChange", "noneSelectedLabel"]);
491
- return (React.createElement(ChipRow, { noneSelectedLabel: noneSelectedLabel, onValueChange: onValueChange, value: value },
492
- React.createElement(GroupedMultiSelect, __assign({}, selectProps, { isClearable: false, value: value, onChange: onValueChange ? function (value) { return onValueChange(__spreadArray([], value, true)); } : undefined, backspaceRemovesValue: false, hideSelectedOptions: true, controlShouldRenderValue: false, placeholder: placeholder, isLoading: loading, inputValue: inputValue, onInputChange: onInputChange }))));
493
- }
494
- var GroupedChipMultiSelect = React.memo(_GroupedChipMultiSelect);
495
-
633
+ const GroupedChipMultiSelect = React.memo(_GroupedChipMultiSelect);
496
634
  export { AsyncMultiSelect, AsyncSelect, ChipMultiSelect, GroupedChipMultiSelect, GroupedMultiSelect, MultiSelect, Select, createStylesFromTheme, createStylesFromVariant, defaultSelectTheme };
497
635
  //# sourceMappingURL=index.es.js.map