@wireapp/react-ui-kit 9.58.0 → 9.59.1
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/lib/Form/Select/ComboboxSelect/ComboboxSelect.d.ts +4 -4
- package/lib/Form/Select/ComboboxSelect/ComboboxSelect.d.ts.map +1 -1
- package/lib/Form/Select/ComboboxSelect/ComboboxSelect.js +44 -11
- package/lib/Form/Select/ComboboxSelect/ComboboxSelect.stories.d.ts +4 -4
- package/lib/Form/Select/ComboboxSelect/ComboboxSelect.stories.d.ts.map +1 -1
- package/lib/Form/Select/ComboboxSelect/ComboboxSelect.stories.js +0 -12
- package/lib/Misc/Accordion/AccordionItem/AccordionItem.styles.js +5 -5
- package/package.json +2 -2
|
@@ -13,16 +13,16 @@ export interface ComboboxSelectProps {
|
|
|
13
13
|
isDisabled?: boolean;
|
|
14
14
|
placeholder?: string;
|
|
15
15
|
dataUieName?: string;
|
|
16
|
-
onCreateOption
|
|
17
|
-
createOptionLabel
|
|
16
|
+
onCreateOption?: (inputValue: string) => void;
|
|
17
|
+
createOptionLabel?: (inputValue: string) => string;
|
|
18
18
|
noOptionsMessage: string;
|
|
19
19
|
label?: string;
|
|
20
20
|
required?: boolean;
|
|
21
|
-
|
|
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,
|
|
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":"
|
|
1
|
+
{"version":3,"file":"ComboboxSelect.d.ts","sourceRoot":"","sources":["../../../../src/Form/Select/ComboboxSelect/ComboboxSelect.tsx"],"names":[],"mappings":"AAqBA,OAAO,EAAC,SAAS,EAAW,MAAM,gBAAgB,CAAC;AACnD,OAAmB,EAAa,YAAY,EAAqC,MAAM,cAAc,CAAC;AAUtG,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,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("
|
|
27
|
-
const
|
|
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,
|
|
34
|
-
|
|
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,
|
|
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
|
|
18
|
-
createOptionLabel
|
|
17
|
+
onCreateOption?: (inputValue: string) => void;
|
|
18
|
+
createOptionLabel?: (inputValue: string) => string;
|
|
19
19
|
noOptionsMessage: string;
|
|
20
20
|
label?: string;
|
|
21
21
|
required?: boolean;
|
|
22
|
-
|
|
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,
|
|
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
|
},
|
|
@@ -47,8 +47,8 @@ exports.wrapperStyles = {
|
|
|
47
47
|
exports.itemStyles = {
|
|
48
48
|
overflow: 'hidden',
|
|
49
49
|
borderBottom: `1px solid var(--text-input-border)`,
|
|
50
|
-
'&:last-child': {
|
|
51
|
-
|
|
50
|
+
'&:not(:last-child)': {
|
|
51
|
+
marginBottom: '8px',
|
|
52
52
|
},
|
|
53
53
|
};
|
|
54
54
|
exports.triggerStyles = {
|
|
@@ -57,11 +57,11 @@ exports.triggerStyles = {
|
|
|
57
57
|
alignItems: 'center',
|
|
58
58
|
justifyContent: 'space-between',
|
|
59
59
|
background: 'none',
|
|
60
|
-
padding: '
|
|
60
|
+
padding: '0',
|
|
61
61
|
border: 'none',
|
|
62
62
|
cursor: 'pointer',
|
|
63
63
|
transition: 'background-color 0.2s ease',
|
|
64
|
-
height: '
|
|
64
|
+
height: '40px',
|
|
65
65
|
};
|
|
66
66
|
exports.triggerTextStyles = {
|
|
67
67
|
...(0, util_1.ellipsis)(),
|
|
@@ -79,7 +79,7 @@ exports.contentStyles = {
|
|
|
79
79
|
};
|
|
80
80
|
exports.contentTextStyles = {
|
|
81
81
|
width: '100%',
|
|
82
|
-
padding: '
|
|
82
|
+
padding: '16px 0',
|
|
83
83
|
};
|
|
84
84
|
exports.chevronStyles = {
|
|
85
85
|
width: '16px',
|
package/package.json
CHANGED