@stenajs-webui/select 14.2.0 → 15.0.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,10 @@
1
1
  /// <reference types="react" />
2
- import { Props } from "react-select/async";
2
+ import { AsyncProps } from "react-select/async";
3
+ import { GroupBase } from "react-select/dist/declarations/src/types";
3
4
  export interface AsyncMultiSelectProps<T = {
4
5
  label: string;
5
6
  value: string;
6
- }> extends Props<T, true> {
7
+ }> extends AsyncProps<T, true, GroupBase<T>> {
7
8
  variant?: "dark" | "light";
8
9
  isMulti?: true;
9
10
  }
@@ -1,9 +1,10 @@
1
1
  /// <reference types="react" />
2
- import { Props } from "react-select/async";
2
+ import { AsyncProps } from "react-select/async";
3
+ import { GroupBase } from "react-select/dist/declarations/src/types";
3
4
  export interface AsyncSelectProps<T = {
4
5
  label: string;
5
6
  value: string;
6
- }> extends Props<T, false> {
7
+ }> extends AsyncProps<T, false, GroupBase<T>> {
7
8
  variant?: "dark" | "light";
8
9
  isMulti?: false;
9
10
  }
@@ -1,8 +1,8 @@
1
1
  import { ValueAndOnValueChangeProps } from "@stenajs-webui/forms";
2
2
  import * as React from "react";
3
3
  import { MultiSelectProps } from "../MultiSelect";
