@npm_leadtech/legal-lib-components 7.22.11 → 7.23.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.
Files changed (59) hide show
  1. package/dist/src/components/atoms/DropdownInput/DropdownInput.d.ts +1 -1
  2. package/dist/src/components/atoms/DropdownInput/DropdownInput.js +5 -7
  3. package/dist/src/components/atoms/DropdownInput/DropdownInput.styled.js +36 -43
  4. package/dist/src/components/atoms/DropdownInput/DropdownInput.styled.ts +37 -43
  5. package/dist/src/components/atoms/DropdownInput/DropdownInput.tsx +51 -50
  6. package/dist/src/components/atoms/DropdownInput/DropdownInputProps.types.d.ts +0 -1
  7. package/dist/src/components/atoms/DropdownInput/DropdownInputProps.types.ts +0 -1
  8. package/dist/src/components/molecules/SearchBar/SearchBar.js +29 -17
  9. package/dist/src/components/molecules/SearchBar/SearchBar.styled.js +55 -4
  10. package/dist/src/components/molecules/SearchBar/SearchBar.styled.ts +55 -4
  11. package/dist/src/components/molecules/SearchBar/SearchBar.tsx +61 -31
  12. package/dist/src/components/organisms/VisibleEnvVariables/VisibleEnvVariables.d.ts +4 -0
  13. package/dist/src/components/organisms/VisibleEnvVariables/VisibleEnvVariables.js +6 -0
  14. package/dist/src/components/organisms/VisibleEnvVariables/VisibleEnvVariables.styled.d.ts +1 -0
  15. package/dist/src/components/organisms/VisibleEnvVariables/VisibleEnvVariables.styled.js +13 -0
  16. package/dist/src/components/organisms/VisibleEnvVariables/VisibleEnvVariables.styled.ts +14 -0
  17. package/dist/src/components/organisms/VisibleEnvVariables/VisibleEnvVariables.tsx +18 -0
  18. package/dist/src/components/organisms/VisibleEnvVariables/VisibleEnvVariablesProps.types.d.ts +3 -0
  19. package/dist/src/components/organisms/VisibleEnvVariables/VisibleEnvVariablesProps.types.ts +3 -0
  20. package/dist/src/components/organisms/VisibleEnvVariables/index.d.ts +2 -0
  21. package/dist/src/components/organisms/VisibleEnvVariables/index.js +1 -0
  22. package/dist/src/components/organisms/VisibleEnvVariables/index.ts +2 -0
  23. package/dist/src/components/organisms/index.d.ts +1 -0
  24. package/dist/src/components/organisms/index.js +1 -0
  25. package/dist/src/components/organisms/index.ts +1 -0
  26. package/dist/tsconfig.build.tsbuildinfo +1 -1
  27. package/package.json +2 -1
  28. package/dist/images/componentsSvg/CloseIcon.d.ts +0 -6
  29. package/dist/images/componentsSvg/CloseIcon.js +0 -2
  30. package/dist/images/componentsSvg/CloseIcon.tsx +0 -14
  31. package/dist/images/svg/close-grey-24px.svg +0 -3
  32. package/dist/images/svg/search_24px.svg +0 -3
  33. package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBar.d.ts +0 -8
  34. package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBar.js +0 -44
  35. package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBar.styled.d.ts +0 -1
  36. package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBar.styled.js +0 -48
  37. package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBar.styled.ts +0 -49
  38. package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBar.tsx +0 -77
  39. package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBarProps.types.d.ts +0 -37
  40. package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBarProps.types.ts +0 -40
  41. package/dist/src/components/molecules/DesktopSearchBar/index.d.ts +0 -2
  42. package/dist/src/components/molecules/DesktopSearchBar/index.js +0 -1
  43. package/dist/src/components/molecules/DesktopSearchBar/index.ts +0 -2
  44. package/dist/src/components/molecules/MobileSearchBar/MobileSearchBar.d.ts +0 -3
  45. package/dist/src/components/molecules/MobileSearchBar/MobileSearchBar.js +0 -38
  46. package/dist/src/components/molecules/MobileSearchBar/MobileSearchBar.styled.d.ts +0 -1
  47. package/dist/src/components/molecules/MobileSearchBar/MobileSearchBar.styled.js +0 -17
  48. package/dist/src/components/molecules/MobileSearchBar/MobileSearchBar.styled.ts +0 -18
  49. package/dist/src/components/molecules/MobileSearchBar/MobileSearchBar.tsx +0 -55
  50. package/dist/src/components/molecules/MobileSearchBar/MobileSearchBarProps.types.d.ts +0 -37
  51. package/dist/src/components/molecules/MobileSearchBar/MobileSearchBarProps.types.js +0 -1
  52. package/dist/src/components/molecules/MobileSearchBar/MobileSearchBarProps.types.ts +0 -40
  53. package/dist/src/components/molecules/MobileSearchBar/index.d.ts +0 -2
  54. package/dist/src/components/molecules/MobileSearchBar/index.js +0 -1
  55. package/dist/src/components/molecules/MobileSearchBar/index.ts +0 -2
  56. package/dist/src/hooks/useSearchFunction.d.ts +0 -10
  57. package/dist/src/hooks/useSearchFunction.js +0 -28
  58. package/dist/src/hooks/useSearchFunction.tsx +0 -63
  59. /package/dist/src/components/{molecules/DesktopSearchBar/DesktopSearchBarProps.types.js → organisms/VisibleEnvVariables/VisibleEnvVariablesProps.types.js} +0 -0
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
  import { DropdownInputProps } from './DropdownInputProps.types';
