carbon-react 111.5.2 → 111.5.3

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.
@@ -1 +1,2 @@
1
- export { default } from "./search";
1
+ export { default } from "./search.component";
2
+ export type { SearchProps } from "./search.component";
@@ -0,0 +1,3 @@
1
+ export declare const StyledButtonIcon: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ declare const StyledSearchButton: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ export default StyledSearchButton;
@@ -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 ["", -1];
60
+ return [undefined, -1];
61
61
  }, [isControlled, searchValue, value, isFocused, searchIsActive, threshold, searchButton, inputRef]);
62
+ let buttonProps = {};
62
63
 
63
- const handleChange = e => {
64
+ const handleChange = event => {
64
65
  if (onChange) {
65
- onChange(e);
66
+ onChange(event);
66
67
  }
67
68
 
68
69
  if (!isControlled) {
69
- setSearchValue(e.target.value);
70
+ setSearchValue(event.target.value);
70
71
  }
71
72
  };
72
73
 
73
- const handleFocus = e => {
74
+ const handleFocus = event => {
74
75
  setIsFocused(true);
75
76
 
76
77
  if (onFocus) {
77
- onFocus(e);
78
+ onFocus(event);
78
79
  }
79
80
  };
80
81
 
81
- let buttonProps = {};
82
-
83
82
  if (searchButton && onClick) {
84
83
  buttonProps = {
85
- onClick: ev => {
84
+ onClick: () => {
86
85
  onClick({
87
86
  target: {
88
- name: ev.target.name || name,
89
- id: ev.target.id || 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 = ev => {
115
- ev.preventDefault();
113
+ const handleMouseDown = event => {
114
+ event.preventDefault();
116
115
  };
117
116
 
118
- const handleBlur = e => {
117
+ const handleBlur = event => {
119
118
  setIsFocused(false);
120
119
 
121
120
  if (onBlur) {
122
- onBlur(e);
121
+ onBlur(event);
123
122
  }
124
123
  };
125
124
 
126
- const handleKeyDown = ev => {
127
- if (ev.key.length === 1) {
128
- ev.stopPropagation();
125
+ const handleKeyDown = event => {
126
+ if (event.key.length === 1) {
127
+ event.stopPropagation();
129
128
  }
130
129
 
131
130
  if (onKeyDown) {
132
- onKeyDown(ev);
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, Boolean(isFocused || (!isControlled ? searchValue.length : value.length)) && /*#__PURE__*/React.createElement(Button, _extends({
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
- * @private
241
- * @ignore
242
- * A callback to retrieve the input reference
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
- /** Input tabindex */
249
- tabIndex: PropTypes.number,
250
-
251
- /** Indicate that error has occurred
252
- Pass string to display icon, tooltip and red border
253
- Pass true boolean to only display red border */
254
- error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
255
-
256
- /** Indicate that warning has occurred
257
- Pass string to display icon, tooltip and orange border
258
- Pass true boolean to only display orange border */
259
- warning: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
260
-
261
- /** Indicate additional information
262
- Pass string to display icon, tooltip and blue border
263
- Pass true boolean to only display blue border */
264
- info: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
265
-
266
- /** Overrides the default tooltip position */
267
- tooltipPosition: PropTypes.oneOf(["top", "bottom", "left", "right"])
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;
@@ -1 +1,2 @@
1
- export { default } from "./search";
1
+ export { default } from "./search.component";
2
+ export type { SearchProps } from "./search.component";
@@ -0,0 +1,3 @@
1
+ export declare const StyledButtonIcon: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ declare const StyledSearchButton: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ export default StyledSearchButton;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.StyledButtonIcon = void 0;
7
+
8
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
9
+
10
+ var _button = _interopRequireDefault(require("../button/button.style"));
11
+
12
+ var _icon = _interopRequireDefault(require("../icon/icon.style"));
13
+
14
+ var _themes = require("../../style/themes");
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ const StyledButtonIcon = _styledComponents.default.div`
19
+ &&& ${_icon.default} {
20
+ color: var(--colorsActionMajorYang100);
21
+ margin-right: 0px;
22
+ }
23
+ `;
24
+ exports.StyledButtonIcon = StyledButtonIcon;
25
+ const StyledSearchButton = _styledComponents.default.div`
26
+ display: inline-flex;
27
+ border-bottom: none;
28
+
29
+ & ${_button.default} {
30
+ background-color: var(--colorsActionMajor500);
31
+ border-color: var(--colorsActionMajorTransparent);
32
+ :hover {
33
+ background: var(--colorsActionMajor600);
34
+ border-color: var(--colorsActionMajorTransparent);
35
+ }
36
+
37
+ width: 40px;
38
+ margin: 0px 0px;
39
+ padding-bottom: 3px;
40
+ :focus {
41
+ z-index: ${({
42
+ theme
43
+ }) => theme.zIndex.smallOverlay};
44
+ }
45
+ }
46
+ `;
47
+ StyledSearchButton.defaultProps = {
48
+ theme: _themes.baseTheme
49
+ };
50
+ var _default = StyledSearchButton;
51
+ exports.default = _default;