4
- import { CommonChipMultiSelectSelectValue } from "./CommonChipMultiSelect";
5
- export interface ChipMultiSelectValue extends CommonChipMultiSelectSelectValue {
4
+ import { ChipRowItem } from "./ChipRow";
5
+ export interface ChipMultiSelectValue extends ChipRowItem {
6
6
  }
7
7
  export interface ChipMultiSelectProps extends Omit<MultiSelectProps, "value" | "onChange" | "isLoading">, ValueAndOnValueChangeProps<Array<ChipMultiSelectValue>> {
8
8
  loading?: boolean;
@@ -0,0 +1,10 @@
1
+ import { ValueAndOnValueChangeProps } from "@stenajs-webui/forms";
2
+ import { PropsWithChildren } from "react";
3
+ export interface ChipRowItem {
4
+ label: string;
5
+ value: string;
6
+ }
7
+ export interface ChipRowProps<TValue> extends ValueAndOnValueChangeProps<TValue> {
8
+ noneSelectedLabel?: string;
9
+ }
10
+ export declare function ChipRow<TValue extends ChipRowItem>({ value, onValueChange, noneSelectedLabel, children, }: PropsWithChildren<ChipRowProps<Array<TValue>>>): JSX.Element;
@@ -1,14 +1,14 @@
1
1
  import * as React from "react";
2
- import { ActionMeta, GroupedOptionsType, OptionsType, SelectComponentsConfig } from "react-select";
2
+ import { ActionMeta, OnChangeValue, Options } from "react-select";
3
+ import { GroupedOptionsType, InternalDropdownOption } from "../../util/multiDropdownUtils";
3
4
  import { DropdownOption } from "./GroupedMultiSelectTypes";
4
- import { MultiSelectProps } from "./MultiSelect";
5
- export declare type OnChangeValue<TData> = OptionsType<DropdownOption<TData>> | undefined;
6
- export declare type OnChange<TData> = (value: OnChangeValue<TData>, action: ActionMeta<any>) => void;
7
- export interface GroupedMultiSelectProps<TData> extends Omit<MultiSelectProps<DropdownOption<TData>>, "options" | "onChange" | "value" | "components"> {
5
+ import { MultiSelectComponentsConfig, MultiSelectProps } from "./MultiSelect";
6
+ export declare type OnChange<TData> = (value: OnChangeValue<DropdownOption<TData>, true>, action: ActionMeta<any>) => void;
7
+ export interface GroupedMultiSelectProps<TData> extends Omit<MultiSelectProps<InternalDropdownOption<TData>>, "options" | "onChange" | "value" | "components"> {
8
8
  /**
9
9
  * Same as Select prop `component` but without MultiValue and Option since they can not be modified
10
10
  */
11
- components?: Omit<SelectComponentsConfig<DropdownOption<TData>, true>, "MultiValue" | "Option">;
11
+ components?: Omit<MultiSelectComponentsConfig<InternalDropdownOption<TData>>, "MultiValue" | "Option">;
12
12
  /**
13
13
  * Same as Select prop `options` but only with GroupOptionsType
14
14
  */
@@ -20,6 +20,6 @@ export interface GroupedMultiSelectProps<TData> extends Omit<MultiSelectProps<Dr
20
20
  /**
21
21
  * Same as Select prop `value` but only with GroupOptionsType
22
22
  */
23
- value?: OptionsType<DropdownOption<TData>> | undefined;
23
+ value?: Options<DropdownOption<TData>> | undefined;
24
24
  }
25
- export declare const GroupedMultiSelect: <TData extends {}>({ onChange, options, value, variant, formatGroupLabel, formatOptionLabel, ...selectProps }: GroupedMultiSelectProps<TData>) => React.ReactElement<GroupedMultiSelectProps<TData>, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)>;
25
+ export declare const GroupedMultiSelect: <TData extends {}>({ onChange, options, value, variant, formatGroupLabel, formatOptionLabel, ...selectProps }: GroupedMultiSelectProps<TData>) => React.ReactElement<GroupedMultiSelectProps<TData>, string | React.JSXElementConstructor<any>>;
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  declare const _default: {
3
3
  title: string;
4
- component: <TData extends {}>({ onChange, options, value, variant, formatGroupLabel, formatOptionLabel, ...selectProps }: import("./GroupedMultiSelect").GroupedMultiSelectProps<TData>) => React.ReactElement<import("./GroupedMultiSelect").GroupedMultiSelectProps<TData>, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)>;
4
+ component: <TData extends {}>({ onChange, options, value, variant, formatGroupLabel, formatOptionLabel, ...selectProps }: import("./GroupedMultiSelect").GroupedMultiSelectProps<TData>) => React.ReactElement<import("./GroupedMultiSelect").GroupedMultiSelectProps<TData>, string | React.JSXElementConstructor<any>>;
5
5
  };
6
6
  export default _default;
7
7
  export declare const Standard: () => JSX.Element;
@@ -1,10 +1,12 @@
1
1
  /// <reference types="react" />
2
- import { Props } from "react-select";
3
- export interface MultiSelectProps<T = {
2
+ import { Props, SelectComponentsConfig } from "react-select";
3
+ import { GroupBase } from "react-select/dist/declarations/src/types";
4
+ export interface MultiSelectProps<TOption = {
4
5
  label: string;
5
6
  value: string;
6
- }> extends Props<T, true> {
7
+ }> extends Props<TOption, true> {
7
8
  variant?: "dark" | "light";
8
9
  isMulti?: true;
9
10
  }
10
- export declare const MultiSelect: <T extends {}>({ variant, styles, isMulti, ...selectProps }: MultiSelectProps<T>) => JSX.Element;
11
+ export declare type MultiSelectComponentsConfig<TOption> = SelectComponentsConfig<TOption, true, GroupBase<TOption>>;
12
+ export declare const MultiSelect: <TOption extends {}>({ variant, styles, isMulti, ...selectProps }: MultiSelectProps<TOption>) => JSX.Element;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  declare const _default: {
3
3
  title: string;
4
- component: <T extends {}>({ variant, styles, isMulti, ...selectProps }: import("./MultiSelect").MultiSelectProps<T>) => JSX.Element;
4
+ component: <TOption extends {}>({ variant, styles, isMulti, ...selectProps }: import("./MultiSelect").MultiSelectProps<TOption>) => JSX.Element;
5
5
  };
6
6
  export default _default;
7
7
  export declare const Standard: () => JSX.Element;
package/dist/index.es.js CHANGED
@@ -1,4 +1,5 @@
1
- import { useMemo, createElement, memo } from 'react';
1
+ import * as React from 'react';
2
+ import { useMemo } from 'react';
2
3
  import SelectComponent, { mergeStyles as mergeStyles$1, components } from 'react-select';
3
4
  import AsyncComponent from 'react-select/async';
4
5
  import { faCheck } from '@fortawesome/free-solid-svg-icons/faCheck';
@@ -44,12 +45,14 @@ function __rest(s, e) {
44
45
  return t;
45
46
  }
46
47
 
47
- function __spreadArrays() {
48
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
49
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
50
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
51
- r[k] = a[j];
52
- return r;
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));
53
56
  }
54
57
 
