@wireapp/react-ui-kit 9.52.1 → 9.54.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/lib/Form/Select/BaseSelect/BaseSelect.styles.d.ts +46 -0
- package/lib/Form/Select/BaseSelect/BaseSelect.styles.d.ts.map +1 -0
- package/lib/Form/Select/BaseSelect/BaseSelect.styles.js +160 -0
- package/lib/Form/Select/BaseSelect/BaseSelectDropdownIndicator.d.ts +3 -0
- package/lib/Form/Select/BaseSelect/BaseSelectDropdownIndicator.d.ts.map +1 -0
- package/lib/Form/Select/BaseSelect/BaseSelectDropdownIndicator.js +29 -0
- package/lib/Form/Select/ComboboxSelect/ComboboxSelect.d.ts +17 -0
- package/lib/Form/Select/ComboboxSelect/ComboboxSelect.d.ts.map +1 -0
- package/lib/Form/Select/ComboboxSelect/ComboboxSelect.js +44 -0
- package/lib/Form/Select/ComboboxSelect/ComboboxSelect.stories.d.ts +33 -0
- package/lib/Form/Select/ComboboxSelect/ComboboxSelect.stories.d.ts.map +1 -0
- package/lib/Form/Select/ComboboxSelect/ComboboxSelect.stories.js +115 -0
- package/lib/Form/Select/ComboboxSelect/ComboboxSelect.styles.d.ts +17 -0
- package/lib/Form/Select/ComboboxSelect/ComboboxSelect.styles.d.ts.map +1 -0
- package/lib/Form/Select/ComboboxSelect/ComboboxSelect.styles.js +113 -0
- package/lib/Form/Select/Select.d.ts.map +1 -0
- package/lib/Form/{Select.js → Select/Select.js} +19 -13
- package/lib/Form/Select/Select.stories.d.ts +110 -0
- package/lib/Form/Select/Select.stories.d.ts.map +1 -0
- package/lib/Form/{Select.stories.js → Select/Select.stories.js} +8 -19
- package/lib/Form/Select/Select.styles.d.ts +14 -0
- package/lib/Form/Select/Select.styles.d.ts.map +1 -0
- package/lib/Form/Select/Select.styles.js +91 -0
- package/lib/Form/Select/SelectContainer/SelectContainer.d.ts +3 -0
- package/lib/Form/Select/SelectContainer/SelectContainer.d.ts.map +1 -0
- package/lib/Form/Select/SelectContainer/SelectContainer.js +28 -0
- package/lib/Form/Select/SelectIndicatorsContainer/SelectIndicatorsContainer.d.ts +4 -0
- package/lib/Form/Select/SelectIndicatorsContainer/SelectIndicatorsContainer.d.ts.map +1 -0
- package/lib/Form/Select/SelectIndicatorsContainer/SelectIndicatorsContainer.js +29 -0
- package/lib/Form/Select/SelectMenu/SelectMenu.d.ts +4 -0
- package/lib/Form/Select/SelectMenu/SelectMenu.d.ts.map +1 -0
- package/lib/Form/Select/SelectMenu/SelectMenu.js +13 -0
- package/lib/Form/Select/SelectMenuList/SelectMenuList.d.ts +6 -0
- package/lib/Form/Select/SelectMenuList/SelectMenuList.d.ts.map +1 -0
- package/lib/Form/Select/SelectMenuList/SelectMenuList.js +39 -0
- package/lib/Form/Select/SelectMenuList/SelectMenuList.styles.d.ts +5 -0
- package/lib/Form/Select/SelectMenuList/SelectMenuList.styles.d.ts.map +1 -0
- package/lib/Form/{SelectComponents.styles.js → Select/SelectMenuList/SelectMenuList.styles.js} +5 -5
- package/lib/Form/Select/SelectOption/SelectOption.d.ts +5 -0
- package/lib/Form/Select/SelectOption/SelectOption.d.ts.map +1 -0
- package/lib/Form/Select/SelectOption/SelectOption.js +53 -0
- package/lib/Form/Select/SelectValueContainer/SelectValueContainer.d.ts +4 -0
- package/lib/Form/Select/SelectValueContainer/SelectValueContainer.d.ts.map +1 -0
- package/lib/Form/Select/SelectValueContainer/SelectValueContainer.js +21 -0
- package/lib/Form/index.d.ts +2 -1
- package/lib/Form/index.d.ts.map +1 -1
- package/lib/Form/index.js +2 -1
- package/lib/Misc/Breadcrumbs/BreadcrumbItem/BreadcrumbItem.d.ts +3 -2
- package/lib/Misc/Breadcrumbs/BreadcrumbItem/BreadcrumbItem.d.ts.map +1 -1
- package/lib/Misc/Breadcrumbs/BreadcrumbItem/BreadcrumbItem.js +2 -2
- package/lib/Misc/Breadcrumbs/BreadcrumbItem/BreadcrumbItem.styles.d.ts.map +1 -1
- package/lib/Misc/Breadcrumbs/BreadcrumbItem/BreadcrumbItem.styles.js +6 -1
- package/lib/Misc/Breadcrumbs/Breadcrumbs.d.ts +2 -0
- package/lib/Misc/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
- package/lib/Misc/Breadcrumbs/Breadcrumbs.js +2 -20
- package/lib/Misc/Breadcrumbs/Breadcrumbs.stories.d.ts +2 -0
- package/lib/Misc/Breadcrumbs/Breadcrumbs.stories.d.ts.map +1 -1
- package/lib/Misc/Breadcrumbs/Breadcrumbs.stories.js +14 -1
- package/lib/Misc/Breadcrumbs/CombainedBreadcrumbs/CombainedBreadcrumbs.d.ts +2 -0
- package/lib/Misc/Breadcrumbs/CombainedBreadcrumbs/CombainedBreadcrumbs.d.ts.map +1 -1
- package/lib/Misc/Breadcrumbs/CombainedBreadcrumbs/CombainedBreadcrumbs.js +1 -19
- package/lib/Misc/Breadcrumbs/CombainedBreadcrumbs/CombainedBreadcrumbs.styles.d.ts +1 -0
- package/lib/Misc/Breadcrumbs/CombainedBreadcrumbs/CombainedBreadcrumbs.styles.d.ts.map +1 -1
- package/lib/Misc/Breadcrumbs/CombainedBreadcrumbs/CombainedBreadcrumbs.styles.js +6 -1
- package/package.json +3 -3
- package/lib/Form/Select.d.ts.map +0 -1
- package/lib/Form/Select.stories.d.ts +0 -16
- package/lib/Form/Select.stories.d.ts.map +0 -1
- package/lib/Form/SelectComponents.d.ts +0 -16
- package/lib/Form/SelectComponents.d.ts.map +0 -1
- package/lib/Form/SelectComponents.js +0 -93
- package/lib/Form/SelectComponents.styles.d.ts +0 -5
- package/lib/Form/SelectComponents.styles.d.ts.map +0 -1
- package/lib/Form/SelectStyles.d.ts +0 -2802
- package/lib/Form/SelectStyles.d.ts.map +0 -1
- package/lib/Form/SelectStyles.js +0 -227
- /package/lib/Form/{Select.d.ts → Select/Select.d.ts} +0 -0
|
@@ -7,36 +7,42 @@ exports.Select = void 0;
|
|
|
7
7
|
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
8
8
|
const react_1 = require("@emotion/react");
|
|
9
9
|
const react_select_1 = __importDefault(require("react-select"));
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
10
|
+
const BaseSelectDropdownIndicator_1 = require("./BaseSelect/BaseSelectDropdownIndicator");
|
|
11
|
+
const Select_styles_1 = require("./Select.styles");
|
|
12
|
+
const SelectContainer_1 = require("./SelectContainer/SelectContainer");
|
|
13
|
+
const SelectIndicatorsContainer_1 = require("./SelectIndicatorsContainer/SelectIndicatorsContainer");
|
|
14
|
+
const SelectMenu_1 = require("./SelectMenu/SelectMenu");
|
|
15
|
+
const SelectMenuList_1 = require("./SelectMenuList/SelectMenuList");
|
|
16
|
+
const SelectOption_1 = require("./SelectOption/SelectOption");
|
|
17
|
+
const SelectValueContainer_1 = require("./SelectValueContainer/SelectValueContainer");
|
|
18
|
+
const enums_1 = require("../../types/enums");
|
|
19
|
+
const InputLabel_1 = require("../InputLabel");
|
|
14
20
|
const Select = ({ id, label, error, helperText, disabled = false, dataUieName, options, isMulti, wrapperCSS = {}, menuCSS = {}, selectControlCSS = {}, selectContainerCSS = {}, markInvalid = false, required = false, isSearchable = false, overlayMenu = true, menuListHeading, ...props }) => {
|
|
15
21
|
const theme = (0, react_1.useTheme)();
|
|
16
22
|
const hasError = !!error;
|
|
17
23
|
return ((0, jsx_runtime_1.jsxs)("div", {
|
|
18
24
|
// eslint-disable-next-line jsx-a11y/no-autofocus
|
|
19
|
-
autoFocus: (0,
|
|
25
|
+
autoFocus: (0, SelectOption_1.isGroup)(options), css: (theme) => ({
|
|
20
26
|
marginBottom: markInvalid ? '2px' : '20px',
|
|
21
27
|
width: '100%',
|
|
22
28
|
'&:focus-within label': {
|
|
23
29
|
color: theme.general.primaryColor,
|
|
24
30
|
},
|
|
25
31
|
...wrapperCSS,
|
|
26
|
-
}), "data-uie-name": dataUieName, children: [label && ((0, jsx_runtime_1.jsx)(InputLabel_1.InputLabel, { htmlFor: id, markInvalid: markInvalid, isRequired: required, children: label })), (0, jsx_runtime_1.jsx)(react_select_1.default, { id: id, styles: (0,
|
|
32
|
+
}), "data-uie-name": dataUieName, children: [label && ((0, jsx_runtime_1.jsx)(InputLabel_1.InputLabel, { htmlFor: id, markInvalid: markInvalid, isRequired: required, children: label })), (0, jsx_runtime_1.jsx)(react_select_1.default, { id: id, styles: (0, Select_styles_1.customStyles)({
|
|
27
33
|
theme: theme,
|
|
28
34
|
markInvalid,
|
|
29
35
|
menuPosition: overlayMenu ? 'absolute' : 'relative',
|
|
30
36
|
controlCSS: selectControlCSS,
|
|
31
37
|
containerCSS: selectContainerCSS,
|
|
32
38
|
}), components: {
|
|
33
|
-
SelectContainer:
|
|
34
|
-
DropdownIndicator:
|
|
35
|
-
Option: (0,
|
|
36
|
-
Menu: (0,
|
|
37
|
-
ValueContainer:
|
|
38
|
-
IndicatorsContainer:
|
|
39
|
-
...(menuListHeading && { MenuList: (0,
|
|
39
|
+
SelectContainer: SelectContainer_1.SelectContainer,
|
|
40
|
+
DropdownIndicator: BaseSelectDropdownIndicator_1.BaseSelectDropdownIndicator,
|
|
41
|
+
Option: (0, SelectOption_1.SelectOption)(dataUieName),
|
|
42
|
+
Menu: (0, SelectMenu_1.SelectMenu)(dataUieName, menuCSS),
|
|
43
|
+
ValueContainer: SelectValueContainer_1.SelectValueContainer,
|
|
44
|
+
IndicatorsContainer: SelectIndicatorsContainer_1.SelectIndicatorsContainer,
|
|
45
|
+
...(menuListHeading && { MenuList: (0, SelectMenuList_1.SelectMenuList)(menuListHeading, dataUieName) }),
|
|
40
46
|
}, tabIndex: enums_1.TabIndex.UNFOCUSABLE, isDisabled: disabled, hideSelectedOptions: false, isSearchable: isSearchable, isClearable: false, closeMenuOnSelect: !isMulti, isMulti: isMulti, options: options, ...props }), !hasError && helperText && ((0, jsx_runtime_1.jsx)("p", { css: (theme) => ({
|
|
41
47
|
fontSize: theme.fontSizes.small,
|
|
42
48
|
fontWeight: 400,
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: <IsMulti extends boolean = false, Group extends import("react-select").GroupBase<import("./Select").Option> = import("react-select").GroupBase<import("./Select").Option>>({ id, label, error, helperText, disabled, dataUieName, options, isMulti, wrapperCSS, menuCSS, selectControlCSS, selectContainerCSS, markInvalid, required, isSearchable, overlayMenu, menuListHeading, ...props }: import("./Select").SelectProps<IsMulti, Group>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
decorators: ((Story: import("@storybook/csf").PartialStoryFn<import("@storybook/react").ReactRenderer, {
|
|
9
|
+
id: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
dataUieName: string;
|
|
12
|
+
options: import("react-select").GroupBase<import("./Select").Option>[] | import("./Select").Option[];
|
|
13
|
+
menuCSS?: import("@emotion/serialize").CSSObject;
|
|
14
|
+
wrapperCSS?: import("@emotion/serialize").CSSObject;
|
|
15
|
+
selectControlCSS?: import("@emotion/serialize").CSSObject;
|
|
16
|
+
selectContainerCSS?: import("@emotion/serialize").CSSObject;
|
|
17
|
+
label?: string;
|
|
18
|
+
helperText?: string;
|
|
19
|
+
error?: import("react").ReactElement;
|
|
20
|
+
markInvalid?: boolean;
|
|
21
|
+
required?: boolean;
|
|
22
|
+
isMulti?: boolean;
|
|
23
|
+
isSearchable?: boolean;
|
|
24
|
+
overlayMenu?: boolean;
|
|
25
|
+
menuListHeading?: string;
|
|
26
|
+
className?: string;
|
|
27
|
+
classNames?: import("react-select").ClassNamesConfig<import("./Select").Option, boolean, import("react-select").GroupBase<import("./Select").Option>>;
|
|
28
|
+
form?: string;
|
|
29
|
+
name?: string;
|
|
30
|
+
placeholder?: import("react").ReactNode;
|
|
31
|
+
autoFocus?: boolean;
|
|
32
|
+
tabIndex?: number;
|
|
33
|
+
'aria-errormessage'?: import("react").AriaAttributes["aria-errormessage"];
|
|
34
|
+
'aria-invalid'?: import("react").AriaAttributes["aria-invalid"];
|
|
35
|
+
'aria-label'?: import("react").AriaAttributes["aria-label"];
|
|
36
|
+
'aria-labelledby'?: import("react").AriaAttributes["aria-labelledby"];
|
|
37
|
+
'aria-live'?: import("react").AriaAttributes["aria-live"];
|
|
38
|
+
onFocus?: import("react").FocusEventHandler<HTMLInputElement>;
|
|
39
|
+
onBlur?: import("react").FocusEventHandler<HTMLInputElement>;
|
|
40
|
+
onKeyDown?: import("react").KeyboardEventHandler<HTMLDivElement>;
|
|
41
|
+
theme?: import("react-select").ThemeConfig;
|
|
42
|
+
styles?: import("react-select").StylesConfig<import("./Select").Option, boolean, import("react-select").GroupBase<import("./Select").Option>>;
|
|
43
|
+
isDisabled?: boolean;
|
|
44
|
+
isRtl?: boolean;
|
|
45
|
+
loadingMessage?: (obj: {
|
|
46
|
+
inputValue: string;
|
|
47
|
+
}) => import("react").ReactNode;
|
|
48
|
+
noOptionsMessage?: (obj: {
|
|
49
|
+
inputValue: string;
|
|
50
|
+
}) => import("react").ReactNode;
|
|
51
|
+
menuPosition?: import("react-select").MenuPosition;
|
|
52
|
+
isLoading?: boolean;
|
|
53
|
+
minMenuHeight?: number;
|
|
54
|
+
maxMenuHeight?: number;
|
|
55
|
+
menuPlacement?: import("react-select").MenuPlacement;
|
|
56
|
+
menuShouldScrollIntoView?: boolean;
|
|
57
|
+
ariaLiveMessages?: import("react-select").AriaLiveMessages<import("./Select").Option, boolean, import("react-select").GroupBase<import("./Select").Option>>;
|
|
58
|
+
backspaceRemovesValue?: boolean;
|
|
59
|
+
blurInputOnSelect?: boolean;
|
|
60
|
+
captureMenuScroll?: boolean;
|
|
61
|
+
classNamePrefix?: string | null;
|
|
62
|
+
closeMenuOnSelect?: boolean;
|
|
63
|
+
closeMenuOnScroll?: boolean | ((event: Event) => boolean);
|
|
64
|
+
components?: Partial<import("react-select/dist/declarations/src/components").SelectComponents<import("./Select").Option, boolean, import("react-select").GroupBase<import("./Select").Option>>>;
|
|
65
|
+
controlShouldRenderValue?: boolean;
|
|
66
|
+
delimiter?: string;
|
|
67
|
+
escapeClearsValue?: boolean;
|
|
68
|
+
filterOption?: (option: import("react-select").FilterOptionOption<import("./Select").Option>, inputValue: string) => boolean;
|
|
69
|
+
formatGroupLabel?: (group: import("react-select").GroupBase<import("./Select").Option>) => import("react").ReactNode;
|
|
70
|
+
formatOptionLabel?: (data: import("./Select").Option, formatOptionLabelMeta: import("react-select").FormatOptionLabelMeta<import("./Select").Option>) => import("react").ReactNode;
|
|
71
|
+
getOptionLabel?: import("react-select").GetOptionLabel<import("./Select").Option>;
|
|
72
|
+
getOptionValue?: import("react-select").GetOptionValue<import("./Select").Option>;
|
|
73
|
+
hideSelectedOptions?: boolean;
|
|
74
|
+
inputId?: string;
|
|
75
|
+
instanceId?: number | string;
|
|
76
|
+
isClearable?: boolean;
|
|
77
|
+
isOptionDisabled?: (option: import("./Select").Option, selectValue: import("react-select").Options<import("./Select").Option>) => boolean;
|
|
78
|
+
isOptionSelected?: (option: import("./Select").Option, selectValue: import("react-select").Options<import("./Select").Option>) => boolean;
|
|
79
|
+
menuPortalTarget?: HTMLElement | null;
|
|
80
|
+
menuShouldBlockScroll?: boolean;
|
|
81
|
+
onMenuScrollToTop?: (event: WheelEvent | TouchEvent) => void;
|
|
82
|
+
onMenuScrollToBottom?: (event: WheelEvent | TouchEvent) => void;
|
|
83
|
+
openMenuOnFocus?: boolean;
|
|
84
|
+
openMenuOnClick?: boolean;
|
|
85
|
+
pageSize?: number;
|
|
86
|
+
screenReaderStatus?: (obj: {
|
|
87
|
+
count: number;
|
|
88
|
+
}) => string;
|
|
89
|
+
tabSelectsValue?: boolean;
|
|
90
|
+
unstyled?: boolean;
|
|
91
|
+
value?: import("react-select").PropsValue<import("./Select").Option>;
|
|
92
|
+
onChange?: (newValue: import("./Select").Option | import("react-select").MultiValue<import("./Select").Option>, actionMeta: import("react-select").ActionMeta<import("./Select").Option>) => void;
|
|
93
|
+
inputValue?: string;
|
|
94
|
+
onInputChange?: (newValue: string, actionMeta: import("react-select").InputActionMeta) => void;
|
|
95
|
+
onMenuOpen?: () => void;
|
|
96
|
+
onMenuClose?: () => void;
|
|
97
|
+
menuIsOpen?: boolean;
|
|
98
|
+
defaultInputValue?: string;
|
|
99
|
+
defaultMenuIsOpen?: boolean;
|
|
100
|
+
defaultValue?: import("react-select").PropsValue<import("./Select").Option>;
|
|
101
|
+
}>) => import("@emotion/react/jsx-runtime").JSX.Element)[];
|
|
102
|
+
tags: string[];
|
|
103
|
+
};
|
|
104
|
+
export default meta;
|
|
105
|
+
type Story = StoryObj<typeof meta>;
|
|
106
|
+
export declare const Default: Story;
|
|
107
|
+
export declare const WithLabel: Story;
|
|
108
|
+
export declare const Invalid: Story;
|
|
109
|
+
export declare const Disabled: Story;
|
|
110
|
+
//# sourceMappingURL=Select.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select.stories.d.ts","sourceRoot":"","sources":["../../../src/Form/Select/Select.stories.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAO,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAUrD,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAcqB,CAAC;AAEhC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAOrB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAQvB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAQrB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAQtB,CAAC"}
|
|
@@ -1,27 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Wire
|
|
4
|
-
* Copyright (C) 2025 Wire Swiss GmbH
|
|
5
|
-
*
|
|
6
|
-
* This program is free software: you can redistribute it and/or modify
|
|
7
|
-
* it under the terms of the GNU General Public License as published by
|
|
8
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
-
* (at your option) any later version.
|
|
10
|
-
*
|
|
11
|
-
* This program is distributed in the hope that it will be useful,
|
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
-
* GNU General Public License for more details.
|
|
15
|
-
*
|
|
16
|
-
* You should have received a copy of the GNU General Public License
|
|
17
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
3
|
exports.Disabled = exports.Invalid = exports.WithLabel = exports.Default = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
22
5
|
const Select_1 = require("./Select");
|
|
23
6
|
const options = [
|
|
24
|
-
{ value: '', label: 'Select an option' },
|
|
25
7
|
{ value: '1', label: 'Option 1' },
|
|
26
8
|
{ value: '2', label: 'Option 2' },
|
|
27
9
|
{ value: '3', label: 'Option 3' },
|
|
@@ -32,11 +14,15 @@ const meta = {
|
|
|
32
14
|
parameters: {
|
|
33
15
|
layout: 'centered',
|
|
34
16
|
},
|
|
17
|
+
decorators: [
|
|
18
|
+
Story => ((0, jsx_runtime_1.jsx)("div", { style: { width: '350px' }, children: (0, jsx_runtime_1.jsx)(Story, {}) })),
|
|
19
|
+
],
|
|
35
20
|
tags: ['autodocs'],
|
|
36
21
|
};
|
|
37
22
|
exports.default = meta;
|
|
38
23
|
exports.Default = {
|
|
39
24
|
args: {
|
|
25
|
+
placeholder: 'Select an option',
|
|
40
26
|
id: 'default-select',
|
|
41
27
|
dataUieName: 'default-select',
|
|
42
28
|
options,
|
|
@@ -44,6 +30,7 @@ exports.Default = {
|
|
|
44
30
|
};
|
|
45
31
|
exports.WithLabel = {
|
|
46
32
|
args: {
|
|
33
|
+
placeholder: 'Select an option',
|
|
47
34
|
id: 'select-example',
|
|
48
35
|
dataUieName: 'select-with-label',
|
|
49
36
|
options,
|
|
@@ -52,6 +39,7 @@ exports.WithLabel = {
|
|
|
52
39
|
};
|
|
53
40
|
exports.Invalid = {
|
|
54
41
|
args: {
|
|
42
|
+
placeholder: 'Select an option',
|
|
55
43
|
id: 'invalid-select',
|
|
56
44
|
dataUieName: 'invalid-select',
|
|
57
45
|
options,
|
|
@@ -60,6 +48,7 @@ exports.Invalid = {
|
|
|
60
48
|
};
|
|
61
49
|
exports.Disabled = {
|
|
62
50
|
args: {
|
|
51
|
+
placeholder: 'Select an option',
|
|
63
52
|
id: 'disabled-select',
|
|
64
53
|
dataUieName: 'disabled-select',
|
|
65
54
|
options,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CSSObject } from '@emotion/react';
|
|
2
|
+
import { GroupBase, StylesConfig } from 'react-select';
|
|
3
|
+
import { Option } from './Select';
|
|
4
|
+
import { Theme } from '../../Layout';
|
|
5
|
+
interface CustomStylesParams {
|
|
6
|
+
theme: Theme;
|
|
7
|
+
markInvalid?: boolean;
|
|
8
|
+
menuPosition?: 'absolute' | 'relative';
|
|
9
|
+
controlCSS: CSSObject;
|
|
10
|
+
containerCSS: CSSObject;
|
|
11
|
+
}
|
|
12
|
+
export declare const customStyles: ({ theme, markInvalid, menuPosition, controlCSS, containerCSS, }: CustomStylesParams) => StylesConfig<Option, false, GroupBase<Option>>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=Select.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select.styles.d.ts","sourceRoot":"","sources":["../../../src/Form/Select/Select.styles.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAC,SAAS,EAAE,YAAY,EAAC,MAAM,cAAc,CAAC;AAWrD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhC,OAAO,EAAC,KAAK,EAAC,MAAM,cAAc,CAAC;AAEnC,UAAU,kBAAkB;IAC1B,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IACvC,UAAU,EAAE,SAAS,CAAC;IACtB,YAAY,EAAE,SAAS,CAAC;CACzB;AAED,eAAO,MAAM,YAAY,oEAMtB,kBAAkB,KAAG,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,CAoEnE,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Wire
|
|
4
|
+
* Copyright (C) 2022 Wire Swiss GmbH
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* This program is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU General Public License
|
|
17
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.customStyles = void 0;
|
|
22
|
+
const BaseSelect_styles_1 = require("./BaseSelect/BaseSelect.styles");
|
|
23
|
+
const SelectOption_1 = require("./SelectOption/SelectOption");
|
|
24
|
+
const customStyles = ({ theme, markInvalid = false, menuPosition = 'absolute', controlCSS, containerCSS, }) => ({
|
|
25
|
+
indicatorSeparator: BaseSelect_styles_1.baseIndicatorSeparatorStyles,
|
|
26
|
+
indicatorsContainer: provided => provided,
|
|
27
|
+
control: (_provided, { isDisabled, selectProps }) => (0, BaseSelect_styles_1.baseControlStyles)({ theme, isDisabled, markInvalid, selectProps, controlCSS }),
|
|
28
|
+
dropdownIndicator: (provided, selectProps) => ({
|
|
29
|
+
...provided,
|
|
30
|
+
...(0, BaseSelect_styles_1.baseDropdownIndicatorStyles)({ theme, selectProps }),
|
|
31
|
+
}),
|
|
32
|
+
container: (_, { options }) => (0, SelectOption_1.isGroup)(options)
|
|
33
|
+
? {
|
|
34
|
+
'& > div': {
|
|
35
|
+
display: 'inline',
|
|
36
|
+
position: 'relative',
|
|
37
|
+
top: '-10px',
|
|
38
|
+
...containerCSS,
|
|
39
|
+
},
|
|
40
|
+
}
|
|
41
|
+
: (0, BaseSelect_styles_1.baseContainerStyles)(containerCSS),
|
|
42
|
+
menu: (provided, { options }) => ({
|
|
43
|
+
...provided,
|
|
44
|
+
...(0, BaseSelect_styles_1.baseMenuStyles)({ theme, menuPosition }),
|
|
45
|
+
...((0, SelectOption_1.isGroup)(options) && {
|
|
46
|
+
minWidth: '400px',
|
|
47
|
+
}),
|
|
48
|
+
}),
|
|
49
|
+
menuList: provided => ({
|
|
50
|
+
...provided,
|
|
51
|
+
...(0, BaseSelect_styles_1.baseMenuListStyles)(),
|
|
52
|
+
}),
|
|
53
|
+
option: (provided, { isMulti, isDisabled, isFocused, isSelected, options, data }) => ({
|
|
54
|
+
...provided,
|
|
55
|
+
...(0, BaseSelect_styles_1.baseOptionStyles)({ theme, isMulti, isDisabled, isFocused, isSelected }),
|
|
56
|
+
padding: (0, SelectOption_1.isGroup)(options) ? '6px 16px' : '10px 18px',
|
|
57
|
+
fontWeight: isSelected && (0, SelectOption_1.isGroup)(options) ? 600 : 400,
|
|
58
|
+
...((0, SelectOption_1.isGroup)(options) && {
|
|
59
|
+
'div > svg': {
|
|
60
|
+
fill: theme.general.contrastColor,
|
|
61
|
+
},
|
|
62
|
+
}),
|
|
63
|
+
...(!(0, SelectOption_1.isGroup)(options) && {
|
|
64
|
+
'&:not(:last-of-type)': {
|
|
65
|
+
borderBottom: `1px solid ${theme.Select.borderColor}`,
|
|
66
|
+
},
|
|
67
|
+
}),
|
|
68
|
+
...(!(0, SelectOption_1.isGroup)(options) && {
|
|
69
|
+
'&:first-of-type': {
|
|
70
|
+
borderRadius: '0',
|
|
71
|
+
},
|
|
72
|
+
}),
|
|
73
|
+
...((0, SelectOption_1.isGroup)(options) && {
|
|
74
|
+
textAlign: 'left',
|
|
75
|
+
}),
|
|
76
|
+
'&:last-of-type': {
|
|
77
|
+
...(!(0, SelectOption_1.isGroup)(options) && { borderRadius: '0' }),
|
|
78
|
+
...((0, SelectOption_1.isGroup)(options) &&
|
|
79
|
+
!options[options.length - 1].options.includes(data) && {
|
|
80
|
+
borderBottom: `1px solid ${theme.Select.borderColor}`,
|
|
81
|
+
}),
|
|
82
|
+
},
|
|
83
|
+
}),
|
|
84
|
+
valueContainer: provided => ({
|
|
85
|
+
...provided,
|
|
86
|
+
padding: 0,
|
|
87
|
+
width: '100%',
|
|
88
|
+
display: 'grid',
|
|
89
|
+
}),
|
|
90
|
+
});
|
|
91
|
+
exports.customStyles = customStyles;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectContainer.d.ts","sourceRoot":"","sources":["../../../../src/Form/Select/SelectContainer/SelectContainer.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAa,cAAc,EAAC,MAAM,cAAc,CAAC;AAIxD,eAAO,MAAM,eAAe,UAAW,cAAc,qDAMpD,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SelectContainer = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
+
/*
|
|
6
|
+
* Wire
|
|
7
|
+
* Copyright (C) 2025 Wire Swiss GmbH
|
|
8
|
+
*
|
|
9
|
+
* This program is free software: you can redistribute it and/or modify
|
|
10
|
+
* it under the terms of the GNU General Public License as published by
|
|
11
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
12
|
+
* (at your option) any later version.
|
|
13
|
+
*
|
|
14
|
+
* This program is distributed in the hope that it will be useful,
|
|
15
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
* GNU General Public License for more details.
|
|
18
|
+
*
|
|
19
|
+
* You should have received a copy of the GNU General Public License
|
|
20
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
const react_select_1 = require("react-select");
|
|
24
|
+
const enums_1 = require("../../../types/enums");
|
|
25
|
+
const SelectContainer = (props) => {
|
|
26
|
+
return ((0, jsx_runtime_1.jsx)(react_select_1.components.SelectContainer, { ...props, children: (0, jsx_runtime_1.jsx)("div", { tabIndex: enums_1.TabIndex.FOCUSABLE, children: props.children }) }));
|
|
27
|
+
};
|
|
28
|
+
exports.SelectContainer = SelectContainer;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IndicatorsContainerProps } from 'react-select';
|
|
2
|
+
import { Option } from '../Select';
|
|
3
|
+
export declare const SelectIndicatorsContainer: ({ children, ...restProps }: IndicatorsContainerProps<Option>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=SelectIndicatorsContainer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectIndicatorsContainer.d.ts","sourceRoot":"","sources":["../../../../src/Form/Select/SelectIndicatorsContainer/SelectIndicatorsContainer.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAa,wBAAwB,EAAC,MAAM,cAAc,CAAC;AAElE,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AAEjC,eAAO,MAAM,yBAAyB,+BAA8B,wBAAwB,CAAC,MAAM,CAAC,qDAWnG,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SelectIndicatorsContainer = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
+
/*
|
|
6
|
+
* Wire
|
|
7
|
+
* Copyright (C) 2022 Wire Swiss GmbH
|
|
8
|
+
*
|
|
9
|
+
* This program is free software: you can redistribute it and/or modify
|
|
10
|
+
* it under the terms of the GNU General Public License as published by
|
|
11
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
12
|
+
* (at your option) any later version.
|
|
13
|
+
*
|
|
14
|
+
* This program is distributed in the hope that it will be useful,
|
|
15
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
* GNU General Public License for more details.
|
|
18
|
+
*
|
|
19
|
+
* You should have received a copy of the GNU General Public License
|
|
20
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
const react_select_1 = require("react-select");
|
|
24
|
+
const SelectIndicatorsContainer = ({ children, ...restProps }) => {
|
|
25
|
+
const value = restProps.getValue();
|
|
26
|
+
const displaySelectedOptionsCount = Array.isArray(value) && value.length > 1;
|
|
27
|
+
return ((0, jsx_runtime_1.jsxs)(react_select_1.components.IndicatorsContainer, { ...restProps, children: [displaySelectedOptionsCount && (0, jsx_runtime_1.jsxs)("div", { css: { fontWeight: 600 }, children: ["(+", value.length - 1, ")"] }), children] }));
|
|
28
|
+
};
|
|
29
|
+
exports.SelectIndicatorsContainer = SelectIndicatorsContainer;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CSSObject } from '@emotion/react';
|
|
2
|
+
import { MenuProps } from 'react-select';
|
|
3
|
+
export declare const SelectMenu: (dataUieName: string, css?: CSSObject) => (props: MenuProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=SelectMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectMenu.d.ts","sourceRoot":"","sources":["../../../../src/Form/Select/SelectMenu/SelectMenu.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAa,SAAS,EAAC,MAAM,cAAc,CAAC;AAGnD,eAAO,MAAM,UAAU,gBAAiB,MAAM,QAAQ,SAAS,aAAa,SAAS,qDAcpF,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SelectMenu = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
+
const react_select_1 = require("react-select");
|
|
6
|
+
// eslint-disable-next-line react/display-name
|
|
7
|
+
const SelectMenu = (dataUieName, css) => (props) => {
|
|
8
|
+
const { children } = props;
|
|
9
|
+
return ((0, jsx_runtime_1.jsx)(react_select_1.components.Menu, { ...props, css: css, children: (0, jsx_runtime_1.jsx)("div", { ...(dataUieName && {
|
|
10
|
+
'data-uie-name': `dropdown-${dataUieName}`,
|
|
11
|
+
}), children: children }) }));
|
|
12
|
+
};
|
|
13
|
+
exports.SelectMenu = SelectMenu;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MenuListProps } from 'react-select';
|
|
2
|
+
export declare const SelectMenuList: {
|
|
3
|
+
(menuListHeading: string, dataUieName: string): (props: MenuListProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
4
|
+
displayName: string;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=SelectMenuList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectMenuList.d.ts","sourceRoot":"","sources":["../../../../src/Form/Select/SelectMenuList/SelectMenuList.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAa,aAAa,EAAC,MAAM,cAAc,CAAC;AAQvD,eAAO,MAAM,cAAc;sBAAqB,MAAM,eAAe,MAAM,WAAa,aAAa;;CA0BpG,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SelectMenuList = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
+
/*
|
|
6
|
+
* Wire
|
|
7
|
+
* Copyright (C) 2022 Wire Swiss GmbH
|
|
8
|
+
*
|
|
9
|
+
* This program is free software: you can redistribute it and/or modify
|
|
10
|
+
* it under the terms of the GNU General Public License as published by
|
|
11
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
12
|
+
* (at your option) any later version.
|
|
13
|
+
*
|
|
14
|
+
* This program is distributed in the hope that it will be useful,
|
|
15
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
* GNU General Public License for more details.
|
|
18
|
+
*
|
|
19
|
+
* You should have received a copy of the GNU General Public License
|
|
20
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
const react_select_1 = require("react-select");
|
|
24
|
+
const SelectMenuList_styles_1 = require("./SelectMenuList.styles");
|
|
25
|
+
const Icon_1 = require("../../../Icon");
|
|
26
|
+
// eslint-disable-next-line react/display-name
|
|
27
|
+
const SelectMenuList = (menuListHeading, dataUieName) => (props) => {
|
|
28
|
+
const { selectProps, children } = props;
|
|
29
|
+
const handleClose = () => {
|
|
30
|
+
if (selectProps && selectProps.onMenuClose) {
|
|
31
|
+
selectProps.onMenuClose();
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
return ((0, jsx_runtime_1.jsx)(react_select_1.components.MenuList, { ...props, children: (0, jsx_runtime_1.jsxs)("div", { ...(dataUieName && {
|
|
35
|
+
'data-uie-name': `menu-list-${dataUieName}`,
|
|
36
|
+
}), children: [(0, jsx_runtime_1.jsxs)("div", { css: (theme) => (0, SelectMenuList_styles_1.headingContainerStyles)(theme), children: [menuListHeading, (0, jsx_runtime_1.jsx)("button", { onClick: handleClose, css: SelectMenuList_styles_1.closeButtonStyles, "aria-label": `Close: ${menuListHeading}`, children: (0, jsx_runtime_1.jsx)(Icon_1.CloseIcon, { width: 16, height: 16 }) })] }), children] }) }));
|
|
37
|
+
};
|
|
38
|
+
exports.SelectMenuList = SelectMenuList;
|
|
39
|
+
exports.SelectMenuList.displayName = 'SelectMenuList';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectMenuList.styles.d.ts","sourceRoot":"","sources":["../../../../src/Form/Select/SelectMenuList/SelectMenuList.styles.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAEzC,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;AAEtC,eAAO,MAAM,sBAAsB,UAAW,KAAK,KAAG,SAOpD,CAAC;AAEH,eAAO,MAAM,iBAAiB,EAAE,SAO/B,CAAC"}
|
package/lib/Form/{SelectComponents.styles.js → Select/SelectMenuList/SelectMenuList.styles.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
3
|
* Wire
|
|
4
|
-
* Copyright (C)
|
|
4
|
+
* Copyright (C) 2025 Wire Swiss GmbH
|
|
5
5
|
*
|
|
6
6
|
* This program is free software: you can redistribute it and/or modify
|
|
7
7
|
* it under the terms of the GNU General Public License as published by
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.
|
|
22
|
-
const
|
|
21
|
+
exports.closeButtonStyles = exports.headingContainerStyles = void 0;
|
|
22
|
+
const headingContainerStyles = (theme) => ({
|
|
23
23
|
display: 'flex',
|
|
24
24
|
justifyContent: 'space-between',
|
|
25
25
|
alignItems: 'center',
|
|
@@ -27,8 +27,8 @@ const menuListHeadingContainerStyles = (theme) => ({
|
|
|
27
27
|
fontWeight: 600,
|
|
28
28
|
padding: '8px 16px',
|
|
29
29
|
});
|
|
30
|
-
exports.
|
|
31
|
-
exports.
|
|
30
|
+
exports.headingContainerStyles = headingContainerStyles;
|
|
31
|
+
exports.closeButtonStyles = {
|
|
32
32
|
background: 'transparent',
|
|
33
33
|
border: 'none',
|
|
34
34
|
cursor: 'pointer',
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { GroupBase, OptionProps, OptionsOrGroups } from 'react-select';
|
|
2
|
+
import { Option } from '../Select';
|
|
3
|
+
export declare const SelectOption: (dataUieName: string) => (props: OptionProps<Option>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare const isGroup: (options: OptionsOrGroups<Option, GroupBase<Option>>) => options is GroupBase<Option>[];
|
|
5
|
+
//# sourceMappingURL=SelectOption.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectOption.d.ts","sourceRoot":"","sources":["../../../../src/Form/Select/SelectOption/SelectOption.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAa,SAAS,EAAE,WAAW,EAAE,eAAe,EAAC,MAAM,cAAc,CAAC;AAIjF,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AAGjC,eAAO,MAAM,YAAY,gBAAiB,MAAM,aAAa,WAAW,CAAC,MAAM,CAAC,qDAsD/E,CAAC;AAEF,eAAO,MAAM,OAAO,YAAa,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,KAAG,OAAO,IAAI,SAAS,CAAC,MAAM,CAAC,EAEzG,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isGroup = exports.SelectOption = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
|
+
/*
|
|
6
|
+
* Wire
|
|
7
|
+
* Copyright (C) 2022 Wire Swiss GmbH
|
|
8
|
+
*
|
|
9
|
+
* This program is free software: you can redistribute it and/or modify
|
|
10
|
+
* it under the terms of the GNU General Public License as published by
|
|
11
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
12
|
+
* (at your option) any later version.
|
|
13
|
+
*
|
|
14
|
+
* This program is distributed in the hope that it will be useful,
|
|
15
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
* GNU General Public License for more details.
|
|
18
|
+
*
|
|
19
|
+
* You should have received a copy of the GNU General Public License
|
|
20
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
const react_select_1 = require("react-select");
|
|
24
|
+
const Icon_1 = require("../../../Icon");
|
|
25
|
+
// eslint-disable-next-line react/display-name
|
|
26
|
+
const SelectOption = (dataUieName) => (props) => {
|
|
27
|
+
const { children, data, isMulti, isSelected, options } = props;
|
|
28
|
+
return ((0, jsx_runtime_1.jsx)(react_select_1.components.Option, { ...props, children: (0, jsx_runtime_1.jsxs)("div", { css: {
|
|
29
|
+
...((isMulti || (0, exports.isGroup)(options)) && {
|
|
30
|
+
display: 'grid',
|
|
31
|
+
gridTemplateAreas: `"checkbox label"
|
|
32
|
+
". description"`,
|
|
33
|
+
gridTemplateColumns: '22px 1fr',
|
|
34
|
+
columnGap: (0, exports.isGroup)(options) ? '5px' : '10px',
|
|
35
|
+
}),
|
|
36
|
+
}, ...(dataUieName && {
|
|
37
|
+
'data-uie-name': `option-${dataUieName}`,
|
|
38
|
+
'data-uie-value': options.find(option => option.label === children)?.value,
|
|
39
|
+
'data-uie-selected': isSelected,
|
|
40
|
+
}), children: [isMulti && ((0, jsx_runtime_1.jsx)("input", { type: "checkbox", checked: isSelected, onChange: () => null, css: { gridArea: 'checkbox', width: 22, height: 22, cursor: 'pointer', placeSelf: 'center' } })), (0, exports.isGroup)(options) && (
|
|
41
|
+
//includes a checkmark character if it is selected and a group
|
|
42
|
+
(0, jsx_runtime_1.jsx)("div", { css: { width: 22, height: 22, cursor: 'pointer', placeSelf: 'center' }, children: isSelected ? (0, jsx_runtime_1.jsx)(Icon_1.CheckIcon, {}) : null })), (0, jsx_runtime_1.jsx)("div", { css: { gridArea: 'label', overflowWrap: 'break-word', overflow: 'hidden' }, children: children }), data && data.description && ((0, jsx_runtime_1.jsx)("p", { css: (theme) => ({
|
|
43
|
+
marginBottom: 0,
|
|
44
|
+
fontSize: theme.fontSizes.medium,
|
|
45
|
+
color: isSelected ? theme.Select.focusedDescriptionColor : theme.Input.labelColor,
|
|
46
|
+
gridArea: 'description',
|
|
47
|
+
}), children: data.description }))] }) }));
|
|
48
|
+
};
|
|
49
|
+
exports.SelectOption = SelectOption;
|
|
50
|
+
const isGroup = (options) => {
|
|
51
|
+
return options?.length > 0 && 'options' in options[0];
|
|
52
|
+
};
|
|
53
|
+
exports.isGroup = isGroup;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ValueContainerProps } from 'react-select';
|
|
2
|
+
import { Option } from '../Select';
|
|
3
|
+
export declare const SelectValueContainer: ({ children, ...restProps }: ValueContainerProps<Option>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=SelectValueContainer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectValueContainer.d.ts","sourceRoot":"","sources":["../../../../src/Form/Select/SelectValueContainer/SelectValueContainer.tsx"],"names":[],"mappings":"AAqBA,OAAO,EAAa,mBAAmB,EAAC,MAAM,cAAc,CAAC;AAE7D,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AAEjC,eAAO,MAAM,oBAAoB,+BAA8B,mBAAmB,CAAC,MAAM,CAAC,qDAIzF,CAAC"}
|