@stokr/components-library 4.2.2 → 4.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Button/Button.styles.d.ts +5 -1
- package/dist/components/CardTabs/CardTabs.styles.d.ts +34 -9
- package/dist/components/Checkbox/Checkbox.d.ts +3 -1
- package/dist/components/Checkbox/Checkbox.styles.d.ts +18 -4
- package/dist/components/Collapsible/Collapsible.styles.d.ts +18 -6
- package/dist/components/CopyToClipboardTooltip/CopyToClipboardTooltip.styles.d.ts +3 -1
- package/dist/components/FAQ/FAQ.d.ts +29 -0
- package/dist/components/FAQ/FAQ.js +18 -18
- package/dist/components/FAQ/FAQ.styles.d.ts +38 -0
- package/dist/components/FAQ/FAQ.styles.js +58 -1
- package/dist/components/InfoIcon/InfoIcon.styles.d.ts +8 -2
- package/dist/components/Input/Input.d.ts +3 -0
- package/dist/components/Input/Input.js +5 -2
- package/dist/components/Input/Input.styles.d.ts +13 -3
- package/dist/components/Input/Input.styles.js +57 -0
- package/dist/components/Input/Select.d.ts +57 -0
- package/dist/components/Input/Select.js +71 -94
- package/dist/components/Input/Select.styles.d.ts +79 -0
- package/dist/components/Input/Select.styles.js +68 -1
- package/dist/components/Lottie/LottieAnimation.d.ts +43 -0
- package/dist/components/Lottie/LottieAnimation.js +0 -12
- package/dist/components/Lottie/LottieAnimation.styles.d.ts +5 -0
- package/dist/components/Lottie/LottieAnimation.styles.js +3 -2
- package/dist/components/MaterialIcon/MaterialIcon.styles.d.ts +25 -5
- package/dist/components/Modal/Modal.js +21 -5
- package/dist/components/Modal/Modal.styles.d.ts +49 -15
- package/dist/components/Modal/Modal.styles.js +4 -3
- package/dist/components/Modal/SideModal.js +7 -71
- package/dist/components/Modal/SideModal.styles.d.ts +12 -4
- package/dist/components/Modal/SideModalParts.d.ts +6 -2
- package/dist/components/Modal/SuccessModal/SuccessModal.d.ts +42 -0
- package/dist/components/Modal/SuccessModal/SuccessModal.js +50 -38
- package/dist/components/Modal/bodyScrollLock.d.ts +6 -0
- package/dist/components/Modal/bodyScrollLock.js +80 -0
- package/dist/components/Section/Section.styles.d.ts +35 -7
- package/dist/components/Skeleton/Skeleton.styles.d.ts +9 -3
- package/dist/components/StepSidebar/MobileStepProgress.d.ts +12 -0
- package/dist/components/StepSidebar/MobileStepProgress.js +14 -0
- package/dist/components/StepSidebar/MobileStepProgress.styles.d.ts +15 -0
- package/dist/components/StepSidebar/MobileStepProgress.styles.js +42 -0
- package/dist/components/StepSidebar/StepProgress.d.ts +14 -0
- package/dist/components/StepSidebar/StepProgress.js +14 -0
- package/dist/components/StepSidebar/StepProgress.styles.d.ts +30 -0
- package/dist/components/StepSidebar/StepProgress.styles.js +103 -0
- package/dist/components/StepSidebar/StepSidebar.d.ts +34 -0
- package/dist/components/StepSidebar/StepSidebar.js +56 -0
- package/dist/components/StepSidebar/StepSidebar.styles.d.ts +54 -0
- package/dist/components/StepSidebar/StepSidebar.styles.js +171 -0
- package/dist/components/StokrLoader/StokrLoader.d.ts +3 -1
- package/dist/components/Text/Text.styles.d.ts +6 -2
- package/dist/components/Tooltip/Tooltip.styles.d.ts +6 -2
- package/dist/index.d.ts +35 -10
- package/dist/index.js +6 -0
- package/dist/styles/borderedField.d.ts +11 -0
- package/dist/styles/borderedField.js +56 -0
- package/dist/styles/rwd.d.ts +3 -1
- package/dist/utils/customHooks.d.ts +11 -4
- package/dist/utils/customHooks.js +14 -22
- package/package.json +13 -3
|
@@ -1,15 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
import { FieldVariant } from '../../styles/borderedField';
|
|
2
|
+
export declare const Label: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Merged<Omit<import('react').DetailedHTMLProps<import('react').LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "style"> & {
|
|
3
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
4
|
+
}, {
|
|
2
5
|
autoHeightLabel?: boolean;
|
|
3
6
|
isUp?: boolean;
|
|
4
7
|
active?: boolean;
|
|
5
8
|
error?: boolean;
|
|
9
|
+
$variant?: FieldVariant;
|
|
6
10
|
}>> & string;
|
|
7
|
-
export declare const InputWrap: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').
|
|
11
|
+
export declare const InputWrap: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Merged<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
12
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
13
|
+
}, {
|
|
8
14
|
autoHeightLabel?: boolean;
|
|
9
15
|
disabled?: boolean;
|
|
10
16
|
dashboard?: boolean;
|
|
11
17
|
error?: boolean;
|
|
18
|
+
$variant?: FieldVariant;
|
|
12
19
|
}>> & string;
|
|
13
|
-
export declare const Wrapper: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').
|
|
20
|
+
export declare const Wrapper: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Merged<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
21
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
22
|
+
}, {
|
|
14
23
|
inverted?: boolean;
|
|
24
|
+
$variant?: FieldVariant;
|
|
15
25
|
}>> & string;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
2
|
import theme from "../../styles/theme.js";
|
|
3
|
+
import { borderedFieldLabel, borderedFieldBox, borderedFieldText, borderedFieldPlaceholder, borderedFieldFocus, borderedFieldError, borderedFieldDisabled, BORDERED_BORDER } from "../../styles/borderedField.js";
|
|
4
|
+
import { radius } from "../../styles/spacing.js";
|
|
3
5
|
const Label = styled.label.withConfig({
|
|
4
6
|
shouldForwardProp: (props) => !["autoHeightLabel", "isUp", "active", "error"].includes(props)
|
|
5
7
|
})`
|
|
@@ -38,6 +40,18 @@ const Label = styled.label.withConfig({
|
|
|
38
40
|
${(props) => props.error && `
|
|
39
41
|
color: ${theme.cWarning};
|
|
40
42
|
`}
|
|
43
|
+
|
|
44
|
+
${(props) => props.$variant === "bordered" && css`
|
|
45
|
+
position: static;
|
|
46
|
+
z-index: auto;
|
|
47
|
+
top: auto;
|
|
48
|
+
left: auto;
|
|
49
|
+
height: auto;
|
|
50
|
+
transform: none;
|
|
51
|
+
pointer-events: auto;
|
|
52
|
+
${borderedFieldLabel}
|
|
53
|
+
color: ${props.error ? theme.cWarning : theme.cBlack};
|
|
54
|
+
`}
|
|
41
55
|
`;
|
|
42
56
|
const InputWrap = styled.div.withConfig({
|
|
43
57
|
shouldForwardProp: (props) => !["autoHeightLabel", "disabled", "dashboard", "error"].includes(props)
|
|
@@ -115,6 +129,42 @@ const InputWrap = styled.div.withConfig({
|
|
|
115
129
|
${(props) => props.error && `
|
|
116
130
|
color: ${theme.cWarning};
|
|
117
131
|
`}
|
|
132
|
+
|
|
133
|
+
${(props) => props.$variant === "bordered" && css`
|
|
134
|
+
& > input {
|
|
135
|
+
${borderedFieldBox}
|
|
136
|
+
${borderedFieldText}
|
|
137
|
+
height: 44px;
|
|
138
|
+
|
|
139
|
+
&::placeholder {
|
|
140
|
+
${borderedFieldPlaceholder}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
&:hover {
|
|
144
|
+
border-color: ${theme.cLightGrey};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
&:focus {
|
|
148
|
+
${borderedFieldFocus}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
${props.error && css`
|
|
152
|
+
&,
|
|
153
|
+
&:hover,
|
|
154
|
+
&:focus {
|
|
155
|
+
${borderedFieldError}
|
|
156
|
+
}
|
|
157
|
+
`}
|
|
158
|
+
|
|
159
|
+
${props.disabled && css`
|
|
160
|
+
&,
|
|
161
|
+
&:hover,
|
|
162
|
+
&:focus {
|
|
163
|
+
${borderedFieldDisabled}
|
|
164
|
+
}
|
|
165
|
+
`}
|
|
166
|
+
}
|
|
167
|
+
`}
|
|
118
168
|
`;
|
|
119
169
|
const Wrapper = styled.div.withConfig({
|
|
120
170
|
shouldForwardProp: (props) => !["inverted"].includes(props)
|
|
@@ -146,6 +196,13 @@ const Wrapper = styled.div.withConfig({
|
|
|
146
196
|
}
|
|
147
197
|
}
|
|
148
198
|
`}
|
|
199
|
+
|
|
200
|
+
${(props) => props.$variant === "bordered" && css`
|
|
201
|
+
input:-webkit-autofill {
|
|
202
|
+
border: ${BORDERED_BORDER};
|
|
203
|
+
border-radius: ${radius.lg};
|
|
204
|
+
}
|
|
205
|
+
`}
|
|
149
206
|
`;
|
|
150
207
|
export {
|
|
151
208
|
InputWrap,
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { GroupBase, Props as ReactSelectProps } from 'react-select';
|
|
3
|
+
import { FieldVariant } from '../../styles/borderedField';
|
|
4
|
+
import { SelectIcon, SelectMenu, SelectOption, SelectControl, SelectWrapper, SelectMenuList, SelectContainer, SelectValueContainer } from './Select.styles';
|
|
5
|
+
export type SelectValue = string | number;
|
|
6
|
+
export interface SelectOptionItem {
|
|
7
|
+
key?: string;
|
|
8
|
+
value: SelectValue;
|
|
9
|
+
label: ReactNode;
|
|
10
|
+
/** URL string (rendered as <img>) or a React node (e.g. an SVG flag) shown left of the label. */
|
|
11
|
+
icon?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/** What `onChange` / `onBlur` / `onFocus` receive. `value` is the option value, or an array of values in `multiple` mode. */
|
|
14
|
+
export interface SelectChange {
|
|
15
|
+
name: string;
|
|
16
|
+
value: any;
|
|
17
|
+
}
|
|
18
|
+
type PassthroughProps = ReactSelectProps<any, boolean, GroupBase<any>>;
|
|
19
|
+
type OwnPropKeys = 'id' | 'name' | 'value' | 'options' | 'placeholder' | 'onChange' | 'onBlur' | 'onFocus' | 'formatCreateLabel' | 'dataCy' | 'variant';
|
|
20
|
+
export interface SelectProps extends Omit<PassthroughProps, OwnPropKeys> {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
label?: string;
|
|
24
|
+
/** string|number for single mode, array for multi mode. */
|
|
25
|
+
value?: SelectValue | readonly SelectValue[];
|
|
26
|
+
options: readonly SelectOptionItem[];
|
|
27
|
+
placeholder?: string;
|
|
28
|
+
/** Shown as an error state once `touched` is true. */
|
|
29
|
+
error?: boolean;
|
|
30
|
+
touched?: boolean;
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
/** Lets the user type to filter the options. */
|
|
33
|
+
search?: boolean;
|
|
34
|
+
/** Lets the user add a value that is not in `options`. */
|
|
35
|
+
creatable?: boolean;
|
|
36
|
+
/** Multi-select: checkbox options + chips list rendered below the field. */
|
|
37
|
+
multiple?: boolean;
|
|
38
|
+
/** Multi mode: values that cannot be removed (chip ✕ disabled, can't be deselected). */
|
|
39
|
+
lockedValues?: readonly SelectValue[];
|
|
40
|
+
/** Max menu height in px. */
|
|
41
|
+
menuHeight?: number;
|
|
42
|
+
/** Heading shown above the chips list in multi mode (default: "Selected"). */
|
|
43
|
+
selectedLabel?: string;
|
|
44
|
+
/** Input-like floating label behavior: label starts in-field, moves up on focus/value. Ignored when `bordered`. */
|
|
45
|
+
floatingLabel?: boolean;
|
|
46
|
+
formatCreateLabel?: (input: string) => ReactNode;
|
|
47
|
+
onChange?(field: SelectChange): void;
|
|
48
|
+
onBlur?(field: SelectChange): void;
|
|
49
|
+
onFocus?(field: SelectChange): void;
|
|
50
|
+
/** Playwright / autocapture: `data-cy` selector on the react-select control. */
|
|
51
|
+
dataCy?: string;
|
|
52
|
+
/** `bordered`: boxed control with a static label above (sign-up redesign). Default keeps the underline look. */
|
|
53
|
+
variant?: FieldVariant;
|
|
54
|
+
}
|
|
55
|
+
/** Dropdown with a floating label on react-select: single, searchable, multiple (checkboxes + chips) or creatable. */
|
|
56
|
+
declare const Select: (props: SelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
57
|
+
export { Select, SelectControl, SelectMenu, SelectMenuList, SelectOption, SelectContainer, SelectValueContainer, SelectIcon, SelectWrapper, };
|
|
@@ -1,22 +1,36 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import { useState, useMemo } from "react";
|
|
3
3
|
import { Wrapper, Label } from "./Input.styles.js";
|
|
4
4
|
import { OptionCheckbox } from "../Checkbox/OptionCheckbox.js";
|
|
5
|
-
import { useState, useMemo } from "react";
|
|
6
5
|
import CreatableSelect from "react-select/creatable";
|
|
7
6
|
import ReactSelect, { components } from "react-select";
|
|
8
|
-
import {
|
|
7
|
+
import { colors } from "../../styles/colors.js";
|
|
8
|
+
import { BORDERED_BORDER } from "../../styles/borderedField.js";
|
|
9
|
+
import { radius } from "../../styles/spacing.js";
|
|
10
|
+
import { borderedControlCss, SelectMenu, SelectedChipsWrapper, SelectedChipsTitle, SelectedChipsList, SelectedChip, SelectedChipLabel, SelectedChipRemove, SelectOption, OptionRow, OptionLabel, SelectMenuList, SelectIcon, SelectContainer, SelectControl, OptionIcon } from "./Select.styles.js";
|
|
9
11
|
import { SelectValueContainer, SelectWrapper } from "./Select.styles.js";
|
|
10
|
-
const renderIcon = (icon) => {
|
|
12
|
+
const renderIcon = (icon, variant) => {
|
|
11
13
|
if (!icon) return null;
|
|
12
14
|
if (typeof icon === "string") {
|
|
13
|
-
return /* @__PURE__ */ jsx(OptionIcon, { children: /* @__PURE__ */ jsx("img", { src: icon, alt: "" }) });
|
|
15
|
+
return /* @__PURE__ */ jsx(OptionIcon, { $variant: variant, children: /* @__PURE__ */ jsx("img", { src: icon, alt: "" }) });
|
|
14
16
|
}
|
|
15
|
-
return /* @__PURE__ */ jsx(OptionIcon, { children: icon });
|
|
17
|
+
return /* @__PURE__ */ jsx(OptionIcon, { $variant: variant, children: icon });
|
|
16
18
|
};
|
|
19
|
+
const asStyle = (value) => value;
|
|
20
|
+
const buildBorderedOptionStyle = (_base, state) => asStyle({
|
|
21
|
+
cursor: "pointer",
|
|
22
|
+
padding: "10px 16px",
|
|
23
|
+
fontSize: 14,
|
|
24
|
+
lineHeight: "20px",
|
|
25
|
+
border: 0,
|
|
26
|
+
color: colors.black,
|
|
27
|
+
transition: "background-color 0.12s ease",
|
|
28
|
+
fontWeight: state.isSelected ? 600 : 400,
|
|
29
|
+
backgroundColor: state.isFocused ? colors.grey3 : "transparent"
|
|
30
|
+
});
|
|
17
31
|
const buildOptionStyle = (multiple) => (_base, state) => {
|
|
18
32
|
if (multiple) {
|
|
19
|
-
return {
|
|
33
|
+
return asStyle({
|
|
20
34
|
cursor: "pointer",
|
|
21
35
|
padding: "10px 14px",
|
|
22
36
|
fontSize: 13,
|
|
@@ -26,60 +40,41 @@ const buildOptionStyle = (multiple) => (_base, state) => {
|
|
|
26
40
|
transition: "background-color 0.12s ease",
|
|
27
41
|
fontWeight: state.isSelected ? 600 : 400,
|
|
28
42
|
backgroundColor: state.isSelected ? "rgba(0, 80, 202, 0.08)" : state.isFocused ? "#f5f7fb" : "transparent"
|
|
29
|
-
};
|
|
43
|
+
});
|
|
30
44
|
}
|
|
31
|
-
return {
|
|
45
|
+
return asStyle({
|
|
32
46
|
...SelectOption,
|
|
33
47
|
cursor: "pointer",
|
|
34
48
|
fontWeight: state.isSelected || state.isFocused ? "bold" : "normal"
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
const DropdownIndicator = (props) => /* @__PURE__ */ jsx(components.DropdownIndicator, { ...props, children: /* @__PURE__ */ jsx(SelectIcon, { isMenuOpen: props.selectProps.menuIsOpen }) });
|
|
38
|
-
DropdownIndicator.propTypes = {
|
|
39
|
-
selectProps: PropTypes.instanceOf(Object).isRequired
|
|
49
|
+
});
|
|
40
50
|
};
|
|
51
|
+
const extrasOf = (props) => props.selectProps;
|
|
52
|
+
const DropdownIndicator = (props) => /* @__PURE__ */ jsx(components.DropdownIndicator, { ...props, children: /* @__PURE__ */ jsx(SelectIcon, { isMenuOpen: props.selectProps.menuIsOpen, $variant: extrasOf(props).variant }) });
|
|
41
53
|
const ScrollableMenuList = (props) => {
|
|
42
54
|
const { children, selectProps } = props;
|
|
43
55
|
const { maxMenuHeight = 300 } = selectProps;
|
|
44
56
|
return /* @__PURE__ */ jsx(SelectMenuList, { autoHeight: true, autoHeightMax: maxMenuHeight, fullHeight: true, children });
|
|
45
57
|
};
|
|
46
|
-
ScrollableMenuList.propTypes = {
|
|
47
|
-
children: PropTypes.node.isRequired,
|
|
48
|
-
selectProps: PropTypes.instanceOf(Object).isRequired
|
|
49
|
-
};
|
|
50
58
|
const ControlWithDataCy = (props) => {
|
|
51
|
-
const cy = props
|
|
59
|
+
const cy = extrasOf(props)?.dataCy;
|
|
52
60
|
if (!cy) return /* @__PURE__ */ jsx(components.Control, { ...props });
|
|
53
61
|
return /* @__PURE__ */ jsx(components.Control, { ...props, innerProps: { ...props.innerProps, "data-cy": cy } });
|
|
54
62
|
};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
/* @__PURE__ */ jsx(OptionLabel, { children: props.label })
|
|
62
|
-
] }) });
|
|
63
|
-
SingleOption.propTypes = {
|
|
64
|
-
data: PropTypes.instanceOf(Object),
|
|
65
|
-
label: PropTypes.node
|
|
63
|
+
const SingleOption = (props) => {
|
|
64
|
+
const variant = extrasOf(props).variant;
|
|
65
|
+
return /* @__PURE__ */ jsx(components.Option, { ...props, children: /* @__PURE__ */ jsxs(OptionRow, { children: [
|
|
66
|
+
renderIcon(props.data?.icon, variant),
|
|
67
|
+
/* @__PURE__ */ jsx(OptionLabel, { children: props.label })
|
|
68
|
+
] }) });
|
|
66
69
|
};
|
|
67
70
|
const MultiOption = (props) => /* @__PURE__ */ jsx(components.Option, { ...props, children: /* @__PURE__ */ jsx(OptionCheckbox, { checked: props.isSelected, children: /* @__PURE__ */ jsxs(OptionRow, { children: [
|
|
68
71
|
renderIcon(props.data?.icon),
|
|
69
72
|
/* @__PURE__ */ jsx(OptionLabel, { children: props.label })
|
|
70
73
|
] }) }) });
|
|
71
|
-
MultiOption.propTypes = {
|
|
72
|
-
data: PropTypes.instanceOf(Object),
|
|
73
|
-
label: PropTypes.node,
|
|
74
|
-
isSelected: PropTypes.bool
|
|
75
|
-
};
|
|
76
74
|
const SingleValueWithIcon = (props) => /* @__PURE__ */ jsx(components.SingleValue, { ...props, children: /* @__PURE__ */ jsxs(OptionRow, { children: [
|
|
77
|
-
renderIcon(props.data?.icon),
|
|
75
|
+
renderIcon(props.data?.icon, extrasOf(props).variant),
|
|
78
76
|
/* @__PURE__ */ jsx(OptionLabel, { children: props.data?.label })
|
|
79
77
|
] }) });
|
|
80
|
-
SingleValueWithIcon.propTypes = {
|
|
81
|
-
data: PropTypes.instanceOf(Object).isRequired
|
|
82
|
-
};
|
|
83
78
|
const Select = (props) => {
|
|
84
79
|
const {
|
|
85
80
|
id,
|
|
@@ -100,6 +95,7 @@ const Select = (props) => {
|
|
|
100
95
|
floatingLabel = true,
|
|
101
96
|
formatCreateLabel,
|
|
102
97
|
dataCy,
|
|
98
|
+
variant = "default",
|
|
103
99
|
onChange,
|
|
104
100
|
onBlur,
|
|
105
101
|
onFocus,
|
|
@@ -131,15 +127,36 @@ const Select = (props) => {
|
|
|
131
127
|
onChange?.({ name, value: arr });
|
|
132
128
|
};
|
|
133
129
|
const SelectComponent = creatable ? CreatableSelect : ReactSelect;
|
|
130
|
+
const bordered = variant === "bordered";
|
|
131
|
+
const invalid = Boolean(error && touched);
|
|
134
132
|
const selectStyles = useMemo(
|
|
135
|
-
() =>
|
|
136
|
-
control: () =>
|
|
137
|
-
menu: (base) => ({
|
|
133
|
+
() => bordered ? {
|
|
134
|
+
control: (_base, state) => asStyle(borderedControlCss({ focused: state.isFocused, invalid, disabled: state.isDisabled })),
|
|
135
|
+
menu: (base) => ({
|
|
136
|
+
...base,
|
|
137
|
+
marginTop: 4,
|
|
138
|
+
zIndex: 1e3,
|
|
139
|
+
overflow: "hidden",
|
|
140
|
+
border: BORDERED_BORDER,
|
|
141
|
+
borderRadius: radius.lg,
|
|
142
|
+
boxShadow: "none",
|
|
143
|
+
backgroundColor: colors.white
|
|
144
|
+
}),
|
|
145
|
+
option: buildBorderedOptionStyle,
|
|
146
|
+
valueContainer: (base) => ({ ...base, padding: 0 }),
|
|
147
|
+
singleValue: (base) => ({ ...base, margin: 0, color: colors.black }),
|
|
148
|
+
placeholder: (base) => ({ ...base, margin: 0, color: colors.grey2 }),
|
|
149
|
+
input: (base) => ({ ...base, margin: 0, padding: 0, color: colors.black }),
|
|
150
|
+
dropdownIndicator: (base) => ({ ...base, padding: 0, color: colors.black }),
|
|
151
|
+
clearIndicator: (base) => ({ ...base, padding: "0 8px" })
|
|
152
|
+
} : {
|
|
153
|
+
control: () => asStyle(SelectControl),
|
|
154
|
+
menu: (base) => asStyle({ ...base, marginTop: 0, zIndex: 1e3, ...SelectMenu }),
|
|
138
155
|
option: buildOptionStyle(multiple),
|
|
139
|
-
selectContainer: () => SelectContainer,
|
|
156
|
+
selectContainer: () => asStyle(SelectContainer),
|
|
140
157
|
valueContainer: (base) => ({ ...base, padding: 0 })
|
|
141
|
-
}
|
|
142
|
-
[multiple]
|
|
158
|
+
},
|
|
159
|
+
[multiple, bordered, invalid]
|
|
143
160
|
);
|
|
144
161
|
const selectComponents = useMemo(
|
|
145
162
|
() => ({
|
|
@@ -162,14 +179,15 @@ const Select = (props) => {
|
|
|
162
179
|
}
|
|
163
180
|
return options?.find((o) => o.value === value) || null;
|
|
164
181
|
}, [multiple, creatable, value, options]);
|
|
182
|
+
const selectedOptions = multiple ? currentValue : [];
|
|
165
183
|
const hasValue = useMemo(() => {
|
|
166
|
-
if (multiple) return
|
|
184
|
+
if (multiple) return selectedOptions.length > 0;
|
|
167
185
|
return currentValue != null && currentValue.value !== "";
|
|
168
|
-
}, [multiple, currentValue]);
|
|
186
|
+
}, [multiple, currentValue, selectedOptions.length]);
|
|
169
187
|
const isLabelUp = floatingLabel ? hasFocus || hasValue : Boolean(label);
|
|
170
|
-
const effectivePlaceholder = label ? hasFocus && placeholder ? placeholder : "" : placeholder;
|
|
188
|
+
const effectivePlaceholder = label && !bordered ? hasFocus && placeholder ? placeholder : "" : placeholder;
|
|
171
189
|
return /* @__PURE__ */ jsxs(Wrapper, { children: [
|
|
172
|
-
label && /* @__PURE__ */ jsx(Label, { isUp: isLabelUp, active: hasFocus, error: error && touched, htmlFor: id, children: label }),
|
|
190
|
+
label && /* @__PURE__ */ jsx(Label, { isUp: isLabelUp, active: hasFocus, error: error && touched, htmlFor: id, $variant: variant, children: label }),
|
|
173
191
|
/* @__PURE__ */ jsx(
|
|
174
192
|
SelectComponent,
|
|
175
193
|
{
|
|
@@ -193,20 +211,20 @@ const Select = (props) => {
|
|
|
193
211
|
onFocus: handleFocus,
|
|
194
212
|
styles: selectStyles,
|
|
195
213
|
components: selectComponents,
|
|
196
|
-
dataCy,
|
|
214
|
+
...{ dataCy, variant },
|
|
197
215
|
...creatable && {
|
|
198
216
|
formatCreateLabel: formatCreateLabel || ((input) => `Create "${input}"`)
|
|
199
217
|
}
|
|
200
218
|
}
|
|
201
219
|
),
|
|
202
|
-
multiple &&
|
|
220
|
+
multiple && selectedOptions.length > 0 && /* @__PURE__ */ jsxs(SelectedChipsWrapper, { "data-cy": dataCy ? `${dataCy}-chips` : void 0, children: [
|
|
203
221
|
/* @__PURE__ */ jsxs(SelectedChipsTitle, { children: [
|
|
204
222
|
selectedLabel,
|
|
205
223
|
" (",
|
|
206
|
-
|
|
224
|
+
selectedOptions.length,
|
|
207
225
|
")"
|
|
208
226
|
] }),
|
|
209
|
-
/* @__PURE__ */ jsx(SelectedChipsList, { children:
|
|
227
|
+
/* @__PURE__ */ jsx(SelectedChipsList, { children: selectedOptions.map((opt) => {
|
|
210
228
|
const isLocked = lockedValues.includes(opt.value);
|
|
211
229
|
return /* @__PURE__ */ jsxs(SelectedChip, { children: [
|
|
212
230
|
renderIcon(opt.icon),
|
|
@@ -225,47 +243,6 @@ const Select = (props) => {
|
|
|
225
243
|
] })
|
|
226
244
|
] });
|
|
227
245
|
};
|
|
228
|
-
Select.propTypes = {
|
|
229
|
-
id: PropTypes.string.isRequired,
|
|
230
|
-
name: PropTypes.string.isRequired,
|
|
231
|
-
label: PropTypes.string,
|
|
232
|
-
/** string|number for single mode, array for multi mode */
|
|
233
|
-
value: PropTypes.oneOfType([
|
|
234
|
-
PropTypes.string,
|
|
235
|
-
PropTypes.number,
|
|
236
|
-
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]))
|
|
237
|
-
]),
|
|
238
|
-
options: PropTypes.arrayOf(
|
|
239
|
-
PropTypes.shape({
|
|
240
|
-
key: PropTypes.string,
|
|
241
|
-
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
|
242
|
-
label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
|
|
243
|
-
/** URL string (rendered as <img>) or a React node (e.g. an SVG flag) shown left of the label */
|
|
244
|
-
icon: PropTypes.oneOfType([PropTypes.string, PropTypes.node])
|
|
245
|
-
})
|
|
246
|
-
).isRequired,
|
|
247
|
-
placeholder: PropTypes.string,
|
|
248
|
-
error: PropTypes.bool,
|
|
249
|
-
touched: PropTypes.bool,
|
|
250
|
-
disabled: PropTypes.bool,
|
|
251
|
-
search: PropTypes.bool,
|
|
252
|
-
creatable: PropTypes.bool,
|
|
253
|
-
/** Multi-select: checkbox options + chips list rendered below the field. */
|
|
254
|
-
multiple: PropTypes.bool,
|
|
255
|
-
/** Multi mode: values that cannot be removed (chip ✕ disabled, can't be deselected). */
|
|
256
|
-
lockedValues: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])),
|
|
257
|
-
menuHeight: PropTypes.number,
|
|
258
|
-
/** Heading shown above the chips list in multi mode (default: "Selected"). */
|
|
259
|
-
selectedLabel: PropTypes.string,
|
|
260
|
-
/** Input-like floating label behavior: label starts in-field, moves up on focus/value. */
|
|
261
|
-
floatingLabel: PropTypes.bool,
|
|
262
|
-
formatCreateLabel: PropTypes.func,
|
|
263
|
-
onChange: PropTypes.func,
|
|
264
|
-
onBlur: PropTypes.func,
|
|
265
|
-
onFocus: PropTypes.func,
|
|
266
|
-
/** Playwright / autocapture: `data-cy` selector on the react-select control. */
|
|
267
|
-
dataCy: PropTypes.string
|
|
268
|
-
};
|
|
269
246
|
export {
|
|
270
247
|
Select,
|
|
271
248
|
SelectContainer,
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { FieldVariant } from '../../styles/borderedField';
|
|
2
|
+
export declare const SelectControl: import('styled-components').RuleSet<object>;
|
|
3
|
+
/** A one-string array: emotion (react-select) rejects a bare string and would join a longer array with `;`. */
|
|
4
|
+
export declare const borderedControlCss: ({ focused, invalid, disabled, }: {
|
|
5
|
+
focused: boolean;
|
|
6
|
+
invalid: boolean;
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
}) => string[];
|
|
9
|
+
export declare const SelectMenu: import('styled-components').RuleSet<object>;
|
|
10
|
+
export declare const SelectMenuList: import('styled-components/dist/types').IStyledComponentBase<"web", any> & string & Omit<{
|
|
11
|
+
(props: any): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
propTypes: {
|
|
13
|
+
children: any;
|
|
14
|
+
className: any;
|
|
15
|
+
noMobileScroll: any;
|
|
16
|
+
autoHeight: any;
|
|
17
|
+
autoHeightMax: any;
|
|
18
|
+
autoHeightMin: any;
|
|
19
|
+
barPadding: any;
|
|
20
|
+
topPadding: any;
|
|
21
|
+
offset: any;
|
|
22
|
+
handleScroll: any;
|
|
23
|
+
};
|
|
24
|
+
}, keyof import('react').Component<any, {}, any>>;
|
|
25
|
+
export declare const SelectOption: import('styled-components').RuleSet<object>;
|
|
26
|
+
export declare const SelectContainer: import('styled-components').RuleSet<NoInfer<{
|
|
27
|
+
selectProps: {
|
|
28
|
+
menuIsOpen?: boolean;
|
|
29
|
+
};
|
|
30
|
+
}>>;
|
|
31
|
+
export declare const SelectValueContainer: import('styled-components').RuleSet<object>;
|
|
32
|
+
export declare const SelectIcon: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('styled-components/dist/types').Merged<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "style"> & {
|
|
33
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
34
|
+
}, {
|
|
35
|
+
isMenuOpen?: boolean;
|
|
36
|
+
$variant?: FieldVariant;
|
|
37
|
+
}>, "children"> & Partial<Pick<import('styled-components/dist/types').Merged<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "style"> & {
|
|
38
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
39
|
+
}, {
|
|
40
|
+
isMenuOpen?: boolean;
|
|
41
|
+
$variant?: FieldVariant;
|
|
42
|
+
}>, "children">>> & string;
|
|
43
|
+
export declare const OptionRow: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
44
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
45
|
+
}> & string;
|
|
46
|
+
export declare const OptionIcon: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Merged<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "style"> & {
|
|
47
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
48
|
+
}, {
|
|
49
|
+
$variant?: FieldVariant;
|
|
50
|
+
}>> & string;
|
|
51
|
+
export declare const OptionLabel: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "style"> & {
|
|
52
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
53
|
+
}> & string;
|
|
54
|
+
export declare const SelectedChipsWrapper: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
55
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
56
|
+
}> & string;
|
|
57
|
+
export declare const SelectedChipsTitle: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
58
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
59
|
+
}> & string;
|
|
60
|
+
export declare const SelectedChipsList: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
61
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
62
|
+
}> & string;
|
|
63
|
+
export declare const SelectedChip: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
64
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
65
|
+
}> & string;
|
|
66
|
+
export declare const SelectedChipLabel: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "style"> & {
|
|
67
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
68
|
+
}> & string;
|
|
69
|
+
export declare const SelectedChipRemove: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<Omit<import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
|
|
70
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
71
|
+
}, "hidden" | "color" | "content" | "style" | "disabled" | "form" | "slot" | "title" | "ref" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popover" | "popoverTargetAction" | "popoverTarget" | "inert" | "inputMode" | "is" | "exportparts" | "part" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onScrollEnd" | "onScrollEndCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onToggle" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture" | "name" | "type" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "value"> & Partial<Pick<Omit<import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
|
|
72
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
73
|
+
}, "hidden" | "color" | "content" | "style" | "disabled" | "form" | "slot" | "title" | "ref" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popover" | "popoverTargetAction" | "popoverTarget" | "inert" | "inputMode" | "is" | "exportparts" | "part" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onScrollEnd" | "onScrollEndCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onToggle" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture" | "name" | "type" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "value">>> & string;
|
|
74
|
+
export declare const SelectWrapper: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Merged<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
75
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
76
|
+
}, {
|
|
77
|
+
minWidth?: string;
|
|
78
|
+
noMargin?: boolean;
|
|
79
|
+
}>> & string;
|
|
@@ -2,6 +2,7 @@ import styled, { css } from "styled-components";
|
|
|
2
2
|
import { TrackV } from "../ComponentScroll/ComponentScroll.styles.js";
|
|
3
3
|
import stdin_default from "../ComponentScroll/ComponentScroll.js";
|
|
4
4
|
import { glyph } from "../MaterialIcon/glyph.js";
|
|
5
|
+
import { borderedFieldBox, borderedFieldText, borderedFieldFocus, borderedFieldError, borderedFieldDisabled } from "../../styles/borderedField.js";
|
|
5
6
|
const SelectControl = css`
|
|
6
7
|
&&& {
|
|
7
8
|
z-index: 10 !important;
|
|
@@ -36,6 +37,62 @@ const SelectControl = css`
|
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
`;
|
|
40
|
+
const SelectBorderedControl = css`
|
|
41
|
+
&&& {
|
|
42
|
+
z-index: 10 !important;
|
|
43
|
+
position: relative;
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
justify-content: space-between;
|
|
47
|
+
width: 100%;
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
${borderedFieldBox}
|
|
50
|
+
${borderedFieldText}
|
|
51
|
+
|
|
52
|
+
&:hover {
|
|
53
|
+
box-shadow: none;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&.active {
|
|
57
|
+
z-index: 12 !important;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
`;
|
|
61
|
+
const SelectBorderedFocus = css`
|
|
62
|
+
&&& {
|
|
63
|
+
${borderedFieldFocus}
|
|
64
|
+
|
|
65
|
+
&:hover {
|
|
66
|
+
${borderedFieldFocus}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
`;
|
|
70
|
+
const SelectBorderedError = css`
|
|
71
|
+
&&& {
|
|
72
|
+
${borderedFieldError}
|
|
73
|
+
|
|
74
|
+
&:hover {
|
|
75
|
+
${borderedFieldError}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
`;
|
|
79
|
+
const SelectBorderedDisabled = css`
|
|
80
|
+
&&& {
|
|
81
|
+
${borderedFieldDisabled}
|
|
82
|
+
}
|
|
83
|
+
`;
|
|
84
|
+
const borderedControlCss = ({
|
|
85
|
+
focused,
|
|
86
|
+
invalid,
|
|
87
|
+
disabled
|
|
88
|
+
}) => [
|
|
89
|
+
[
|
|
90
|
+
SelectBorderedControl,
|
|
91
|
+
focused && SelectBorderedFocus,
|
|
92
|
+
invalid && SelectBorderedError,
|
|
93
|
+
disabled && SelectBorderedDisabled
|
|
94
|
+
].flat(2).filter(Boolean).join("")
|
|
95
|
+
];
|
|
39
96
|
const SelectMenu = css`
|
|
40
97
|
margin-top: -1px;
|
|
41
98
|
border-radius: 0;
|
|
@@ -97,6 +154,10 @@ const SelectIcon = styled.span.withConfig({
|
|
|
97
154
|
${(props) => props.isMenuOpen && `
|
|
98
155
|
transform: rotate(180deg);
|
|
99
156
|
`}
|
|
157
|
+
|
|
158
|
+
${(props) => props.$variant === "bordered" && `
|
|
159
|
+
font-size: 20px;
|
|
160
|
+
`}
|
|
100
161
|
}
|
|
101
162
|
`;
|
|
102
163
|
const OptionRow = styled.div`
|
|
@@ -122,6 +183,11 @@ const OptionIcon = styled.span`
|
|
|
122
183
|
object-fit: cover;
|
|
123
184
|
display: block;
|
|
124
185
|
}
|
|
186
|
+
|
|
187
|
+
${(props) => props.$variant === "bordered" && `
|
|
188
|
+
width: 24px;
|
|
189
|
+
height: 20px;
|
|
190
|
+
`}
|
|
125
191
|
`;
|
|
126
192
|
const OptionLabel = styled.span`
|
|
127
193
|
flex: 1;
|
|
@@ -236,5 +302,6 @@ export {
|
|
|
236
302
|
SelectedChipRemove,
|
|
237
303
|
SelectedChipsList,
|
|
238
304
|
SelectedChipsTitle,
|
|
239
|
-
SelectedChipsWrapper
|
|
305
|
+
SelectedChipsWrapper,
|
|
306
|
+
borderedControlCss
|
|
240
307
|
};
|