@npm_leadtech/legal-lib-components 7.23.51 → 7.25.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/dist/images/componentsSvg/CloseIcon.d.ts +6 -0
- package/dist/images/componentsSvg/CloseIcon.js +2 -0
- package/dist/images/componentsSvg/CloseIcon.tsx +14 -0
- package/dist/images/svg/close-grey-24px.svg +3 -0
- package/dist/images/svg/search_24px.svg +3 -0
- package/dist/src/components/atoms/DropdownInput/DropdownInput.d.ts +1 -1
- package/dist/src/components/atoms/DropdownInput/DropdownInput.js +9 -7
- package/dist/src/components/atoms/DropdownInput/DropdownInput.styled.js +52 -35
- package/dist/src/components/atoms/DropdownInput/DropdownInput.styled.ts +52 -36
- package/dist/src/components/atoms/DropdownInput/DropdownInput.tsx +55 -51
- package/dist/src/components/atoms/DropdownInput/DropdownInputProps.types.d.ts +1 -0
- package/dist/src/components/atoms/DropdownInput/DropdownInputProps.types.ts +1 -0
- package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBar.d.ts +8 -0
- package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBar.js +44 -0
- package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBar.styled.d.ts +1 -0
- package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBar.styled.js +48 -0
- package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBar.styled.ts +49 -0
- package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBar.tsx +77 -0
- package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBarProps.types.d.ts +37 -0
- package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBarProps.types.js +1 -0
- package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBarProps.types.ts +40 -0
- package/dist/src/components/molecules/DesktopSearchBar/index.d.ts +2 -0
- package/dist/src/components/molecules/DesktopSearchBar/index.js +1 -0
- package/dist/src/components/molecules/DesktopSearchBar/index.ts +2 -0
- package/dist/src/components/molecules/MobileSearchBar/MobileSearchBar.d.ts +3 -0
- package/dist/src/components/molecules/MobileSearchBar/MobileSearchBar.js +38 -0
- package/dist/src/components/molecules/MobileSearchBar/MobileSearchBar.styled.d.ts +1 -0
- package/dist/src/components/molecules/MobileSearchBar/MobileSearchBar.styled.js +17 -0
- package/dist/src/components/molecules/MobileSearchBar/MobileSearchBar.styled.ts +18 -0
- package/dist/src/components/molecules/MobileSearchBar/MobileSearchBar.tsx +55 -0
- package/dist/src/components/molecules/MobileSearchBar/MobileSearchBarProps.types.d.ts +37 -0
- package/dist/src/components/molecules/MobileSearchBar/MobileSearchBarProps.types.js +1 -0
- package/dist/src/components/molecules/MobileSearchBar/MobileSearchBarProps.types.ts +40 -0
- package/dist/src/components/molecules/MobileSearchBar/index.d.ts +2 -0
- package/dist/src/components/molecules/MobileSearchBar/index.js +1 -0
- package/dist/src/components/molecules/MobileSearchBar/index.ts +2 -0
- package/dist/src/components/molecules/SearchBar/SearchBar.js +17 -29
- package/dist/src/components/molecules/SearchBar/SearchBar.styled.js +4 -55
- package/dist/src/components/molecules/SearchBar/SearchBar.styled.ts +4 -55
- package/dist/src/components/molecules/SearchBar/SearchBar.tsx +31 -61
- package/dist/src/hooks/useSearchFunction.d.ts +10 -0
- package/dist/src/hooks/useSearchFunction.js +28 -0
- package/dist/src/hooks/useSearchFunction.tsx +63 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export const CloseIcon = ({ className }) => (_jsx("svg", { className: className, width: 20, height: 20, viewBox: '0 0 20 20', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', children: _jsx("path", { d: 'M15.2462 5.92913C15.5706 5.60466 15.5706 5.07859 15.2462 4.75413C14.9217 4.42966 14.3956 4.42966 14.0712 4.75413L10.0003 8.82496L5.92949 4.75413C5.60503 4.42966 5.07896 4.42966 4.75449 4.75413C4.43002 5.07859 4.43003 5.60466 4.75449 5.92913L8.82533 9.99996L4.75449 14.0708C4.43003 14.3953 4.43002 14.9213 4.75449 15.2458C5.07896 15.5703 5.60502 15.5703 5.92949 15.2458L10.0003 11.175L14.0712 15.2458C14.3956 15.5703 14.9217 15.5703 15.2462 15.2458C15.5706 14.9213 15.5706 14.3953 15.2462 14.0708L11.1753 9.99996L15.2462 5.92913Z', fill: '#B5BABD' }) }));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { FC } from 'react'
|
|
2
|
+
|
|
3
|
+
interface Close24Props {
|
|
4
|
+
className?: string
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const CloseIcon: FC<Close24Props> = ({ className }: Close24Props): React.ReactElement => (
|
|
8
|
+
<svg className={className} width={20} height={20} viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'>
|
|
9
|
+
<path
|
|
10
|
+
d='M15.2462 5.92913C15.5706 5.60466 15.5706 5.07859 15.2462 4.75413C14.9217 4.42966 14.3956 4.42966 14.0712 4.75413L10.0003 8.82496L5.92949 4.75413C5.60503 4.42966 5.07896 4.42966 4.75449 4.75413C4.43002 5.07859 4.43003 5.60466 4.75449 5.92913L8.82533 9.99996L4.75449 14.0708C4.43003 14.3953 4.43002 14.9213 4.75449 15.2458C5.07896 15.5703 5.60502 15.5703 5.92949 15.2458L10.0003 11.175L14.0712 15.2458C14.3956 15.5703 14.9217 15.5703 15.2462 15.2458C15.5706 14.9213 15.5706 14.3953 15.2462 14.0708L11.1753 9.99996L15.2462 5.92913Z'
|
|
11
|
+
fill='#B5BABD'
|
|
12
|
+
/>
|
|
13
|
+
</svg>
|
|
14
|
+
)
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M15.2462 5.92913C15.5706 5.60466 15.5706 5.07859 15.2462 4.75413C14.9217 4.42966 14.3956 4.42966 14.0712 4.75413L10.0003 8.82496L5.92949 4.75413C5.60503 4.42966 5.07896 4.42966 4.75449 4.75413C4.43002 5.07859 4.43003 5.60466 4.75449 5.92913L8.82533 9.99996L4.75449 14.0708C4.43003 14.3953 4.43002 14.9213 4.75449 15.2458C5.07896 15.5703 5.60502 15.5703 5.92949 15.2458L10.0003 11.175L14.0712 15.2458C14.3956 15.5703 14.9217 15.5703 15.2462 15.2458C15.5706 14.9213 15.5706 14.3953 15.2462 14.0708L11.1753 9.99996L15.2462 5.92913Z" fill="#B5BABD"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M7.83105 13.9947C6.10828 13.9947 4.65024 13.3981 3.45694 12.2048C2.26364 11.0115 1.66699 9.55346 1.66699 7.83069C1.66699 6.10791 2.26364 4.64987 3.45694 3.45657C4.65024 2.26328 6.10828 1.66663 7.83105 1.66663C9.55383 1.66663 11.0119 2.26328 12.2052 3.45657C13.3985 4.64987 13.9951 6.10791 13.9951 7.83069C13.9951 8.52612 13.8845 9.18204 13.6632 9.79844C13.4419 10.4148 13.1416 10.9601 12.7623 11.4343L18.0729 16.7449C18.2467 16.9187 18.3337 17.14 18.3337 17.4087C18.3337 17.6774 18.2467 17.8986 18.0729 18.0725C17.899 18.2464 17.6777 18.3333 17.4091 18.3333C17.1404 18.3333 16.9191 18.2464 16.7452 18.0725L11.4347 12.7619C10.9605 13.1413 10.4152 13.4416 9.79881 13.6628C9.1824 13.8841 8.52648 13.9947 7.83105 13.9947ZM7.83105 12.0981C9.01645 12.0981 10.024 11.6832 10.8538 10.8534C11.6836 10.0237 12.0985 9.01608 12.0985 7.83069C12.0985 6.64529 11.6836 5.6377 10.8538 4.80793C10.024 3.97815 9.01645 3.56326 7.83105 3.56326C6.64566 3.56326 5.63807 3.97815 4.80829 4.80793C3.97851 5.6377 3.56363 6.64529 3.56363 7.83069C3.56363 9.01608 3.97851 10.0237 4.80829 10.8534C5.63807 11.6832 6.64566 12.0981 7.83105 12.0981Z" fill="#078080"/>
|
|
3
|
+
</svg>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DropdownInputProps } from './DropdownInputProps.types';
|
|
3
|
-
export declare const DropdownInput: React.
|
|
3
|
+
export declare const DropdownInput: React.ForwardRefExoticComponent<DropdownInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/* eslint-disable jsx-a11y/click-events-have-key-events */
|
|
2
3
|
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
3
|
-
import React, { useState } from 'react';
|
|
4
|
+
import React, { forwardRef, useState } from 'react';
|
|
4
5
|
import { DropdownInputStyled } from './DropdownInput.styled';
|
|
5
|
-
export const DropdownInput = ({ onChange, results, className = '', name, icon, placeholder }) => {
|
|
6
|
+
export const DropdownInput = forwardRef(({ onChange, results, className = '', name, icon, placeholder, onClose }, ref) => {
|
|
6
7
|
const [searchTerm, setSearchTerm] = useState('');
|
|
7
8
|
const updateInput = (e) => {
|
|
8
9
|
setSearchTerm(e.target.value);
|
|
@@ -11,14 +12,15 @@ export const DropdownInput = ({ onChange, results, className = '', name, icon, p
|
|
|
11
12
|
const resetInput = () => {
|
|
12
13
|
setSearchTerm('');
|
|
13
14
|
};
|
|
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) => {
|
|
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) => {
|
|
15
16
|
updateInput(e);
|
|
16
|
-
} }), _jsxs("div", { className: `dropdown_input__container__icon ${searchTerm ? 'active' : ''}`, children: [icon &&
|
|
17
|
+
} }), _jsxs("div", { className: `dropdown_input__container__icon ${searchTerm ? 'active' : ''}`, onClick: onClose, children: [icon &&
|
|
17
18
|
React.cloneElement(icon, {
|
|
18
19
|
className: 'dropdown_input__container__icon__main'
|
|
19
20
|
}), searchTerm && (_jsx("div", { className: 'icon-cross main-color dropdown_input__container__icon__clear', onClick: () => {
|
|
20
21
|
resetInput();
|
|
21
22
|
}, onKeyDown: () => {
|
|
22
23
|
resetInput();
|
|
23
|
-
} }))] })] }), searchTerm && !!results?.length && _jsx("ul", { className: 'dropdown_input__results', children: results })] }));
|
|
24
|
-
};
|
|
24
|
+
} }))] })] }), searchTerm && !!results?.length && (_jsxs(_Fragment, { children: [_jsx("div", { className: 'dropdown_input__separator' }), _jsx("ul", { className: 'dropdown_input__results', children: results })] }))] }));
|
|
25
|
+
});
|
|
26
|
+
DropdownInput.displayName = 'DropdownInput';
|
|
@@ -2,32 +2,14 @@ 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
|
|
6
|
-
padding-right: 1.5rem;
|
|
5
|
+
padding: 1.5rem;
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
@media ${device['landscape-tablets']} {
|
|
8
|
+
padding: 16px 24px;
|
|
10
9
|
}
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
}
|
|
11
|
+
a {
|
|
12
|
+
text-decoration: none;
|
|
31
13
|
}
|
|
32
14
|
|
|
33
15
|
.dropdown_input__container {
|
|
@@ -38,7 +20,24 @@ export const DropdownInputStyled = styled.div `
|
|
|
38
20
|
|
|
39
21
|
@media ${device['landscape-tablets']} {
|
|
40
22
|
border-top: 2px solid transparent;
|
|
41
|
-
border-bottom:
|
|
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
|
+
}
|
|
42
41
|
}
|
|
43
42
|
|
|
44
43
|
.dropdown_input__container__text_input {
|
|
@@ -55,7 +54,7 @@ export const DropdownInputStyled = styled.div `
|
|
|
55
54
|
color: var(--neutral-neutral-3);
|
|
56
55
|
}
|
|
57
56
|
|
|
58
|
-
|
|
57
|
+
&.with-icon {
|
|
59
58
|
padding-right: 2rem;
|
|
60
59
|
}
|
|
61
60
|
}
|
|
@@ -68,10 +67,10 @@ export const DropdownInputStyled = styled.div `
|
|
|
68
67
|
top: 0;
|
|
69
68
|
height: 100%;
|
|
70
69
|
color: var(--neutral-neutral-3);
|
|
71
|
-
fill:
|
|
70
|
+
fill: var(--neutral-neutral-3);
|
|
72
71
|
|
|
73
72
|
@media ${device['landscape-tablets']} {
|
|
74
|
-
|
|
73
|
+
cursor: pointer;
|
|
75
74
|
}
|
|
76
75
|
|
|
77
76
|
.dropdown_input__container__icon__main {
|
|
@@ -79,9 +78,11 @@ export const DropdownInputStyled = styled.div `
|
|
|
79
78
|
height: 1.5rem;
|
|
80
79
|
opacity: 1;
|
|
81
80
|
margin-right: 0.25rem;
|
|
81
|
+
cursor: pointer;
|
|
82
82
|
|
|
83
83
|
path {
|
|
84
84
|
transition: all 0.25s;
|
|
85
|
+
fill: var(--neutral-neutral-3);
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
88
|
|
|
@@ -112,24 +113,36 @@ export const DropdownInputStyled = styled.div `
|
|
|
112
113
|
}
|
|
113
114
|
}
|
|
114
115
|
|
|
116
|
+
.dropdown_input__separator {
|
|
117
|
+
margin-top: 0.6rem;
|
|
118
|
+
border-top: 1.5px solid var(--neutral-neutral-4);
|
|
119
|
+
}
|
|
120
|
+
|
|
115
121
|
.dropdown_input__results {
|
|
116
122
|
transition: all 0.25s;
|
|
117
123
|
display: flex;
|
|
118
|
-
position: relative;
|
|
119
124
|
flex-direction: column;
|
|
120
125
|
width: 100%;
|
|
121
|
-
border-radius:
|
|
122
|
-
margin-top: 1rem;
|
|
126
|
+
border-radius: 8px;
|
|
123
127
|
background: var(--others-white);
|
|
124
|
-
|
|
128
|
+
width: 300px;
|
|
129
|
+
position: absolute;
|
|
130
|
+
top: 100%;
|
|
131
|
+
left: 0;
|
|
132
|
+
z-index: 10;
|
|
133
|
+
background-color: var(--others-white);
|
|
134
|
+
border-top: none;
|
|
135
|
+
padding: 1rem 2rem;
|
|
125
136
|
|
|
126
137
|
@media ${device['landscape-tablets']} {
|
|
127
|
-
|
|
128
|
-
opacity: 0;
|
|
138
|
+
opacity: 1;
|
|
129
139
|
left: 0;
|
|
130
140
|
top: 100%;
|
|
131
|
-
|
|
132
|
-
|
|
141
|
+
width: 100%;
|
|
142
|
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
|
143
|
+
margin-top: -15px;
|
|
144
|
+
border: none;
|
|
145
|
+
border-radius: 0 0 8px 8px;
|
|
133
146
|
}
|
|
134
147
|
|
|
135
148
|
& > li > * {
|
|
@@ -143,5 +156,9 @@ export const DropdownInputStyled = styled.div `
|
|
|
143
156
|
background: var(--primary-main-light-5);
|
|
144
157
|
}
|
|
145
158
|
}
|
|
159
|
+
|
|
160
|
+
.dropdown_input__link--all {
|
|
161
|
+
font-weight: 700;
|
|
162
|
+
}
|
|
146
163
|
}
|
|
147
164
|
`;
|
|
@@ -1,35 +1,16 @@
|
|
|
1
1
|
import { device } from '../../../globalStyles/breakpoints'
|
|
2
|
-
|
|
3
2
|
import styled from 'styled-components'
|
|
4
3
|
|
|
5
4
|
export const DropdownInputStyled = styled.div`
|
|
6
5
|
position: relative;
|
|
7
|
-
padding
|
|
8
|
-
padding-right: 1.5rem;
|
|
6
|
+
padding: 1.5rem;
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
@media ${device['landscape-tablets']} {
|
|
9
|
+
padding: 16px 24px;
|
|
12
10
|
}
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
}
|
|
12
|
+
a {
|
|
13
|
+
text-decoration: none;
|
|
33
14
|
}
|
|
34
15
|
|
|
35
16
|
.dropdown_input__container {
|
|
@@ -40,7 +21,24 @@ export const DropdownInputStyled = styled.div`
|
|
|
40
21
|
|
|
41
22
|
@media ${device['landscape-tablets']} {
|
|
42
23
|
border-top: 2px solid transparent;
|
|
43
|
-
border-bottom:
|
|
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
|
+
}
|
|
44
42
|
}
|
|
45
43
|
|
|
46
44
|
.dropdown_input__container__text_input {
|
|
@@ -57,7 +55,7 @@ export const DropdownInputStyled = styled.div`
|
|
|
57
55
|
color: var(--neutral-neutral-3);
|
|
58
56
|
}
|
|
59
57
|
|
|
60
|
-
|
|
58
|
+
&.with-icon {
|
|
61
59
|
padding-right: 2rem;
|
|
62
60
|
}
|
|
63
61
|
}
|
|
@@ -70,10 +68,10 @@ export const DropdownInputStyled = styled.div`
|
|
|
70
68
|
top: 0;
|
|
71
69
|
height: 100%;
|
|
72
70
|
color: var(--neutral-neutral-3);
|
|
73
|
-
fill:
|
|
71
|
+
fill: var(--neutral-neutral-3);
|
|
74
72
|
|
|
75
73
|
@media ${device['landscape-tablets']} {
|
|
76
|
-
|
|
74
|
+
cursor: pointer;
|
|
77
75
|
}
|
|
78
76
|
|
|
79
77
|
.dropdown_input__container__icon__main {
|
|
@@ -81,9 +79,11 @@ export const DropdownInputStyled = styled.div`
|
|
|
81
79
|
height: 1.5rem;
|
|
82
80
|
opacity: 1;
|
|
83
81
|
margin-right: 0.25rem;
|
|
82
|
+
cursor: pointer;
|
|
84
83
|
|
|
85
84
|
path {
|
|
86
85
|
transition: all 0.25s;
|
|
86
|
+
fill: var(--neutral-neutral-3);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
|
|
@@ -114,24 +114,36 @@ export const DropdownInputStyled = styled.div`
|
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
.dropdown_input__separator {
|
|
118
|
+
margin-top: 0.6rem;
|
|
119
|
+
border-top: 1.5px solid var(--neutral-neutral-4);
|
|
120
|
+
}
|
|
121
|
+
|
|
117
122
|
.dropdown_input__results {
|
|
118
123
|
transition: all 0.25s;
|
|
119
124
|
display: flex;
|
|
120
|
-
position: relative;
|
|
121
125
|
flex-direction: column;
|
|
122
126
|
width: 100%;
|
|
123
|
-
border-radius:
|
|
124
|
-
margin-top: 1rem;
|
|
127
|
+
border-radius: 8px;
|
|
125
128
|
background: var(--others-white);
|
|
126
|
-
|
|
129
|
+
width: 300px;
|
|
130
|
+
position: absolute;
|
|
131
|
+
top: 100%;
|
|
132
|
+
left: 0;
|
|
133
|
+
z-index: 10;
|
|
134
|
+
background-color: var(--others-white);
|
|
135
|
+
border-top: none;
|
|
136
|
+
padding: 1rem 2rem;
|
|
127
137
|
|
|
128
138
|
@media ${device['landscape-tablets']} {
|
|
129
|
-
|
|
130
|
-
opacity: 0;
|
|
139
|
+
opacity: 1;
|
|
131
140
|
left: 0;
|
|
132
141
|
top: 100%;
|
|
133
|
-
|
|
134
|
-
|
|
142
|
+
width: 100%;
|
|
143
|
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
|
144
|
+
margin-top: -15px;
|
|
145
|
+
border: none;
|
|
146
|
+
border-radius: 0 0 8px 8px;
|
|
135
147
|
}
|
|
136
148
|
|
|
137
149
|
& > li > * {
|
|
@@ -145,5 +157,9 @@ export const DropdownInputStyled = styled.div`
|
|
|
145
157
|
background: var(--primary-main-light-5);
|
|
146
158
|
}
|
|
147
159
|
}
|
|
160
|
+
|
|
161
|
+
.dropdown_input__link--all {
|
|
162
|
+
font-weight: 700;
|
|
163
|
+
}
|
|
148
164
|
}
|
|
149
165
|
`
|
|
@@ -1,60 +1,64 @@
|
|
|
1
|
+
/* eslint-disable jsx-a11y/click-events-have-key-events */
|
|
1
2
|
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
3
|
+
import React, { forwardRef, useState } from 'react'
|
|
2
4
|
|
|
3
|
-
import React, { useState } from 'react'
|
|
4
5
|
import { DropdownInputProps } from './DropdownInputProps.types'
|
|
5
6
|
import { DropdownInputStyled } from './DropdownInput.styled'
|
|
6
7
|
|
|
7
|
-
export const DropdownInput
|
|
8
|
-
onChange,
|
|
9
|
-
|
|
10
|
-
className = '',
|
|
11
|
-
name,
|
|
12
|
-
icon,
|
|
13
|
-
placeholder
|
|
14
|
-
}) => {
|
|
15
|
-
const [searchTerm, setSearchTerm] = useState('')
|
|
8
|
+
export const DropdownInput = forwardRef<HTMLInputElement, DropdownInputProps>(
|
|
9
|
+
({ onChange, results, className = '', name, icon, placeholder, onClose }, ref) => {
|
|
10
|
+
const [searchTerm, setSearchTerm] = useState('')
|
|
16
11
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
const updateInput = (e): void => {
|
|
13
|
+
setSearchTerm(e.target.value)
|
|
14
|
+
onChange(e.target.value)
|
|
15
|
+
}
|
|
21
16
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
const resetInput = (): void => {
|
|
18
|
+
setSearchTerm('')
|
|
19
|
+
}
|
|
25
20
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
{
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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>
|
|
55
52
|
</div>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
{searchTerm && !!results?.length && (
|
|
54
|
+
<>
|
|
55
|
+
<div className='dropdown_input__separator'></div>
|
|
56
|
+
<ul className='dropdown_input__results'>{results}</ul>
|
|
57
|
+
</>
|
|
58
|
+
)}
|
|
59
|
+
</DropdownInputStyled>
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
DropdownInput.displayName = 'DropdownInput'
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type SearchBarProps } from '../SearchBar/SearchBarProps.types';
|
|
3
|
+
interface DesktopSearchBarProps extends SearchBarProps {
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const DesktopSearchBar: React.FC<DesktopSearchBarProps>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
3
|
+
import { CloseIcon } from '../../../../images/componentsSvg/CloseIcon';
|
|
4
|
+
import { DesktopSearchBarStyled } from './DesktopSearchBar.styled';
|
|
5
|
+
import { DropdownInput } from '../../atoms/DropdownInput/DropdownInput';
|
|
6
|
+
import { useSearchFunction } from '../../../hooks/useSearchFunction';
|
|
7
|
+
export const DesktopSearchBar = ({ products, searchBarTexts, routes, handleResultClick, isOpen, onClose }) => {
|
|
8
|
+
const { results, searchFunction } = useSearchFunction({
|
|
9
|
+
products,
|
|
10
|
+
searchBarTexts,
|
|
11
|
+
routes,
|
|
12
|
+
handleResultClick,
|
|
13
|
+
onClose
|
|
14
|
+
});
|
|
15
|
+
const searchInputRef = useRef(null);
|
|
16
|
+
const searchBarContainerRef = useRef(null);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
const handleKeyDown = (event) => {
|
|
19
|
+
if (event.key === 'Escape') {
|
|
20
|
+
onClose();
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const handleClickOutside = (event) => {
|
|
24
|
+
if (searchBarContainerRef.current && !searchBarContainerRef.current.contains(event.target)) {
|
|
25
|
+
onClose();
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
if (isOpen) {
|
|
29
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
30
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
31
|
+
if (searchInputRef.current) {
|
|
32
|
+
searchInputRef.current.focus();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return () => {
|
|
36
|
+
document.removeEventListener('keydown', handleKeyDown);
|
|
37
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
38
|
+
};
|
|
39
|
+
}, [isOpen, onClose]);
|
|
40
|
+
if (!isOpen) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
return (_jsx(DesktopSearchBarStyled, { ref: searchBarContainerRef, className: 'modal_searchbar', children: _jsx("div", { className: 'modal_searchbar__content', children: _jsx(DropdownInput, { ref: searchInputRef, name: 'desktop-search', className: 'search', placeholder: searchBarTexts.placeholder, icon: _jsx(CloseIcon, {}), onChange: searchFunction, results: results, onClose: onClose }) }) }));
|
|
44
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DesktopSearchBarStyled: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { device } from '../../../globalStyles/breakpoints';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
export const DesktopSearchBarStyled = styled.div `
|
|
4
|
+
display: none;
|
|
5
|
+
|
|
6
|
+
@media ${device['landscape-tablets']} {
|
|
7
|
+
display: block;
|
|
8
|
+
position: absolute;
|
|
9
|
+
top: 75px;
|
|
10
|
+
left: 0;
|
|
11
|
+
z-index: 10000;
|
|
12
|
+
width: 400px;
|
|
13
|
+
max-width: 90vw;
|
|
14
|
+
background: transparent;
|
|
15
|
+
|
|
16
|
+
.modal_searchbar__content {
|
|
17
|
+
background-color: var(--others-white);
|
|
18
|
+
border-radius: 8px;
|
|
19
|
+
width: 300px;
|
|
20
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
21
|
+
|
|
22
|
+
@media ${device['laptop']} {
|
|
23
|
+
padding: 0;
|
|
24
|
+
width: 100%;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.modal_searchbar__header {
|
|
29
|
+
display: flex;
|
|
30
|
+
justify-content: space-between;
|
|
31
|
+
align-items: center;
|
|
32
|
+
margin-bottom: 1rem;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.modal_searchbar__title {
|
|
36
|
+
font-size: 1.5rem;
|
|
37
|
+
font-weight: bold;
|
|
38
|
+
color: var(--others-black);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.dropdown_input {
|
|
42
|
+
.search {
|
|
43
|
+
width: 100%;
|
|
44
|
+
margin: 0;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
`;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { device } from '../../../globalStyles/breakpoints'
|
|
2
|
+
import styled from 'styled-components'
|
|
3
|
+
|
|
4
|
+
export const DesktopSearchBarStyled = styled.div`
|
|
5
|
+
display: none;
|
|
6
|
+
|
|
7
|
+
@media ${device['landscape-tablets']} {
|
|
8
|
+
display: block;
|
|
9
|
+
position: absolute;
|
|
10
|
+
top: 75px;
|
|
11
|
+
left: 0;
|
|
12
|
+
z-index: 10000;
|
|
13
|
+
width: 400px;
|
|
14
|
+
max-width: 90vw;
|
|
15
|
+
background: transparent;
|
|
16
|
+
|
|
17
|
+
.modal_searchbar__content {
|
|
18
|
+
background-color: var(--others-white);
|
|
19
|
+
border-radius: 8px;
|
|
20
|
+
width: 300px;
|
|
21
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
22
|
+
|
|
23
|
+
@media ${device['laptop']} {
|
|
24
|
+
padding: 0;
|
|
25
|
+
width: 100%;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.modal_searchbar__header {
|
|
30
|
+
display: flex;
|
|
31
|
+
justify-content: space-between;
|
|
32
|
+
align-items: center;
|
|
33
|
+
margin-bottom: 1rem;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.modal_searchbar__title {
|
|
37
|
+
font-size: 1.5rem;
|
|
38
|
+
font-weight: bold;
|
|
39
|
+
color: var(--others-black);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.dropdown_input {
|
|
43
|
+
.search {
|
|
44
|
+
width: 100%;
|
|
45
|
+
margin: 0;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
`
|