carbon-react 111.5.2 → 111.6.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/esm/components/image/image.component.js +1 -0
- package/esm/components/image/image.style.d.ts +6 -3
- package/esm/components/image/image.style.js +4 -2
- package/esm/components/search/index.d.ts +2 -1
- package/esm/components/search/search-button.style.d.ts +3 -0
- package/esm/components/search/search-button.style.js +36 -0
- package/esm/components/search/search.component.d.ts +55 -0
- package/esm/components/search/search.component.js +202 -112
- package/esm/components/search/search.style.d.ts +10 -3
- package/esm/components/search/search.style.js +1 -32
- package/esm/global.d.ts +1 -0
- package/lib/components/image/image.component.js +1 -0
- package/lib/components/image/image.style.d.ts +6 -3
- package/lib/components/image/image.style.js +4 -2
- package/lib/components/search/index.d.ts +2 -1
- package/lib/components/search/search-button.style.d.ts +3 -0
- package/lib/components/search/search-button.style.js +51 -0
- package/lib/components/search/search.component.d.ts +55 -0
- package/lib/components/search/search.component.js +205 -116
- package/lib/components/search/search.style.d.ts +10 -3
- package/lib/components/search/search.style.js +2 -36
- package/lib/global.d.ts +1 -0
- package/package.json +3 -4
- package/esm/components/search/search.d.ts +0 -52
- package/lib/components/search/search.d.ts +0 -52
- package/scripts/check_carbon_version/check_carbon_version.js +0 -39
|
@@ -729,6 +729,7 @@ Image.propTypes = {
|
|
|
729
729
|
"trimStart": PropTypes.func.isRequired,
|
|
730
730
|
"valueOf": PropTypes.func.isRequired
|
|
731
731
|
}), PropTypes.string]),
|
|
732
|
+
"hidden": PropTypes.bool,
|
|
732
733
|
"m": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
733
734
|
"__@toStringTag": PropTypes.string.isRequired,
|
|
734
735
|
"description": PropTypes.string,
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { MarginProps, BackgroundProps, LayoutProps } from "styled-system";
|
|
3
3
|
export interface StyledImageProps extends MarginProps, BackgroundProps, LayoutProps {
|
|
4
|
-
/** alt property to display when an img fails to load */
|
|
4
|
+
/** HTML alt property to display when an img fails to load */
|
|
5
5
|
alt?: string;
|
|
6
|
-
/**
|
|
6
|
+
/** Any valid file path, passing this will render the component as an img element */
|
|
7
7
|
src?: string;
|
|
8
|
+
/** HTML hidden property to indicate whether to remain hidden visually and from screen readers */
|
|
9
|
+
hidden?: boolean;
|
|
8
10
|
/** Children elements, will only render if component is a div element */
|
|
9
11
|
children?: React.ReactNode;
|
|
10
12
|
}
|
|
11
13
|
declare const StyledImage: import("styled-components").StyledComponent<"div", any, {
|
|
12
14
|
children: import("react").ReactNode;
|
|
13
15
|
src: string | undefined;
|
|
16
|
+
hidden: boolean;
|
|
14
17
|
as?: string | undefined;
|
|
15
|
-
} & StyledImageProps, "children" | "as" | "src">;
|
|
18
|
+
} & StyledImageProps, "hidden" | "children" | "as" | "src">;
|
|
16
19
|
export { StyledImage };
|
|
@@ -3,12 +3,14 @@ import { margin, layout, background } from "styled-system";
|
|
|
3
3
|
import { baseTheme } from "../../style/themes";
|
|
4
4
|
const StyledImage = styled.div.attrs(({
|
|
5
5
|
src,
|
|
6
|
-
children
|
|
6
|
+
children,
|
|
7
|
+
hidden = false
|
|
7
8
|
}) => ({ ...(src && {
|
|
8
9
|
as: "img"
|
|
9
10
|
}),
|
|
10
11
|
children: src ? undefined : children,
|
|
11
|
-
src
|
|
12
|
+
src,
|
|
13
|
+
hidden
|
|
12
14
|
}))`
|
|
13
15
|
${margin}
|
|
14
16
|
${layout}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { default } from "./search";
|
|
1
|
+
export { default } from "./search.component";
|
|
2
|
+
export type { SearchProps } from "./search.component";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import StyledButton from "../button/button.style";
|
|
3
|
+
import StyledIcon from "../icon/icon.style";
|
|
4
|
+
import { baseTheme } from "../../style/themes";
|
|
5
|
+
export const StyledButtonIcon = styled.div`
|
|
6
|
+
&&& ${StyledIcon} {
|
|
7
|
+
color: var(--colorsActionMajorYang100);
|
|
8
|
+
margin-right: 0px;
|
|
9
|
+
}
|
|
10
|
+
`;
|
|
11
|
+
const StyledSearchButton = styled.div`
|
|
12
|
+
display: inline-flex;
|
|
13
|
+
border-bottom: none;
|
|
14
|
+
|
|
15
|
+
& ${StyledButton} {
|
|
16
|
+
background-color: var(--colorsActionMajor500);
|
|
17
|
+
border-color: var(--colorsActionMajorTransparent);
|
|
18
|
+
:hover {
|
|
19
|
+
background: var(--colorsActionMajor600);
|
|
20
|
+
border-color: var(--colorsActionMajorTransparent);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
width: 40px;
|
|
24
|
+
margin: 0px 0px;
|
|
25
|
+
padding-bottom: 3px;
|
|
26
|
+
:focus {
|
|
27
|
+
z-index: ${({
|
|
28
|
+
theme
|
|
29
|
+
}) => theme.zIndex.smallOverlay};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
StyledSearchButton.defaultProps = {
|
|
34
|
+
theme: baseTheme
|
|
35
|
+
};
|
|
36
|
+
export default StyledSearchButton;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MarginProps } from "styled-system";
|
|
3
|
+
import { ValidationProps } from "../../__internal__/validations";
|
|
4
|
+
export interface SearchEvent {
|
|
5
|
+
target: {
|
|
6
|
+
name?: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
value: string;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export interface SearchProps extends ValidationProps, MarginProps {
|
|
12
|
+
/** Prop to specify the aria-label of the search component */
|
|
13
|
+
"aria-label"?: string;
|
|
14
|
+
/** Prop for `uncontrolled` use */
|
|
15
|
+
defaultValue?: string;
|
|
16
|
+
/** Prop for `id` */
|
|
17
|
+
id?: string;
|
|
18
|
+
/** A callback to retrieve the input reference */
|
|
19
|
+
inputRef?: React.MutableRefObject<HTMLInputElement | null>;
|
|
20
|
+
/** Prop for `name` */
|
|
21
|
+
name?: string;
|
|
22
|
+
/** Prop for `onBlur` events */
|
|
23
|
+
onBlur?: (ev: React.FocusEvent<HTMLInputElement>) => void;
|
|
24
|
+
/** Prop for `onChange` events */
|
|
25
|
+
onChange?: (ev: SearchEvent) => void;
|
|
26
|
+
/** Prop for `onClick` events.
|
|
27
|
+
* `onClick` events are triggered when the `searchButton` is clicked
|
|
28
|
+
*/
|
|
29
|
+
onClick?: (ev: SearchEvent) => void;
|
|
30
|
+
/** Prop for `onFocus` events */
|
|
31
|
+
onFocus?: (ev: React.FocusEvent<HTMLInputElement>) => void;
|
|
32
|
+
/** Prop for `onKeyDown` events */
|
|
33
|
+
onKeyDown?: (ev: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
34
|
+
/** Prop for a placeholder */
|
|
35
|
+
placeholder?: string;
|
|
36
|
+
/** Prop boolean to state whether the `search` icon renders */
|
|
37
|
+
searchButton?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Prop for specifying an input width length.
|
|
40
|
+
* Leaving the `searchWidth` prop with no value will default the width to '100%'
|
|
41
|
+
*/
|
|
42
|
+
searchWidth?: string;
|
|
43
|
+
/** Prop for active search threshold. This must be a positive number */
|
|
44
|
+
threshold?: number;
|
|
45
|
+
/** Prop for `controlled` use */
|
|
46
|
+
value?: string;
|
|
47
|
+
/** Prop to specify the styling of the search component */
|
|
48
|
+
variant?: "default" | "dark";
|
|
49
|
+
/** Input tabindex */
|
|
50
|
+
tabIndex?: number;
|
|
51
|
+
/** Overrides the default tooltip position */
|
|
52
|
+
tooltipPosition?: "top" | "bottom" | "left" | "right";
|
|
53
|
+
}
|
|
54
|
+
export declare const Search: ({ defaultValue, onChange, onClick, onFocus, onBlur, onKeyDown, value, id, name, threshold, searchWidth, searchButton, placeholder, variant, "aria-label": ariaLabel, inputRef, tabIndex, error, warning, info, tooltipPosition, ...rest }: SearchProps) => JSX.Element;
|
|
55
|
+
export default Search;
|
|
@@ -2,15 +2,14 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
2
2
|
|
|
3
3
|
import React, { useState, useMemo, useEffect } from "react";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
|
-
import styledSystemPropTypes from "@styled-system/prop-types";
|
|
6
5
|
import invariant from "invariant";
|
|
7
|
-
import StyledSearch, { StyledSearchButton, StyledButtonIcon } from "./search.style";
|
|
8
|
-
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
9
6
|
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
7
|
+
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
8
|
+
import StyledSearch from "./search.style";
|
|
9
|
+
import StyledSearchButton, { StyledButtonIcon } from "./search-button.style";
|
|
10
10
|
import Icon from "../icon";
|
|
11
11
|
import Textbox from "../textbox";
|
|
12
12
|
import Button from "../button";
|
|
13
|
-
const marginPropTypes = filterStyledSystemMarginProps(styledSystemPropTypes.space);
|
|
14
13
|
|
|
15
14
|
const Search = ({
|
|
16
15
|
defaultValue,
|
|
@@ -39,6 +38,7 @@ const Search = ({
|
|
|
39
38
|
const isControlled = value !== undefined;
|
|
40
39
|
const initialValue = isControlled ? value : defaultValue;
|
|
41
40
|
!(typeof initialValue === "string") ? process.env.NODE_ENV !== "production" ? invariant(false, "This component has no initial value") : invariant(false) : void 0;
|
|
41
|
+
!(threshold === undefined || typeof threshold === "number" && threshold > 0) ? process.env.NODE_ENV !== "production" ? invariant(false, "Threshold must be a positive number") : invariant(false) : void 0;
|
|
42
42
|
const [searchValue, setSearchValue] = useState(initialValue);
|
|
43
43
|
const [isFocused, setIsFocused] = useState(false);
|
|
44
44
|
const [searchIsActive, setSearchIsActive] = useState(initialValue.length >= threshold);
|
|
@@ -57,36 +57,35 @@ const Search = ({
|
|
|
57
57
|
return ["search", -1];
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
return [
|
|
60
|
+
return [undefined, -1];
|
|
61
61
|
}, [isControlled, searchValue, value, isFocused, searchIsActive, threshold, searchButton, inputRef]);
|
|
62
|
+
let buttonProps = {};
|
|
62
63
|
|
|
63
|
-
const handleChange =
|
|
64
|
+
const handleChange = event => {
|
|
64
65
|
if (onChange) {
|
|
65
|
-
onChange(
|
|
66
|
+
onChange(event);
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
if (!isControlled) {
|
|
69
|
-
setSearchValue(
|
|
70
|
+
setSearchValue(event.target.value);
|
|
70
71
|
}
|
|
71
72
|
};
|
|
72
73
|
|
|
73
|
-
const handleFocus =
|
|
74
|
+
const handleFocus = event => {
|
|
74
75
|
setIsFocused(true);
|
|
75
76
|
|
|
76
77
|
if (onFocus) {
|
|
77
|
-
onFocus(
|
|
78
|
+
onFocus(event);
|
|
78
79
|
}
|
|
79
80
|
};
|
|
80
81
|
|
|
81
|
-
let buttonProps = {};
|
|
82
|
-
|
|
83
82
|
if (searchButton && onClick) {
|
|
84
83
|
buttonProps = {
|
|
85
|
-
onClick:
|
|
84
|
+
onClick: () => {
|
|
86
85
|
onClick({
|
|
87
86
|
target: {
|
|
88
|
-
name
|
|
89
|
-
id
|
|
87
|
+
name,
|
|
88
|
+
id,
|
|
90
89
|
value: !isControlled ? searchValue : value
|
|
91
90
|
}
|
|
92
91
|
});
|
|
@@ -111,39 +110,40 @@ const Search = ({
|
|
|
111
110
|
}
|
|
112
111
|
};
|
|
113
112
|
|
|
114
|
-
const handleMouseDown =
|
|
115
|
-
|
|
113
|
+
const handleMouseDown = event => {
|
|
114
|
+
event.preventDefault();
|
|
116
115
|
};
|
|
117
116
|
|
|
118
|
-
const handleBlur =
|
|
117
|
+
const handleBlur = event => {
|
|
119
118
|
setIsFocused(false);
|
|
120
119
|
|
|
121
120
|
if (onBlur) {
|
|
122
|
-
onBlur(
|
|
121
|
+
onBlur(event);
|
|
123
122
|
}
|
|
124
123
|
};
|
|
125
124
|
|
|
126
|
-
const handleKeyDown =
|
|
127
|
-
if (
|
|
128
|
-
|
|
125
|
+
const handleKeyDown = event => {
|
|
126
|
+
if (event.key.length === 1) {
|
|
127
|
+
event.stopPropagation();
|
|
129
128
|
}
|
|
130
129
|
|
|
131
130
|
if (onKeyDown) {
|
|
132
|
-
onKeyDown(
|
|
131
|
+
onKeyDown(event);
|
|
133
132
|
}
|
|
134
133
|
};
|
|
135
134
|
|
|
136
135
|
const assignInput = input => {
|
|
137
136
|
if (inputRef) {
|
|
138
|
-
inputRef.current = input.current;
|
|
137
|
+
inputRef.current = input === null || input === void 0 ? void 0 : input.current;
|
|
139
138
|
}
|
|
140
139
|
};
|
|
141
140
|
|
|
141
|
+
const isSearchTyped = isFocused || (!isControlled ? !!searchValue.length : !!value.length);
|
|
142
142
|
return /*#__PURE__*/React.createElement(StyledSearch, _extends({
|
|
143
143
|
isFocused: isFocused,
|
|
144
144
|
searchWidth: searchWidth,
|
|
145
145
|
searchIsActive: searchIsActive,
|
|
146
|
-
searchHasValue: !isControlled ? searchValue && searchValue.length : value && value.length,
|
|
146
|
+
searchHasValue: !isControlled ? !!(searchValue !== null && searchValue !== void 0 && searchValue.length) : !!(value !== null && value !== void 0 && value.length),
|
|
147
147
|
showSearchButton: searchButton,
|
|
148
148
|
variant: variant,
|
|
149
149
|
mb: 0
|
|
@@ -168,8 +168,7 @@ const Search = ({
|
|
|
168
168
|
warning: warning,
|
|
169
169
|
info: info,
|
|
170
170
|
tooltipPosition: tooltipPosition
|
|
171
|
-
}), searchButton && /*#__PURE__*/React.createElement(StyledSearchButton, null,
|
|
172
|
-
tabIndex: iconTabIndex,
|
|
171
|
+
}), searchButton && /*#__PURE__*/React.createElement(StyledSearchButton, null, isSearchTyped && /*#__PURE__*/React.createElement(Button, _extends({
|
|
173
172
|
size: "medium",
|
|
174
173
|
px: "16px"
|
|
175
174
|
}, buttonProps), /*#__PURE__*/React.createElement(StyledButtonIcon, null, /*#__PURE__*/React.createElement(Icon, {
|
|
@@ -178,92 +177,183 @@ const Search = ({
|
|
|
178
177
|
};
|
|
179
178
|
|
|
180
179
|
Search.propTypes = {
|
|
181
|
-
/** Filtered styled system margin props */
|
|
182
|
-
...marginPropTypes,
|
|
183
|
-
|
|
184
|
-
/** Prop for `uncontrolled` use */
|
|
185
|
-
defaultValue: PropTypes.string,
|
|
186
|
-
|
|
187
|
-
/** Prop for `controlled` use */
|
|
188
|
-
value: PropTypes.string,
|
|
189
|
-
|
|
190
|
-
/** Prop for `onClick` events.
|
|
191
|
-
* `onClick` events are triggered when the `searchButton` is clicked */
|
|
192
|
-
onClick: PropTypes.func,
|
|
193
|
-
|
|
194
|
-
/** Prop for `onChange` events */
|
|
195
|
-
onChange: PropTypes.func,
|
|
196
|
-
|
|
197
|
-
/** Prop for `onKeyDown` events */
|
|
198
|
-
onKeyDown: PropTypes.func,
|
|
199
|
-
|
|
200
|
-
/** Prop boolean to state whether the `search` icon renders */
|
|
201
|
-
searchButton: PropTypes.bool,
|
|
202
|
-
|
|
203
|
-
/** Prop for specifying an input width length.
|
|
204
|
-
* Leaving the `searchWidth` prop with no value will default the width to '100%' */
|
|
205
|
-
searchWidth: PropTypes.string,
|
|
206
|
-
|
|
207
|
-
/** Prop for `onFocus` events */
|
|
208
|
-
onFocus: PropTypes.func,
|
|
209
|
-
|
|
210
|
-
/** Prop for `onBlur` events */
|
|
211
|
-
onBlur: PropTypes.func,
|
|
212
|
-
|
|
213
|
-
/** Prop for `id` */
|
|
214
|
-
id: PropTypes.string,
|
|
215
|
-
|
|
216
|
-
/** Prop for `name` */
|
|
217
|
-
name: PropTypes.string,
|
|
218
|
-
|
|
219
|
-
/** Prop for active search threshold. This must be a positive number */
|
|
220
|
-
threshold(props, propName) {
|
|
221
|
-
let error;
|
|
222
|
-
|
|
223
|
-
if (props[propName] && typeof props[propName] === "number" && props[propName] < 0) {
|
|
224
|
-
error = new Error("Threshold must be a positive number.");
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
return error;
|
|
228
|
-
},
|
|
229
|
-
|
|
230
|
-
/** Prop for a placeholder */
|
|
231
|
-
placeholder: PropTypes.string,
|
|
232
|
-
|
|
233
|
-
/** Prop to specify the styling of the search component */
|
|
234
|
-
variant: PropTypes.oneOf(["default", "dark"]),
|
|
235
|
-
|
|
236
|
-
/** Prop to specify the aria-label of the search component */
|
|
237
180
|
"aria-label": PropTypes.string,
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
inputRef: PropTypes.shape({
|
|
245
|
-
current: PropTypes.instanceOf(Element)
|
|
181
|
+
"defaultValue": PropTypes.string,
|
|
182
|
+
"error": PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
183
|
+
"id": PropTypes.string,
|
|
184
|
+
"info": PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
185
|
+
"inputRef": PropTypes.shape({
|
|
186
|
+
"current": PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.object]).isRequired
|
|
246
187
|
}),
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
188
|
+
"m": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
189
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
190
|
+
"description": PropTypes.string,
|
|
191
|
+
"toString": PropTypes.func.isRequired,
|
|
192
|
+
"valueOf": PropTypes.func.isRequired
|
|
193
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
194
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
195
|
+
"description": PropTypes.string,
|
|
196
|
+
"toString": PropTypes.func.isRequired,
|
|
197
|
+
"valueOf": PropTypes.func.isRequired
|
|
198
|
+
}), PropTypes.string]),
|
|
199
|
+
"margin": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
200
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
201
|
+
"description": PropTypes.string,
|
|
202
|
+
"toString": PropTypes.func.isRequired,
|
|
203
|
+
"valueOf": PropTypes.func.isRequired
|
|
204
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
205
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
206
|
+
"description": PropTypes.string,
|
|
207
|
+
"toString": PropTypes.func.isRequired,
|
|
208
|
+
"valueOf": PropTypes.func.isRequired
|
|
209
|
+
}), PropTypes.string]),
|
|
210
|
+
"marginBottom": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
211
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
212
|
+
"description": PropTypes.string,
|
|
213
|
+
"toString": PropTypes.func.isRequired,
|
|
214
|
+
"valueOf": PropTypes.func.isRequired
|
|
215
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
216
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
217
|
+
"description": PropTypes.string,
|
|
218
|
+
"toString": PropTypes.func.isRequired,
|
|
219
|
+
"valueOf": PropTypes.func.isRequired
|
|
220
|
+
}), PropTypes.string]),
|
|
221
|
+
"marginLeft": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
222
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
223
|
+
"description": PropTypes.string,
|
|
224
|
+
"toString": PropTypes.func.isRequired,
|
|
225
|
+
"valueOf": PropTypes.func.isRequired
|
|
226
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
227
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
228
|
+
"description": PropTypes.string,
|
|
229
|
+
"toString": PropTypes.func.isRequired,
|
|
230
|
+
"valueOf": PropTypes.func.isRequired
|
|
231
|
+
}), PropTypes.string]),
|
|
232
|
+
"marginRight": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
233
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
234
|
+
"description": PropTypes.string,
|
|
235
|
+
"toString": PropTypes.func.isRequired,
|
|
236
|
+
"valueOf": PropTypes.func.isRequired
|
|
237
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
238
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
239
|
+
"description": PropTypes.string,
|
|
240
|
+
"toString": PropTypes.func.isRequired,
|
|
241
|
+
"valueOf": PropTypes.func.isRequired
|
|
242
|
+
}), PropTypes.string]),
|
|
243
|
+
"marginTop": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
244
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
245
|
+
"description": PropTypes.string,
|
|
246
|
+
"toString": PropTypes.func.isRequired,
|
|
247
|
+
"valueOf": PropTypes.func.isRequired
|
|
248
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
249
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
250
|
+
"description": PropTypes.string,
|
|
251
|
+
"toString": PropTypes.func.isRequired,
|
|
252
|
+
"valueOf": PropTypes.func.isRequired
|
|
253
|
+
}), PropTypes.string]),
|
|
254
|
+
"marginX": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
255
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
256
|
+
"description": PropTypes.string,
|
|
257
|
+
"toString": PropTypes.func.isRequired,
|
|
258
|
+
"valueOf": PropTypes.func.isRequired
|
|
259
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
260
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
261
|
+
"description": PropTypes.string,
|
|
262
|
+
"toString": PropTypes.func.isRequired,
|
|
263
|
+
"valueOf": PropTypes.func.isRequired
|
|
264
|
+
}), PropTypes.string]),
|
|
265
|
+
"marginY": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
266
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
267
|
+
"description": PropTypes.string,
|
|
268
|
+
"toString": PropTypes.func.isRequired,
|
|
269
|
+
"valueOf": PropTypes.func.isRequired
|
|
270
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
271
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
272
|
+
"description": PropTypes.string,
|
|
273
|
+
"toString": PropTypes.func.isRequired,
|
|
274
|
+
"valueOf": PropTypes.func.isRequired
|
|
275
|
+
}), PropTypes.string]),
|
|
276
|
+
"mb": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
277
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
278
|
+
"description": PropTypes.string,
|
|
279
|
+
"toString": PropTypes.func.isRequired,
|
|
280
|
+
"valueOf": PropTypes.func.isRequired
|
|
281
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
282
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
283
|
+
"description": PropTypes.string,
|
|
284
|
+
"toString": PropTypes.func.isRequired,
|
|
285
|
+
"valueOf": PropTypes.func.isRequired
|
|
286
|
+
}), PropTypes.string]),
|
|
287
|
+
"ml": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
288
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
289
|
+
"description": PropTypes.string,
|
|
290
|
+
"toString": PropTypes.func.isRequired,
|
|
291
|
+
"valueOf": PropTypes.func.isRequired
|
|
292
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
293
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
294
|
+
"description": PropTypes.string,
|
|
295
|
+
"toString": PropTypes.func.isRequired,
|
|
296
|
+
"valueOf": PropTypes.func.isRequired
|
|
297
|
+
}), PropTypes.string]),
|
|
298
|
+
"mr": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
299
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
300
|
+
"description": PropTypes.string,
|
|
301
|
+
"toString": PropTypes.func.isRequired,
|
|
302
|
+
"valueOf": PropTypes.func.isRequired
|
|
303
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
304
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
305
|
+
"description": PropTypes.string,
|
|
306
|
+
"toString": PropTypes.func.isRequired,
|
|
307
|
+
"valueOf": PropTypes.func.isRequired
|
|
308
|
+
}), PropTypes.string]),
|
|
309
|
+
"mt": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
310
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
311
|
+
"description": PropTypes.string,
|
|
312
|
+
"toString": PropTypes.func.isRequired,
|
|
313
|
+
"valueOf": PropTypes.func.isRequired
|
|
314
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
315
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
316
|
+
"description": PropTypes.string,
|
|
317
|
+
"toString": PropTypes.func.isRequired,
|
|
318
|
+
"valueOf": PropTypes.func.isRequired
|
|
319
|
+
}), PropTypes.string]),
|
|
320
|
+
"mx": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
321
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
322
|
+
"description": PropTypes.string,
|
|
323
|
+
"toString": PropTypes.func.isRequired,
|
|
324
|
+
"valueOf": PropTypes.func.isRequired
|
|
325
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
326
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
327
|
+
"description": PropTypes.string,
|
|
328
|
+
"toString": PropTypes.func.isRequired,
|
|
329
|
+
"valueOf": PropTypes.func.isRequired
|
|
330
|
+
}), PropTypes.string]),
|
|
331
|
+
"my": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
332
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
333
|
+
"description": PropTypes.string,
|
|
334
|
+
"toString": PropTypes.func.isRequired,
|
|
335
|
+
"valueOf": PropTypes.func.isRequired
|
|
336
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
337
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
338
|
+
"description": PropTypes.string,
|
|
339
|
+
"toString": PropTypes.func.isRequired,
|
|
340
|
+
"valueOf": PropTypes.func.isRequired
|
|
341
|
+
}), PropTypes.string]),
|
|
342
|
+
"name": PropTypes.string,
|
|
343
|
+
"onBlur": PropTypes.func,
|
|
344
|
+
"onChange": PropTypes.func,
|
|
345
|
+
"onClick": PropTypes.func,
|
|
346
|
+
"onFocus": PropTypes.func,
|
|
347
|
+
"onKeyDown": PropTypes.func,
|
|
348
|
+
"placeholder": PropTypes.string,
|
|
349
|
+
"searchButton": PropTypes.bool,
|
|
350
|
+
"searchWidth": PropTypes.string,
|
|
351
|
+
"tabIndex": PropTypes.number,
|
|
352
|
+
"threshold": PropTypes.number,
|
|
353
|
+
"tooltipPosition": PropTypes.oneOf(["bottom", "left", "right", "top"]),
|
|
354
|
+
"value": PropTypes.string,
|
|
355
|
+
"variant": PropTypes.oneOf(["dark", "default"]),
|
|
356
|
+
"warning": PropTypes.oneOfType([PropTypes.string, PropTypes.bool])
|
|
268
357
|
};
|
|
358
|
+
export { Search };
|
|
269
359
|
export default Search;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
+
interface StyledSearchProps {
|
|
2
|
+
name?: string;
|
|
3
|
+
isFocused?: boolean;
|
|
4
|
+
searchHasValue?: boolean;
|
|
5
|
+
searchIsActive?: boolean;
|
|
6
|
+
searchWidth?: string;
|
|
7
|
+
showSearchButton?: boolean;
|
|
8
|
+
variant?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const StyledSearch: import("styled-components").StyledComponent<"div", any, StyledSearchProps, never>;
|
|
1
11
|
export default StyledSearch;
|
|
2
|
-
export const StyledSearchButton: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
-
export const StyledButtonIcon: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
-
declare const StyledSearch: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -4,7 +4,6 @@ import StyledInputIconToggle from "../../__internal__/input-icon-toggle/input-ic
|
|
|
4
4
|
import StyledInputPresentation from "../../__internal__/input/input-presentation.style";
|
|
5
5
|
import StyledInput from "../../__internal__/input/input.style";
|
|
6
6
|
import StyledIcon from "../icon/icon.style";
|
|
7
|
-
import StyledButton from "../button/button.style";
|
|
8
7
|
import { baseTheme } from "../../style/themes";
|
|
9
8
|
import StyledFormField from "../../__internal__/form-field/form-field.style";
|
|
10
9
|
const StyledSearch = styled.div`
|
|
@@ -138,34 +137,4 @@ const StyledSearch = styled.div`
|
|
|
138
137
|
StyledSearch.defaultProps = {
|
|
139
138
|
theme: baseTheme
|
|
140
139
|
};
|
|
141
|
-
export default StyledSearch;
|
|
142
|
-
export const StyledSearchButton = styled.div`
|
|
143
|
-
display: inline-flex;
|
|
144
|
-
border-bottom: none;
|
|
145
|
-
& ${StyledButton} {
|
|
146
|
-
background-color: var(--colorsActionMajor500);
|
|
147
|
-
border-color: var(--colorsActionMajorTransparent);
|
|
148
|
-
:hover {
|
|
149
|
-
background: var(--colorsActionMajor600);
|
|
150
|
-
border-color: var(--colorsActionMajorTransparent);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
width: 40px;
|
|
154
|
-
margin: 0px 0px;
|
|
155
|
-
padding-bottom: 3px;
|
|
156
|
-
:focus {
|
|
157
|
-
z-index: ${({
|
|
158
|
-
theme
|
|
159
|
-
}) => theme.zIndex.smallOverlay};
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
`;
|
|
163
|
-
export const StyledButtonIcon = styled.div`
|
|
164
|
-
&&& ${StyledIcon} {
|
|
165
|
-
color: var(--colorsActionMajorYang100);
|
|
166
|
-
margin-right: 0px;
|
|
167
|
-
}
|
|
168
|
-
`;
|
|
169
|
-
StyledSearchButton.defaultProps = {
|
|
170
|
-
theme: baseTheme
|
|
171
|
-
};
|
|
140
|
+
export default StyledSearch;
|
package/esm/global.d.ts
CHANGED
|
@@ -742,6 +742,7 @@ Image.propTypes = {
|
|
|
742
742
|
"trimStart": _propTypes.default.func.isRequired,
|
|
743
743
|
"valueOf": _propTypes.default.func.isRequired
|
|
744
744
|
}), _propTypes.default.string]),
|
|
745
|
+
"hidden": _propTypes.default.bool,
|
|
745
746
|
"m": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
746
747
|
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
747
748
|
"description": _propTypes.default.string,
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { MarginProps, BackgroundProps, LayoutProps } from "styled-system";
|
|
3
3
|
export interface StyledImageProps extends MarginProps, BackgroundProps, LayoutProps {
|
|
4
|
-
/** alt property to display when an img fails to load */
|
|
4
|
+
/** HTML alt property to display when an img fails to load */
|
|
5
5
|
alt?: string;
|
|
6
|
-
/**
|
|
6
|
+
/** Any valid file path, passing this will render the component as an img element */
|
|
7
7
|
src?: string;
|
|
8
|
+
/** HTML hidden property to indicate whether to remain hidden visually and from screen readers */
|
|
9
|
+
hidden?: boolean;
|
|
8
10
|
/** Children elements, will only render if component is a div element */
|
|
9
11
|
children?: React.ReactNode;
|
|
10
12
|
}
|
|
11
13
|
declare const StyledImage: import("styled-components").StyledComponent<"div", any, {
|
|
12
14
|
children: import("react").ReactNode;
|
|
13
15
|
src: string | undefined;
|
|
16
|
+
hidden: boolean;
|
|
14
17
|
as?: string | undefined;
|
|
15
|
-
} & StyledImageProps, "children" | "as" | "src">;
|
|
18
|
+
} & StyledImageProps, "hidden" | "children" | "as" | "src">;
|
|
16
19
|
export { StyledImage };
|