3
- export declare const DropdownInput: React.ForwardRefExoticComponent<DropdownInputProps & React.RefAttributes<HTMLInputElement>>;
3
+ export declare const DropdownInput: React.FC<DropdownInputProps>;
@@ -1,9 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- /* eslint-disable jsx-a11y/click-events-have-key-events */
3
2
  /* eslint-disable jsx-a11y/no-static-element-interactions */
4
- import React, { forwardRef, useState } from 'react';
3
+ import React, { useState } from 'react';
5
4
  import { DropdownInputStyled } from './DropdownInput.styled';
6
- export const DropdownInput = forwardRef(({ onChange, results, className = '', name, icon, placeholder, onClose }, ref) => {
5
+ export const DropdownInput = ({ onChange, results, className = '', name, icon, placeholder }) => {
7
6
  const [searchTerm, setSearchTerm] = useState('');
8
7
  const updateInput = (e) => {
9
8
  setSearchTerm(e.target.value);
@@ -12,9 +11,9 @@ export const DropdownInput = forwardRef(({ onChange, results, className = '', na
12
11
  const resetInput = () => {
13
12
  setSearchTerm('');
14
13
  };
15
- return (_jsxs(DropdownInputStyled, { className: `dropdown_input ${className}`, children: [_jsxs("div", { className: 'dropdown_input__container', children: [_jsx("input", { ref: ref, className: `dropdown_input__container__text_input ${icon ? 'with-icon' : ''}`, type: 'text', name: `dropdown_input_${name}`, placeholder: placeholder, value: searchTerm, onChange: (e) => {
14
+ return (_jsxs(DropdownInputStyled, { className: `dropdown_input ${className}`, children: [_jsxs("div", { className: 'dropdown_input__container', children: [_jsx("input", { className: `dropdown_input__container__text_input ${icon ? 'with-icon' : ''}`, type: 'text', name: `dropdown_input_${name}`, placeholder: placeholder, value: searchTerm, onChange: (e) => {
16
15
  updateInput(e);
17
- } }), _jsxs("div", { className: `dropdown_input__container__icon ${searchTerm ? 'active' : ''}`, onClick: onClose, children: [icon &&
16
+ } }), _jsxs("div", { className: `dropdown_input__container__icon ${searchTerm ? 'active' : ''}`, children: [icon &&
18
17
  React.cloneElement(icon, {
19
18
  className: 'dropdown_input__container__icon__main'
20
19
  }), searchTerm && (_jsx("div", { className: 'icon-cross main-color dropdown_input__container__icon__clear', onClick: () => {
@@ -22,5 +21,4 @@ export const DropdownInput = forwardRef(({ onChange, results, className = '', na
22
21
  }, onKeyDown: () => {
23
22
  resetInput();
24
23
  } }))] })] }), searchTerm && !!results?.length && _jsx("ul", { className: 'dropdown_input__results', children: results })] }));
25
- });
26
- DropdownInput.displayName = 'DropdownInput';
24
+ };
@@ -2,16 +2,34 @@ import { device } from '../../../globalStyles/breakpoints';
2
2
  import styled from 'styled-components';
3
3
  export const DropdownInputStyled = styled.div `
4
4
  position: relative;
5
- padding: 1.5rem;
6
-
7
- @media ${device['landscape-tablets']} {
8
- padding: 16px 24px;
9
- }
5
+ padding-left: 1.5rem;
6
+ padding-right: 1.5rem;
10
7
 
11
8
  a {
12
9
  text-decoration: none;
13
10
  }
14
11
 
12
+ &:focus-within {
13
+ @media ${device['landscape-tablets']} {
14
+ .dropdown_input__container {
15
+ border-bottom: 2px var(--neutral-neutral-4) solid;
16
+ }
17
+
18
+ .dropdown_input__results {
19
+ opacity: 1;
20
+ }
21
+ }
22
+
23
+ .dropdown_input__container__icon {
24
+ color: var(--primary-main);
25
+
26
+ svg {
27
+ fill: var(--primary-main);
28
+ stroke: var(--primary-main);
29
+ }
30
+ }
31
+ }
32
+
15
33
  .dropdown_input__container {
16
34
  position: relative;
17
35
  height: 2.75rem;
@@ -20,24 +38,7 @@ export const DropdownInputStyled = styled.div `
20
38
 
21
39
  @media ${device['landscape-tablets']} {
22
40
  border-top: 2px solid transparent;
23
- border-bottom: none;
24
- }
25
-
26
- &:focus-within {
27
- border-bottom: 2px var(--neutral-neutral-4) solid;
28
-
29
- @media ${device['landscape-tablets']} {
30
- border-bottom: none;
31
- }
32
-
33
- .dropdown_input__container__icon {
34
- color: var(--neutral-neutral-3);
35
-
36
- svg {
37
- fill: var(--neutral-neutral-3);
38
- stroke: var(--neutral-neutral-3);
39
- }
40
- }
41
+ border-bottom: 2px solid transparent;
41
42
  }
42
43
 
43
44
  .dropdown_input__container__text_input {
@@ -54,7 +55,7 @@ export const DropdownInputStyled = styled.div `
54
55
  color: var(--neutral-neutral-3);
55
56
  }
56
57
 
57
- &.with-icon {
58
+ .dropdown_input__container__text_input.with-icon {
58
59
  padding-right: 2rem;
59
60
  }
60
61
  }
@@ -67,10 +68,10 @@ export const DropdownInputStyled = styled.div `
67
68
  top: 0;
68
69
  height: 100%;
69
70
  color: var(--neutral-neutral-3);
70
- fill: var(--neutral-neutral-3);
71
+ fill: currentColor;
71
72
 
72
73
  @media ${device['landscape-tablets']} {
73
- cursor: pointer;
74
+ pointer-events: none;
74
75
  }
75
76
 
76
77
  .dropdown_input__container__icon__main {
@@ -78,11 +79,9 @@ export const DropdownInputStyled = styled.div `
78
79
  height: 1.5rem;
79
80
  opacity: 1;
80
81
  margin-right: 0.25rem;
81
- cursor: pointer;
82
82
 
83
83
  path {
84
84
  transition: all 0.25s;
85
- fill: var(--neutral-neutral-3);
86
85
  }
87
86
  }
88
87
 
@@ -116,27 +115,21 @@ export const DropdownInputStyled = styled.div `
116
115
  .dropdown_input__results {
117
116
  transition: all 0.25s;
118
117
  display: flex;
118
+ position: relative;
119
119
  flex-direction: column;
120
120
  width: 100%;
121
- border-radius: 8px;
121
+ border-radius: $s-border-radius;
122
+ margin-top: 1rem;
122
123
  background: var(--others-white);
123
124
  min-width: 20rem;
124
- position: absolute;
125
- top: 100%;
126
- left: 0;
127
- z-index: 10;
128
- background-color: var(--others-white);
129
- border-top: none;
130
- padding: 1rem 2rem;
131
-
132
- @media ${device['laptop']} {
133
- opacity: 1;
125
+
126
+ @media ${device['landscape-tablets']} {
127
+ position: absolute;
128
+ opacity: 0;
134
129
  left: 0;
135
130
  top: 100%;
136
- box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
137
- margin-top: -5px;
138
- border: none;
139
- border-radius: 0 0 8px 8px;
131
+ box-shadow: $box-shadow-medium;
132
+ padding: 0.75rem 1rem;
140
133
  }
141
134
 
142
135
  & > li > * {
@@ -1,18 +1,37 @@
1
1
  import { device } from '../../../globalStyles/breakpoints'
2
+
2
3
  import styled from 'styled-components'
3
4
 
4
5
  export const DropdownInputStyled = styled.div`
5
6
  position: relative;
6
- padding: 1.5rem;
7
-
8
- @media ${device['landscape-tablets']} {
9
- padding: 16px 24px;
10
- }
7
+ padding-left: 1.5rem;
8
+ padding-right: 1.5rem;
11
9
 
12
10
  a {
13
11
  text-decoration: none;
14
12
  }
15
13
 
14
+ &:focus-within {
15
+ @media ${device['landscape-tablets']} {
16
+ .dropdown_input__container {
17
+ border-bottom: 2px var(--neutral-neutral-4) solid;
18
+ }
19
+
20
+ .dropdown_input__results {
21
+ opacity: 1;
22
+ }
23
+ }
24
+
25
+ .dropdown_input__container__icon {
26
+ color: var(--primary-main);
27
+
28
+ svg {
29
+ fill: var(--primary-main);
30
+ stroke: var(--primary-main);
31
+ }
32
+ }
33
+ }
34
+
16
35
  .dropdown_input__container {
17
36
  position: relative;
18
37
  height: 2.75rem;
@@ -21,24 +40,7 @@ export const DropdownInputStyled = styled.div`
21
40
 
22
41
  @media ${device['landscape-tablets']} {
23
42
  border-top: 2px solid transparent;
24
- border-bottom: none;
25
- }
26
-
27
- &:focus-within {
28
- border-bottom: 2px var(--neutral-neutral-4) solid;
29
-
30
- @media ${device['landscape-tablets']} {
31
- border-bottom: none;
32
- }
33
-
34
- .dropdown_input__container__icon {
35
- color: var(--neutral-neutral-3);
36
-
37
- svg {
38
- fill: var(--neutral-neutral-3);
39
- stroke: var(--neutral-neutral-3);
40
- }
41
- }
43
+ border-bottom: 2px solid transparent;
42
44
  }
43
45
 
44
46
  .dropdown_input__container__text_input {
@@ -55,7 +57,7 @@ export const DropdownInputStyled = styled.div`
55
57
  color: var(--neutral-neutral-3);
56
58
  }
57
59
 
58
- &.with-icon {
60
+ .dropdown_input__container__text_input.with-icon {
59
61
  padding-right: 2rem;
60
62
  }
61
63
  }
@@ -68,10 +70,10 @@ export const DropdownInputStyled = styled.div`
68
70
  top: 0;
69
71
  height: 100%;
70
72
  color: var(--neutral-neutral-3);
71
- fill: var(--neutral-neutral-3);
73
+ fill: currentColor;
72
74
 
73
75
  @media ${device['landscape-tablets']} {
74
- cursor: pointer;
76
+ pointer-events: none;
75
77
  }
76
78
 
77
79
  .dropdown_input__container__icon__main {
@@ -79,11 +81,9 @@ export const DropdownInputStyled = styled.div`
79
81
  height: 1.5rem;
80
82
  opacity: 1;
81
83
  margin-right: 0.25rem;
82
- cursor: pointer;
83
84
 
84
85
  path {
85
86
  transition: all 0.25s;
86
- fill: var(--neutral-neutral-3);
87
87
  }
88
88
  }
89
89
 
@@ -117,27 +117,21 @@ export const DropdownInputStyled = styled.div`
117
117
  .dropdown_input__results {
118
118
  transition: all 0.25s;
119
119
  display: flex;
120
+ position: relative;
120
121
  flex-direction: column;
121
122
  width: 100%;
122
- border-radius: 8px;
123
+ border-radius: $s-border-radius;
124
+ margin-top: 1rem;
123
125
  background: var(--others-white);
124
126
  min-width: 20rem;
125
- position: absolute;
126
- top: 100%;
127
- left: 0;
128
- z-index: 10;
129
- background-color: var(--others-white);
130
- border-top: none;
131
- padding: 1rem 2rem;
132
-
133
- @media ${device['laptop']} {
134
- opacity: 1;
127
+
128
+ @media ${device['landscape-tablets']} {
129
+ position: absolute;
130
+ opacity: 0;
135
131
  left: 0;
136
132
  top: 100%;
137
- box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
138
- margin-top: -5px;
139
- border: none;
140
- border-radius: 0 0 8px 8px;
133
+ box-shadow: $box-shadow-medium;
134
+ padding: 0.75rem 1rem;
141
135
  }
142
136
 
143
137
  & > li > * {
@@ -1,59 +1,60 @@
1
- /* eslint-disable jsx-a11y/click-events-have-key-events */
2
1
  /* eslint-disable jsx-a11y/no-static-element-interactions */
3
- import React, { forwardRef, useState } from 'react'
4
2
 
3
+ import React, { useState } from 'react'
5
4
  import { DropdownInputProps } from './DropdownInputProps.types'
6
5
  import { DropdownInputStyled } from './DropdownInput.styled'
7
6
 
8
- export const DropdownInput = forwardRef<HTMLInputElement, DropdownInputProps>(
9
- ({ onChange, results, className = '', name, icon, placeholder, onClose }, ref) => {
10
- const [searchTerm, setSearchTerm] = useState('')
7
+ export const DropdownInput: React.FC<DropdownInputProps> = ({
8
+ onChange,
9
+ results,
10
+ className = '',
11
+ name,
12
+ icon,
13
+ placeholder
14
+ }) => {
15
+ const [searchTerm, setSearchTerm] = useState('')
11
16
 
12
- const updateInput = (e): void => {
13
- setSearchTerm(e.target.value)
14
- onChange(e.target.value)
15
- }
16
-
17
- const resetInput = (): void => {
18
- setSearchTerm('')
19
- }
17
+ const updateInput = (e): void => {
18
+ setSearchTerm(e.target.value)
19
+ onChange(e.target.value)
20
+ }
20
21
 
21
- return (
22
- <DropdownInputStyled className={`dropdown_input ${className}`}>
23
- <div className='dropdown_input__container'>
24
- <input
25
- ref={ref}
26
- className={`dropdown_input__container__text_input ${icon ? 'with-icon' : ''}`}
27
- type='text'
28
- name={`dropdown_input_${name}`}
29
- placeholder={placeholder}
30
- value={searchTerm}
31
- onChange={(e) => {
32
- updateInput(e)
33
- }}
34
- />
35
- <div className={`dropdown_input__container__icon ${searchTerm ? 'active' : ''}`} onClick={onClose}>
36
- {icon &&
37
- React.cloneElement(icon, {
38
- className: 'dropdown_input__container__icon__main'
39
- })}
40
- {searchTerm && (
41
- <div
42
- className='icon-cross main-color dropdown_input__container__icon__clear'
43
- onClick={() => {
44
- resetInput()
45
- }}
46
- onKeyDown={() => {
47
- resetInput()
48
- }}
49
- ></div>
50
- )}
51
- </div>
52
- </div>
53
- {searchTerm && !!results?.length && <ul className='dropdown_input__results'>{results}</ul>}
54
- </DropdownInputStyled>
55
- )
22
+ const resetInput = (): void => {
23
+ setSearchTerm('')
56
24
  }
57
- )
58
25
 
59
- DropdownInput.displayName = 'DropdownInput'
26
+ return (
27
+ <DropdownInputStyled className={`dropdown_input ${className}`}>
28
+ <div className='dropdown_input__container'>
29
+ <input
30
+ className={`dropdown_input__container__text_input ${icon ? 'with-icon' : ''}`}
31
+ type='text'
32
+ name={`dropdown_input_${name}`}
33
+ placeholder={placeholder}
34
+ value={searchTerm}
35
+ onChange={(e) => {
36
+ updateInput(e)
37
+ }}
38
+ />
39
+ <div className={`dropdown_input__container__icon ${searchTerm ? 'active' : ''}`}>
40
+ {icon &&
41
+ React.cloneElement(icon, {
42
+ className: 'dropdown_input__container__icon__main'
43
+ })}
44
+ {searchTerm && (
45
+ <div
46
+ className='icon-cross main-color dropdown_input__container__icon__clear'
47
+ onClick={() => {
48
+ resetInput()
49
+ }}
50
+ onKeyDown={() => {
51
+ resetInput()
52
+ }}
53
+ ></div>
54
+ )}
55
+ </div>
56
+ </div>
57
+ {searchTerm && !!results?.length && <ul className='dropdown_input__results'>{results}</ul>}
58
+ </DropdownInputStyled>
59
+ )
60
+ }
@@ -5,5 +5,4 @@ export interface DropdownInputProps {
5
5
  icon: any;
6
6
  onChange: (arg: string) => void;
7
7
  results: React.JSX.Element[];
8
- onClose?: () => void;
9
8
  }
@@ -7,5 +7,4 @@ export interface DropdownInputProps {
7
7
  icon: any
8
8
  onChange: (arg: string) => void
9
9
  results: React.JSX.Element[]
10
- onClose?: () => void
11
10
  }
@@ -1,21 +1,33 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- /* eslint-disable jsx-a11y/click-events-have-key-events */
3
- /* eslint-disable jsx-a11y/no-static-element-interactions */
4
- /* eslint-disable jsx-a11y/anchor-is-valid */
5
2
  import { useState } from 'react';
6
- import { DesktopSearchBar } from '../DesktopSearchBar';
7
- import { MobileSearchBar } from '../MobileSearchBar';
3
+ import { DropdownInput } from '../../atoms/DropdownInput/DropdownInput';
4
+ import { SearchIcon } from '../../../../images/componentsSvg/SearchIcon';
5
+ import { useWindowSize } from '../../../hooks/useWindowSize';
8
6
  import { SearchBarStyled } from './SearchBar.styled';
9
- import search from '../../../../images/svg/search_24px.svg';
10
- export const SearchBar = (props) => {
11
- const [isModalOpen, setIsModalOpen] = useState(false);
12
- const closeModal = () => setIsModalOpen(false);
13
- return (_jsx(SearchBarStyled, { children: _jsxs("div", { style: { position: 'relative', display: 'flex' }, children: [_jsx("a", { onClick: () => setIsModalOpen(true), style: {
14
- cursor: 'pointer',
15
- width: '20px',
16
- height: '20px'
17
- }, className: 'search-icon-container', children: _jsx("img", { src: search, alt: 'search-icon-primary', style: {
18
- width: '100%',
19
- height: '100%'
20
- } }) }), _jsx(DesktopSearchBar, { ...props, isOpen: isModalOpen, onClose: closeModal }), _jsx(MobileSearchBar, { ...props })] }) }));
7
+ export const SearchBar = ({ products, searchBarTexts, routes, handleResultClick }) => {
8
+ const [results, setResults] = useState([]);
9
+ const windowSize = useWindowSize();
10
+ const _placeholder = windowSize.width === null || windowSize.width >= 720 ? '' : searchBarTexts.placeholder;
11
+ const searchFunction = (text) => {
12
+ const searchTerm = text.toLowerCase();
13
+ const productsFiltered = products.filter((item) => item.linkText.toLowerCase().includes(searchTerm));
14
+ const results = productsFiltered
15
+ .map((item) => {
16
+ const product = item.linkText;
17
+ const preMatch = product.slice(0, product.toLowerCase().indexOf(searchTerm));
18
+ const match = product.slice(product.toLowerCase().indexOf(searchTerm), preMatch.length + searchTerm.length);
19
+ const postMatch = product.slice(product.toLowerCase().indexOf(searchTerm) + searchTerm.length, product.length);
20
+ const link = item.categoryUrl ? `${item.categoryUrl}/${item.slug}` : item.slug;
21
+ return (_jsx("li", { className: 'dropdown_input__item', children: _jsxs("a", { href: routes.CUSTOM_URL_FROM_TARGET_ADDRESS(link), className: 'dropdown_input__link', onClick: (e) => {
22
+ e.preventDefault();
23
+ handleResultClick(product, routes.CUSTOM_URL_FROM_TARGET_ADDRESS(link));
24
+ }, title: product, children: [preMatch, _jsx("strong", { className: 'dropdown_input__link__emphasis', children: match }), postMatch] }, item.linkText) }, searchBarTexts.title));
25
+ })
26
+ .slice(0, 9);
27
+ results.push(_jsx("li", { className: 'dropdown_input__item', children: _jsx("a", { className: 'dropdown_input__link--all', title: searchBarTexts.title, href: routes.LEGAL_DOCUMENTS, children: searchBarTexts.title }) }, searchBarTexts.title));
28
+ setResults(results);
29
+ };
30
+ return (_jsx(SearchBarStyled, { children: _jsx(DropdownInput, { name: 'search', className: 'search', placeholder: _placeholder, icon: _jsx(SearchIcon, {}), onChange: (text) => {
31
+ searchFunction(text);
32
+ }, results: results }) }));
21
33
  };
@@ -1,11 +1,62 @@
1
1
  import { device } from '../../../globalStyles/breakpoints';
2
2
  import styled from 'styled-components';
3
3
  export const SearchBarStyled = styled.div `
4
- .search-icon-container {
5
- display: none;
4
+ .dropdown_input {
5
+ .search {
6
+ width: calc(100% - 3rem);
7
+ margin: 0 1.5rem;
6
8
 
7
- @media ${device['landscape-tablets']} {
8
- display: block;
9
+ @media ${device['landscape-tablets']} {
10
+ display: none;
11
+ }
12
+
13
+ @media ${device['landscape-tablets']} {
14
+ display: block;
15
+ width: 10rem;
16
+ margin: 0 1.5rem 0 0;
17
+ }
18
+
19
+ @media ${device['desktop']} {
20
+ width: 14rem;
21
+ }
22
+
23
+ .dropdown_input__results {
24
+ transition: all 0.25s;
25
+ min-width: 100%;
26
+ width: max-content;
27
+ }
28
+
29
+ .dropdown_input__link {
30
+ color: var(--neutral-neutral-3);
31
+ animation: newLine 0.5s;
32
+
33
+ &:hover {
34
+ color: var(--others-black);
35
+ }
36
+
37
+ &__emphasis {
38
+ font-style: normal;
39
+ font-weight: normal;
40
+ color: var(--others-black);
41
+ }
42
+
43
+ &--all {
44
+ font-weight: bold;
45
+ animation: none;
46
+ }
47
+ }
48
+ }
49
+ }
50
+
51
+ @keyframes newLine {
52
+ 0% {
53
+ opacity: 0;
54
+ line-height: 0rem;
55
+ }
56
+
57
+ 100% {
58
+ opacity: 1;
59
+ line-height: 1.5rem;
9
60
  }
10
61
  }
11
62
  `;
@@ -2,11 +2,62 @@ import { device } from '../../../globalStyles/breakpoints'
2
2
  import styled from 'styled-components'
3
3
 
4
4
  export const SearchBarStyled = styled.div`
5
- .search-icon-container {
6
- display: none;
5
+ .dropdown_input {
6
+ .search {
7
+ width: calc(100% - 3rem);
8
+ margin: 0 1.5rem;
7
9
 
8
- @media ${device['landscape-tablets']} {
9
- display: block;
10
+ @media ${device['landscape-tablets']} {
11
+ display: none;
12
+ }
13
+
14
+ @media ${device['landscape-tablets']} {
15
+ display: block;
16
+ width: 10rem;
17
+ margin: 0 1.5rem 0 0;
18
+ }
19
+
20
+ @media ${device['desktop']} {
21
+ width: 14rem;
22
+ }
23
+
24
+ .dropdown_input__results {
25
+ transition: all 0.25s;
26
+ min-width: 100%;
27
+ width: max-content;
28
+ }
29
+
30
+ .dropdown_input__link {
31
+ color: var(--neutral-neutral-3);
32
+ animation: newLine 0.5s;
33
+
34
+ &:hover {
35
+ color: var(--others-black);
36
+ }
37
+
38
+ &__emphasis {
39
+ font-style: normal;
40
+ font-weight: normal;
41
+ color: var(--others-black);
42
+ }
43
+
44
+ &--all {
45
+ font-weight: bold;
46
+ animation: none;
47
+ }
48
+ }
49
+ }
50
+ }
51
+
52
+ @keyframes newLine {
53
+ 0% {
54
+ opacity: 0;
55
+ line-height: 0rem;
56
+ }
57
+
58
+ 100% {
59
+ opacity: 1;
60
+ line-height: 1.5rem;
10
61
  }
11
62
  }
12
63
  `