55
58
  var defaultSelectTheme = {
@@ -285,43 +288,43 @@ var createStylesFromTheme = function (_a) {
285
288
  };
286
289
 
287
290
  var AsyncMultiSelect = function (_a) {
288
- var _b = _a.variant, variant = _b === void 0 ? "light" : _b, styles = _a.styles, isMulti = _a.isMulti, selectProps = __rest(_a, ["variant", "styles", "isMulti"]);
291
+ var _b = _a.variant, variant = _b === void 0 ? "light" : _b, styles = _a.styles; _a.isMulti; var selectProps = __rest(_a, ["variant", "styles", "isMulti"]);
289
292
  var selectStyles = useMemo(function () {
290
293
  var sourceStyles = createStylesFromTheme(variant === "light" ? defaultSelectTheme : selectThemeDark);
291
294
  return styles ? mergeStyles$1(sourceStyles, styles) : sourceStyles;
292
295
  }, [variant, styles]);
293
- return (createElement(AsyncComponent, __assign({ styles: selectStyles }, selectProps, { isMulti: true })));
296
+ return (React.createElement(AsyncComponent, __assign({ styles: selectStyles }, selectProps, { isMulti: true })));
294
297
  };
295
298
 
296
299
  var AsyncSelect = function (_a) {
297
- var _b = _a.variant, variant = _b === void 0 ? "light" : _b, styles = _a.styles, isMulti = _a.isMulti, selectProps = __rest(_a, ["variant", "styles", "isMulti"]);
300
+ var _b = _a.variant, variant = _b === void 0 ? "light" : _b, styles = _a.styles; _a.isMulti; var selectProps = __rest(_a, ["variant", "styles", "isMulti"]);
298
301
  var selectStyles = useMemo(function () {
299
302
  var sourceStyles = createStylesFromTheme(variant === "light" ? defaultSelectTheme : selectThemeDark);
300
303
  return styles ? mergeStyles$1(sourceStyles, styles) : sourceStyles;
301
304
  }, [variant, styles]);
302
- return (createElement(AsyncComponent, __assign({ styles: selectStyles }, selectProps, { isMulti: false })));
305
+ return (React.createElement(AsyncComponent, __assign({ styles: selectStyles }, selectProps, { isMulti: false })));
303
306
  };
304
307
 
305
308
  var MultiSelect = function (_a) {
306
- var _b = _a.variant, variant = _b === void 0 ? "light" : _b, styles = _a.styles, isMulti = _a.isMulti, selectProps = __rest(_a, ["variant", "styles", "isMulti"]);
309
+ var _b = _a.variant, variant = _b === void 0 ? "light" : _b, styles = _a.styles; _a.isMulti; var selectProps = __rest(_a, ["variant", "styles", "isMulti"]);
307
310
  var selectStyles = useMemo(function () {
308
311
  var sourceStyles = createStylesFromTheme(variant === "light" ? defaultSelectTheme : selectThemeDark);
309
312
  return styles ? mergeStyles$1(sourceStyles, styles) : sourceStyles;
310
313
  }, [variant, styles]);
311
- return (createElement(SelectComponent, __assign({ styles: selectStyles }, selectProps, { isMulti: true })));
314
+ return (React.createElement(SelectComponent, __assign({ styles: selectStyles }, selectProps, { isMulti: true })));
312
315
  };
313
316
 
314
317
  var Select = function (_a) {
315
- var _b = _a.variant, variant = _b === void 0 ? "light" : _b, styles = _a.styles, isMulti = _a.isMulti, selectProps = __rest(_a, ["variant", "styles", "isMulti"]);
318
+ var _b = _a.variant, variant = _b === void 0 ? "light" : _b, styles = _a.styles; _a.isMulti; var selectProps = __rest(_a, ["variant", "styles", "isMulti"]);
316
319
  var selectStyles = useMemo(function () {
317
320
  var sourceStyles = createStylesFromTheme(variant === "light" ? defaultSelectTheme : selectThemeDark);
318
321
  return styles ? mergeStyles$1(sourceStyles, styles) : sourceStyles;
319
322
  }, [variant, styles]);
320
- return (createElement(SelectComponent, __assign({ styles: selectStyles }, selectProps, { isMulti: false })));
323
+ return (React.createElement(SelectComponent, __assign({ styles: selectStyles }, selectProps, { isMulti: false })));
321
324
  };
322
325
 
323
- var removeGroupedOptions = function (removedValue, selectedInternalOptions) {
324
- return differenceWith(selectedInternalOptions, __spreadArrays(removedValue.internalOptions, [removedValue]), isEqual).map(convertInternalOptionToDropdownOption);
326
+ var removeGroupedOptionsType = function (removedValue, selectedInternalOptions) {
327
+ return differenceWith(selectedInternalOptions, __spreadArray(__spreadArray([], removedValue.internalOptions, true), [removedValue], false), isEqual).map(convertInternalOptionToDropdownOption);
325
328
  };
326
329
  var removeInternalOptions = function (selectedInternalOption) { return !("internalOptions" in selectedInternalOption); };
327
330
  var removeOptionHeaders = function (selectedInternalOptions) {
@@ -330,28 +333,18 @@ var removeOptionHeaders = function (selectedInternalOptions) {
330
333
  .map(convertInternalOptionToDropdownOption);
331
334
  };
332
335
  var createOnChange = function (onChange) { return function (incomingSelectedInternalOptions, meta) {
333
- var selectedInternalOptions = (function () {
334
- if (!incomingSelectedInternalOptions) {
335
- return [];
336
- }
337
- else if ("length" in incomingSelectedInternalOptions) {
338
- return incomingSelectedInternalOptions;
339
- }
340
- else {
341
- return [incomingSelectedInternalOptions];
342
- }
343
- })();
336
+ var selectedInternalOptions = incomingSelectedInternalOptions !== null && incomingSelectedInternalOptions !== void 0 ? incomingSelectedInternalOptions : [];
344
337
  switch (meta.action) {
345
338
  case "select-option":
346
339
  if (meta.option && "internalOptions" in meta.option) {
347
340
  var selectedOptions = uniqWith(selectedInternalOptions.reduce(function (previousValue, currentValue) {
348
341
  if ("internalOptions" in currentValue) {
349
- return __spreadArrays(previousValue, currentValue.internalOptions);
342
+ return __spreadArray(__spreadArray([], previousValue, true), currentValue.internalOptions, true);
350
343
  }
351
344
  else {
352
- return __spreadArrays(previousValue, [
345
+ return __spreadArray(__spreadArray([], previousValue, true), [
353
346
  convertInternalOptionToDropdownOption(currentValue),
354
- ]);
347
+ ], false);
355
348
  }
356
349
  }, []), isEqual);
357
350
  onChange(selectedOptions, meta);
@@ -362,7 +355,7 @@ var createOnChange = function (onChange) { return function (incomingSelectedInte
362
355
  break;
363
356
  case "deselect-option":
364
357
  if (meta.option && "internalOptions" in meta.option) {
365
- onChange(removeGroupedOptions(meta.option, removeOptionHeaders(selectedInternalOptions)), meta);
358
+ onChange(removeGroupedOptionsType(meta.option, removeOptionHeaders(selectedInternalOptions)), meta);
366
359
  }
367
360
  else {
368
361
  onChange(removeOptionHeaders(selectedInternalOptions), meta);
@@ -371,7 +364,7 @@ var createOnChange = function (onChange) { return function (incomingSelectedInte
371
364
  case "remove-value":
372
365
  case "pop-value":
373
366
  if (meta.removedValue && "internalOptions" in meta.removedValue) {
374
- onChange(removeGroupedOptions(meta.removedValue, removeOptionHeaders(selectedInternalOptions)), meta);
367
+ onChange(removeGroupedOptionsType(meta.removedValue, removeOptionHeaders(selectedInternalOptions)), meta);
375
368
  }
376
369
  else {
377
370
  onChange(removeOptionHeaders(selectedInternalOptions), meta);
@@ -387,9 +380,9 @@ var createOnChange = function (onChange) { return function (incomingSelectedInte
387
380
  }; };
388
381
  var convertGroupedDropdownOptionsToInternalOptions = function (options) {
389
382
  return options.reduce(function (previousValue, currentValue) {
390
- return __spreadArrays(previousValue, [
383
+ return __spreadArray(__spreadArray(__spreadArray([], previousValue, true), [
391
384
  convertGroupedDropdownOptionToInternalOption(currentValue)
392
- ], currentValue.options.map(convertDropdownOptionToInternalOption));
385
+ ], false), currentValue.options.map(convertDropdownOptionToInternalOption), true);
393
386
  }, []);
394
387
  };
395
388
  var convertValueToInternalValue = function (options, values) {
@@ -418,6 +411,7 @@ var convertDropdownOptionToInternalOption = function (option) { return ({
418
411
  label: option.label,
419
412
  value: option.value,
420
413
  }); };
414
+ // TODO: can this be done `any` other way
421
415
  var convertGroupedDropdownOptionToInternalOption = function (option) { return ({
422
416
  data: option.label,
423
417
  label: option.label,
@@ -439,21 +433,28 @@ var GroupedMultiSelect = function (_a) {
439
433
  var onChange = _a.onChange, options = _a.options, value = _a.value, _b = _a.variant, variant = _b === void 0 ? "light" : _b, formatGroupLabel = _a.formatGroupLabel, formatOptionLabel = _a.formatOptionLabel, selectProps = __rest(_a, ["onChange", "options", "value", "variant", "formatGroupLabel", "formatOptionLabel"]);
440
434
  var theme = variant === "light" ? defaultSelectTheme : selectThemeDark;
441
435
  var Option = function (props) {
442
- if (props.data.internalOptions) {
443
- return (createElement(components.Option, __assign({}, props),
444
- createElement(Box, { alignItems: "center", justifyContent: "space-between", flexDirection: "row" },
445
- createElement(Text, { tabIndex: -1 }, formatGroupLabel ? formatGroupLabel(props.data) : props.label),
446
- props.isSelected && (createElement(Icon, { color: resolveIconColor(theme, props.isFocused), icon: faCheck, size: 12 })))));
436
+ var _a;
437
+ if ("options" in props.data) {
438
+ return (React.createElement(components.Option, __assign({}, props),
439
+ React.createElement(Box, { alignItems: "center", justifyContent: "space-between", flexDirection: "row" },
440
+ React.createElement(Text, { tabIndex: -1 }, formatGroupLabel ? formatGroupLabel(props.data) : props.label),
441
+ props.isSelected && (React.createElement(Icon, { color: resolveIconColor(theme, props.isFocused), icon: faCheck, size: 12 })))));
447
442
  }
448
- return (createElement(components.Option, __assign({}, props),
449
- createElement(Row, null,
450
- createElement(Space, null),
451
- createElement(Box, { alignItems: "center", justifyContent: "space-between", flexDirection: "row", flexGrow: 1 },
452
- createElement(Text, { size: "small", tabIndex: -1, color: props.isSelected ? theme.menu.selectedItemTextColor : undefined }, formatOptionLabel ? formatOptionLabel(props.data) : props.label),
453
- props.isSelected && (createElement(Icon, { color: resolveIconColor(theme, props.isFocused), icon: faCheck, size: 12 }))))));
443
+ return (React.createElement(components.Option, __assign({}, props),
444
+ React.createElement(Row, null,
445
+ React.createElement(Space, null),
446
+ React.createElement(Box, { alignItems: "center", justifyContent: "space-between", flexDirection: "row", flexGrow: 1 },
447
+ React.createElement(Text, { size: "small", tabIndex: -1, color: props.isSelected ? theme.menu.selectedItemTextColor : undefined }, formatOptionLabel
448
+ ? formatOptionLabel(props.data, {
449
+ context: "menu",
450
+ inputValue: (_a = selectProps.inputValue) !== null && _a !== void 0 ? _a : "",
451
+ selectValue: props.getValue(),
452
+ })
453
+ : props.label),
454
+ props.isSelected && (React.createElement(Icon, { color: resolveIconColor(theme, props.isFocused), icon: faCheck, size: 12 }))))));
454
455
  };
455
456
  var MultiValue = function (props) {
456
- return !("internalOptions" in props.data) ? (createElement(components.MultiValue, __assign({}, props))) : null;
457
+ return !("internalOptions" in props.data) ? (React.createElement(components.MultiValue, __assign({}, props))) : null;
457
458
  };
458
459
  var internalValue = options
459
460
  ? convertValueToInternalValue(options, value)
@@ -461,35 +462,37 @@ var GroupedMultiSelect = function (_a) {
461
462
  var internalOptions = options
462
463
  ? convertGroupedDropdownOptionsToInternalOptions(options)
463
464
  : undefined;
464
- return (createElement(MultiSelect, __assign({}, selectProps, { onChange: onChange ? createOnChange(onChange) : undefined, hideSelectedOptions: false, components: __assign(__assign({}, selectProps.components), { MultiValue: MultiValue,
465
- Option: Option }), isMulti: true, options: internalOptions, value: internalValue, variant: variant })));
465
+ 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 })));
466
466
  };
467
467
 
468
- function CommonChipMultiSelect(_a) {
468
+ function ChipRow(_a) {
469
469
  var value = _a.value, onValueChange = _a.onValueChange, _b = _a.noneSelectedLabel, noneSelectedLabel = _b === void 0 ? "None" : _b, children = _a.children;
470
- return (createElement(Column, null,
471
- createElement(Row, { flexWrap: "wrap" }, value === null || value === void 0 ? void 0 :
472
- value.map(function (v) { return (createElement(Row, { key: v.value },
473
- createElement(Spacing, { num: 0.5 },
474
- createElement(Chip, { label: v.label, onClickRemove: function () { var _a; 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 : []); } })),
475
- createElement(Space, null))); }),
476
- (value === null || value === void 0 ? void 0 : value.length) ? (createElement(Spacing, { num: 0.5 },
477
- createElement(FlatButton, { size: "small", label: "Clear", onClick: function () { return onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange([]); } }))) : (createElement(Spacing, { num: 0.5 },
478
- createElement(Chip, { variant: "secondary", label: noneSelectedLabel })))),
479
- createElement(Space, { num: 0.5 }),
470
+ return (React.createElement(Column, { flex: 1 },
471
+ React.createElement(Row, { flexWrap: "wrap" }, value === null || value === void 0 ? void 0 :
472
+ value.map(function (v) { return (React.createElement(Row, { key: v.value },
473
+ React.createElement(Spacing, { num: 0.5 },
474
+ React.createElement(Chip, { label: v.label, onClickRemove: function () {
475
+ var _a;
476
+ 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 : []);
477
+ } })),
478
+ React.createElement(Space, null))); }),
479
+ (value === null || value === void 0 ? void 0 : value.length) ? (React.createElement(Spacing, { num: 0.5 },
480
+ React.createElement(FlatButton, { size: "small", label: "Clear", onClick: function () { return onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange([]); } }))) : (React.createElement(Spacing, { num: 0.5 },
481
+ React.createElement(Chip, { variant: "secondary", label: noneSelectedLabel })))),
482
+ React.createElement(Space, { num: 0.5 }),
480
483
  children));
481
484
  }
482
485
 
483
- var ChipMultiSelect = memo(function (_a) {
486
+ var ChipMultiSelect = React.memo(function (_a) {
484
487
  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"]);
485
- return (createElement(CommonChipMultiSelect, { noneSelectedLabel: noneSelectedLabel, onValueChange: onValueChange, value: value },
486
- createElement(MultiSelect, __assign({}, selectProps, { isClearable: false, value: value, onChange: onValueChange, backspaceRemovesValue: false, hideSelectedOptions: true, controlShouldRenderValue: false, placeholder: placeholder, isLoading: loading, inputValue: inputValue, onInputChange: onInputChange }))));
488
+ return (React.createElement(ChipRow, { noneSelectedLabel: noneSelectedLabel, onValueChange: onValueChange, value: value },
489
+ React.createElement(MultiSelect, __assign({}, selectProps, { isClearable: false, value: value, onChange: onValueChange, backspaceRemovesValue: false, hideSelectedOptions: true, controlShouldRenderValue: false, placeholder: placeholder, isLoading: loading, inputValue: inputValue, onInputChange: onInputChange }))));
487
490
  });
488
491
 
489
- var GroupedChipMultiSelect = memo(function (_a) {
492
+ var GroupedChipMultiSelect = React.memo(function (_a) {
490
493
  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 (createElement(CommonChipMultiSelect, { noneSelectedLabel: noneSelectedLabel, onValueChange: onValueChange, value: value },
492
- createElement(GroupedMultiSelect, __assign({}, selectProps, { isClearable: false, value: value, onChange: onValueChange, backspaceRemovesValue: false, hideSelectedOptions: true, controlShouldRenderValue: false, placeholder: placeholder, isLoading: loading, inputValue: inputValue, onInputChange: onInputChange }))));
494
+ return (React.createElement(ChipRow, { noneSelectedLabel: noneSelectedLabel, onValueChange: onValueChange, value: value },
495
+ React.createElement(GroupedMultiSelect, __assign({}, selectProps, { isClearable: false, value: value, onChange: onValueChange, backspaceRemovesValue: false, hideSelectedOptions: true, controlShouldRenderValue: false, placeholder: placeholder, isLoading: loading, inputValue: inputValue, onInputChange: onInputChange }))));
493
496
  });
494
497
 
495
498
  var mergeStyles = function (themeStyle, userStyle) {