@wireapp/react-ui-kit 9.58.0 → 9.59.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.
@@ -13,16 +13,16 @@ export interface ComboboxSelectProps {
13
13
  isDisabled?: boolean;
14
14
  placeholder?: string;
15
15
  dataUieName?: string;
16
- onCreateOption: (inputValue: string) => void;
17
- createOptionLabel: (inputValue: string) => string;
16
+ onCreateOption?: (inputValue: string) => void;
17
+ createOptionLabel?: (inputValue: string) => string;
18
18
  noOptionsMessage: string;
19
19
  label?: string;
20
20
  required?: boolean;
21
- menuPotralTarget?: HTMLElement;
21
+ menuPortalTarget?: HTMLElement;
22
22
  menuPosition?: MenuPosition;
23
23
  menuListCSS?: CSSObject;
24
24
  isLoading?: boolean;
25
25
  loadingMessage?: string;
26
26
  }
27
- export declare const ComboboxSelect: ({ id, options, value, onChange, isDisabled, placeholder, dataUieName, onCreateOption, createOptionLabel, noOptionsMessage, label, required, menuPotralTarget, menuPosition, menuListCSS, isLoading, loadingMessage, }: ComboboxSelectProps) => import("@emotion/react/jsx-runtime").JSX.Element;
27
+ export declare const ComboboxSelect: ({ id, options, value, onChange, isDisabled, placeholder, dataUieName, onCreateOption, createOptionLabel, noOptionsMessage, label, required, menuPortalTarget, menuPosition, menuListCSS, isLoading, loadingMessage, }: ComboboxSelectProps) => import("@emotion/react/jsx-runtime").JSX.Element;
28
28
  //# sourceMappingURL=ComboboxSelect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ComboboxSelect.d.ts","sourceRoot":"","sources":["../../../../src/Form/Select/ComboboxSelect/ComboboxSelect.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAW,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAa,YAAY,EAAqC,MAAM,cAAc,CAAC;AAU1F,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,C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ACtB,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,oBAAoB,EAAE,CAAC;IAChC,KAAK,CAAC,EAAE,oBAAoB,GAAG,oBAAoB,EAAE,CAAC;IACtD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,GAAG,oBAAoB,EAAE,KAAK,IAAI,CAAC;IAC1E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,iBAAiB,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;IACnD,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,WAAW,CAAC;IAC/B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,cAAc,0NAkBxB,mBAAmB,qDA2BrB,CAAC"}
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
27
  };
@@ -23,24 +46,34 @@ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
23
46
  * along with this program. If not, see http://www.gnu.org/licenses/.
24
47
  *
25
48
  */
26
- const react_1 = require("@emotion/react");
27
- const react_select_1 = require("react-select");
49
+ const react_1 = require("react");
50
+ const react_2 = require("@emotion/react");
51
+ const react_select_1 = __importStar(require("react-select"));
28
52
  const creatable_1 = __importDefault(require("react-select/creatable"));
29
53
  const ComboboxSelect_styles_1 = require("./ComboboxSelect.styles");
30
54
  const CloseIcon_1 = require("../../../Icon/CloseIcon");
31
55
  const InputLabel_1 = require("../../InputLabel");
32
56
  const BaseSelectDropdownIndicator_1 = require("../BaseSelect/BaseSelectDropdownIndicator");
33
- const ComboboxSelect = ({ id, options, value, onChange, isDisabled = false, placeholder, dataUieName, onCreateOption, createOptionLabel, noOptionsMessage, label, required, menuPotralTarget, menuPosition = 'absolute', menuListCSS, isLoading = false, loadingMessage, }) => {
34
- const theme = (0, react_1.useTheme)();
35
- return ((0, jsx_runtime_1.jsxs)("div", { css: ComboboxSelect_styles_1.wrapperStyles, "data-uie-name": dataUieName, children: [label && ((0, jsx_runtime_1.jsx)(InputLabel_1.InputLabel, { htmlFor: id, isRequired: required, children: label })), (0, jsx_runtime_1.jsx)(creatable_1.default, { id: id, options: options, value: value, onChange: onChange, isMulti: true, isSearchable: true, isDisabled: isDisabled, placeholder: placeholder, menuPortalTarget: menuPotralTarget, menuPosition: menuPosition, styles: (0, ComboboxSelect_styles_1.selectStyles)({ theme, menuListCSS }), classNamePrefix: "select", formatCreateLabel: createOptionLabel, onCreateOption: onCreateOption, closeMenuOnSelect: false, isLoading: isLoading, components: {
36
- ClearIndicator: () => null,
37
- DropdownIndicator: BaseSelectDropdownIndicator_1.BaseSelectDropdownIndicator,
38
- MultiValueRemove: props => (0, jsx_runtime_1.jsx)(MultiValueRemove, { ...props }),
39
- NoOptionsMessage: props => (0, jsx_runtime_1.jsx)(NoOptionsMessage, { ...props, message: noOptionsMessage }),
40
- LoadingMessage: props => (0, jsx_runtime_1.jsx)(LoadingMessage, { ...props, message: loadingMessage }),
41
- } })] }));
57
+ const ComboboxSelect = ({ id, options, value, onChange, isDisabled = false, placeholder, dataUieName, onCreateOption, createOptionLabel, noOptionsMessage, label, required, menuPortalTarget, menuPosition = 'absolute', menuListCSS, isLoading = false, loadingMessage, }) => {
58
+ return ((0, jsx_runtime_1.jsxs)("div", { css: ComboboxSelect_styles_1.wrapperStyles, "data-uie-name": dataUieName, children: [label && ((0, jsx_runtime_1.jsx)(InputLabel_1.InputLabel, { htmlFor: id, isRequired: required, children: label })), (0, jsx_runtime_1.jsx)(Select, { id: id, options: options, value: value, onChange: onChange, isDisabled: isDisabled, placeholder: placeholder, menuPortalTarget: menuPortalTarget, menuPosition: menuPosition, createOptionLabel: createOptionLabel, onCreateOption: onCreateOption, creatable: !!onCreateOption, isLoading: isLoading, noOptionsMessage: noOptionsMessage, loadingMessage: loadingMessage, menuListCSS: menuListCSS })] }));
42
59
  };
43
60
  exports.ComboboxSelect = ComboboxSelect;
61
+ const Select = ({ id, options, value, onChange, isDisabled = false, placeholder, onCreateOption, createOptionLabel, noOptionsMessage, menuPortalTarget, menuPosition = 'absolute', menuListCSS, isLoading = false, loadingMessage, creatable = false, }) => {
62
+ const theme = (0, react_2.useTheme)();
63
+ const components = (0, react_1.useMemo)(() => {
64
+ return {
65
+ ClearIndicator: () => null,
66
+ DropdownIndicator: BaseSelectDropdownIndicator_1.BaseSelectDropdownIndicator,
67
+ MultiValueRemove: (props) => (0, jsx_runtime_1.jsx)(MultiValueRemove, { ...props }),
68
+ NoOptionsMessage: (props) => (0, jsx_runtime_1.jsx)(NoOptionsMessage, { ...props, message: noOptionsMessage }),
69
+ LoadingMessage: (props) => (0, jsx_runtime_1.jsx)(LoadingMessage, { ...props, message: loadingMessage }),
70
+ };
71
+ }, [loadingMessage, noOptionsMessage]);
72
+ if (!creatable) {
73
+ return ((0, jsx_runtime_1.jsx)(react_select_1.default, { id: id, options: options, value: value, onChange: onChange, isMulti: true, isSearchable: true, isDisabled: isDisabled, placeholder: placeholder, menuPortalTarget: menuPortalTarget, menuPosition: menuPosition, styles: (0, ComboboxSelect_styles_1.selectStyles)({ theme, menuListCSS }), classNamePrefix: "select", closeMenuOnSelect: false, components: components }));
74
+ }
75
+ return ((0, jsx_runtime_1.jsx)(creatable_1.default, { id: id, options: options, value: value, onChange: onChange, isMulti: true, isSearchable: true, isDisabled: isDisabled, placeholder: placeholder, menuPortalTarget: menuPortalTarget, menuPosition: menuPosition, styles: (0, ComboboxSelect_styles_1.selectStyles)({ theme, menuListCSS }), classNamePrefix: "select", formatCreateLabel: createOptionLabel, onCreateOption: onCreateOption, closeMenuOnSelect: false, isLoading: isLoading, components: components }));
76
+ };
44
77
  const MultiValueRemove = (props) => ((0, jsx_runtime_1.jsx)(react_select_1.components.MultiValueRemove, { ...props, children: (0, jsx_runtime_1.jsx)(CloseIcon_1.CloseIcon, { width: 10, height: 10 }) }));
45
78
  const NoOptionsMessage = ({ message, ...props }) => ((0, jsx_runtime_1.jsx)(react_select_1.components.NoOptionsMessage, { ...props, children: (0, jsx_runtime_1.jsx)("div", { css: ComboboxSelect_styles_1.noOptionsMessageStyles, children: message }) }));
46
79
  const LoadingMessage = ({ message, ...props }) => ((0, jsx_runtime_1.jsx)(react_select_1.components.LoadingMessage, { ...props, children: (0, jsx_runtime_1.jsx)("div", { css: ComboboxSelect_styles_1.loadingMessageStyles, children: message }) }));
@@ -2,7 +2,7 @@ import type { StoryObj } from '@storybook/react';
2
2
  import { type ComboboxSelectProps } from './ComboboxSelect';
3
3
  declare const meta: {
4
4
  title: string;
5
- component: ({ id, options, value, onChange, isDisabled, placeholder, dataUieName, onCreateOption, createOptionLabel, noOptionsMessage, label, required, menuPotralTarget, menuPosition, menuListCSS, isLoading, loadingMessage, }: ComboboxSelectProps) => import("@emotion/react/jsx-runtime").JSX.Element;
5
+ component: ({ id, options, value, onChange, isDisabled, placeholder, dataUieName, onCreateOption, createOptionLabel, noOptionsMessage, label, required, menuPortalTarget, menuPosition, menuListCSS, isLoading, loadingMessage, }: ComboboxSelectProps) => import("@emotion/react/jsx-runtime").JSX.Element;
6
6
  parameters: {
7
7
  layout: string;
8
8
  };
@@ -14,12 +14,12 @@ declare const meta: {
14
14
  isDisabled?: boolean;
15
15
  placeholder?: string;
16
16
  dataUieName?: string;
17
- onCreateOption: (inputValue: string) => void;
18
- createOptionLabel: (inputValue: string) => string;
17
+ onCreateOption?: (inputValue: string) => void;
18
+ createOptionLabel?: (inputValue: string) => string;
19
19
  noOptionsMessage: string;
20
20
  label?: string;
21
21
  required?: boolean;
22
- menuPotralTarget?: HTMLElement;
22
+ menuPortalTarget?: HTMLElement;
23
23
  menuPosition?: import("react-select").MenuPosition;
24
24
  menuListCSS?: import("@emotion/serialize").CSSObject;
25
25
  isLoading?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"ComboboxSelect.stories.d.ts","sourceRoot":"","sources":["../../../../src/Form/Select/ComboboxSelect/ComboboxSelect.stories.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAO,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAiB,KAAK,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AAU1E,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;CAc6B,CAAC;AAExC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAUrB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAWvB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAWtB,CAAC;AA8BF,eAAO,MAAM,SAAS,EAAE,KAYvB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KASvB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAUrB,CAAC"}
1
+ {"version":3,"file":"ComboboxSelect.stories.d.ts","sourceRoot":"","sources":["../../../../src/Form/Select/ComboboxSelect/ComboboxSelect.stories.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAO,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAiB,KAAK,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AAU1E,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;CAc6B,CAAC;AAExC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAQrB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KASvB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAStB,CAAC;AA8BF,eAAO,MAAM,SAAS,EAAE,KAUvB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAOvB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAQrB,CAAC"}
@@ -45,8 +45,6 @@ exports.Default = {
45
45
  options: initialOptions,
46
46
  placeholder: 'Select options...',
47
47
  dataUieName: 'default-select',
48
- createOptionLabel: inputValue => `Create item "${inputValue}"`,
49
- onCreateOption: () => { },
50
48
  noOptionsMessage: 'No options available',
51
49
  },
52
50
  };
@@ -57,8 +55,6 @@ exports.WithValue = {
57
55
  value: [initialOptions[0], initialOptions[1]],
58
56
  placeholder: 'Select options...',
59
57
  dataUieName: 'with-value-select',
60
- createOptionLabel: inputValue => `Create item "${inputValue}"`,
61
- onCreateOption: () => { },
62
58
  noOptionsMessage: 'No options available',
63
59
  },
64
60
  };
@@ -69,8 +65,6 @@ exports.Disabled = {
69
65
  isDisabled: true,
70
66
  placeholder: 'Select options...',
71
67
  dataUieName: 'disabled-select',
72
- createOptionLabel: inputValue => `Create item "${inputValue}"`,
73
- onCreateOption: () => { },
74
68
  noOptionsMessage: 'No options available',
75
69
  },
76
70
  };
@@ -96,8 +90,6 @@ exports.Creatable = {
96
90
  options: initialOptions,
97
91
  placeholder: 'Select or create options...',
98
92
  dataUieName: 'creatable-select',
99
- createOptionLabel: inputValue => `Create item "${inputValue}"`,
100
- onCreateOption: () => { },
101
93
  noOptionsMessage: 'No options available',
102
94
  required: true,
103
95
  },
@@ -108,8 +100,6 @@ exports.WithLabel = {
108
100
  id: 'with-label-select',
109
101
  label: 'Select options',
110
102
  options: initialOptions,
111
- createOptionLabel: inputValue => `Create item "${inputValue}"`,
112
- onCreateOption: () => { },
113
103
  noOptionsMessage: 'No options available',
114
104
  },
115
105
  };
@@ -118,8 +108,6 @@ exports.Loading = {
118
108
  id: 'loading-select',
119
109
  isLoading: true,
120
110
  options: [],
121
- createOptionLabel: inputValue => `Create item "${inputValue}"`,
122
- onCreateOption: () => { },
123
111
  noOptionsMessage: 'No options available',
124
112
  loadingMessage: 'Loading options...',
125
113
  },
package/package.json CHANGED
@@ -79,6 +79,6 @@
79
79
  "test:watch": "jest --watch",
80
80
  "test:update": "jest --updateSnapshot"
81
81
  },
82
- "version": "9.58.0",
83
- "gitHead": "9b86d389a625af640e18caa2371c57f18d6c2e58"
82
+ "version": "9.59.0",
83
+ "gitHead": "b41d54e04363be3e8f351f3f567109e23e6848ea"
84
84
  }