@npm_leadtech/legal-lib-components 7.22.11 → 7.22.12
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/css/styles.css +3 -0
- package/dist/src/components/atoms/DialogMenuIcon/DialogMenuIcon.styled.js +1 -1
- package/dist/src/components/atoms/DialogMenuIcon/DialogMenuIcon.styled.ts +1 -1
- package/dist/src/components/atoms/DropdownInput/DropdownInput.d.ts +1 -1
- package/dist/src/components/atoms/DropdownInput/DropdownInput.js +5 -7
- package/dist/src/components/atoms/DropdownInput/DropdownInput.styled.js +36 -43
- package/dist/src/components/atoms/DropdownInput/DropdownInput.styled.ts +37 -43
- package/dist/src/components/atoms/DropdownInput/DropdownInput.tsx +51 -50
- package/dist/src/components/atoms/DropdownInput/DropdownInputProps.types.d.ts +0 -1
- package/dist/src/components/atoms/DropdownInput/DropdownInputProps.types.ts +0 -1
- package/dist/src/components/molecules/SearchBar/SearchBar.js +29 -17
- package/dist/src/components/molecules/SearchBar/SearchBar.styled.js +55 -4
- package/dist/src/components/molecules/SearchBar/SearchBar.styled.ts +55 -4
- package/dist/src/components/molecules/SearchBar/SearchBar.tsx +61 -31
- package/dist/src/components/molecules/TextInput/Input.d.ts +1 -0
- package/dist/src/components/molecules/TextInput/Input.js +4 -5
- package/dist/src/components/molecules/TextInput/Input.tsx +8 -7
- package/dist/src/components/molecules/TextInput/TextInput.js +2 -2
- package/dist/src/components/molecules/TextInput/TextInput.scss +4 -0
- package/dist/src/components/molecules/TextInput/TextInput.tsx +3 -1
- package/dist/src/components/molecules/TextInput/TextInputProps.types.d.ts +1 -0
- package/dist/src/components/molecules/TextInput/TextInputProps.types.ts +1 -0
- package/dist/src/components/organisms/VisibleEnvVariables/VisibleEnvVariables.d.ts +4 -0
- package/dist/src/components/organisms/VisibleEnvVariables/VisibleEnvVariables.js +6 -0
- package/dist/src/components/organisms/VisibleEnvVariables/VisibleEnvVariables.styled.d.ts +1 -0
- package/dist/src/components/organisms/VisibleEnvVariables/VisibleEnvVariables.styled.js +13 -0
- package/dist/src/components/organisms/VisibleEnvVariables/VisibleEnvVariables.styled.ts +14 -0
- package/dist/src/components/organisms/VisibleEnvVariables/VisibleEnvVariables.tsx +18 -0
- package/dist/src/components/organisms/VisibleEnvVariables/VisibleEnvVariablesProps.types.d.ts +3 -0
- package/dist/src/components/organisms/VisibleEnvVariables/VisibleEnvVariablesProps.types.ts +3 -0
- package/dist/src/components/organisms/VisibleEnvVariables/index.d.ts +2 -0
- package/dist/src/components/organisms/VisibleEnvVariables/index.js +1 -0
- package/dist/src/components/organisms/VisibleEnvVariables/index.ts +2 -0
- package/dist/src/components/organisms/index.d.ts +1 -0
- package/dist/src/components/organisms/index.js +1 -0
- package/dist/src/components/organisms/index.ts +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/dist/images/componentsSvg/CloseIcon.d.ts +0 -6
- package/dist/images/componentsSvg/CloseIcon.js +0 -2
- package/dist/images/componentsSvg/CloseIcon.tsx +0 -14
- package/dist/images/svg/close-grey-24px.svg +0 -3
- package/dist/images/svg/search_24px.svg +0 -3
- package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBar.d.ts +0 -8
- package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBar.js +0 -44
- package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBar.styled.d.ts +0 -1
- package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBar.styled.js +0 -48
- package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBar.styled.ts +0 -49
- package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBar.tsx +0 -77
- package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBarProps.types.d.ts +0 -37
- package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBarProps.types.ts +0 -40
- package/dist/src/components/molecules/DesktopSearchBar/index.d.ts +0 -2
- package/dist/src/components/molecules/DesktopSearchBar/index.js +0 -1
- package/dist/src/components/molecules/DesktopSearchBar/index.ts +0 -2
- package/dist/src/components/molecules/MobileSearchBar/MobileSearchBar.d.ts +0 -3
- package/dist/src/components/molecules/MobileSearchBar/MobileSearchBar.js +0 -38
- package/dist/src/components/molecules/MobileSearchBar/MobileSearchBar.styled.d.ts +0 -1
- package/dist/src/components/molecules/MobileSearchBar/MobileSearchBar.styled.js +0 -17
- package/dist/src/components/molecules/MobileSearchBar/MobileSearchBar.styled.ts +0 -18
- package/dist/src/components/molecules/MobileSearchBar/MobileSearchBar.tsx +0 -55
- package/dist/src/components/molecules/MobileSearchBar/MobileSearchBarProps.types.d.ts +0 -37
- package/dist/src/components/molecules/MobileSearchBar/MobileSearchBarProps.types.js +0 -1
- package/dist/src/components/molecules/MobileSearchBar/MobileSearchBarProps.types.ts +0 -40
- package/dist/src/components/molecules/MobileSearchBar/index.d.ts +0 -2
- package/dist/src/components/molecules/MobileSearchBar/index.js +0 -1
- package/dist/src/components/molecules/MobileSearchBar/index.ts +0 -2
- package/dist/src/hooks/useSearchFunction.d.ts +0 -10
- package/dist/src/hooks/useSearchFunction.js +0 -28
- package/dist/src/hooks/useSearchFunction.tsx +0 -63
- /package/dist/src/components/{molecules/DesktopSearchBar/DesktopSearchBarProps.types.js → organisms/VisibleEnvVariables/VisibleEnvVariablesProps.types.js} +0 -0
package/dist/css/styles.css
CHANGED
|
@@ -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.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, {
|
|
3
|
+
import React, { useState } from 'react';
|
|
5
4
|
import { DropdownInputStyled } from './DropdownInput.styled';
|
|
6
|
-
export const DropdownInput =
|
|
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", {
|
|
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' : ''}`,
|
|
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:
|
|
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
|
-
|
|
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:
|
|
71
|
+
fill: currentColor;
|
|
71
72
|
|
|
72
73
|
@media ${device['landscape-tablets']} {
|
|
73
|
-
|
|
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:
|
|
121
|
+
border-radius: $s-border-radius;
|
|
122
|
+
margin-top: 1rem;
|
|
122
123
|
background: var(--others-white);
|
|
123
124
|
min-width: 20rem;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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:
|
|
137
|
-
|
|
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:
|
|
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
|
-
|
|
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:
|
|
73
|
+
fill: currentColor;
|
|
72
74
|
|
|
73
75
|
@media ${device['landscape-tablets']} {
|
|
74
|
-
|
|
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:
|
|
123
|
+
border-radius: $s-border-radius;
|
|
124
|
+
margin-top: 1rem;
|
|
123
125
|
background: var(--others-white);
|
|
124
126
|
min-width: 20rem;
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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:
|
|
138
|
-
|
|
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
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
22
|
-
|
|
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
|
-
|
|
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
|
+
}
|
|
@@ -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 {
|
|
7
|
-
import {
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
.
|
|
5
|
-
|
|
4
|
+
.dropdown_input {
|
|
5
|
+
.search {
|
|
6
|
+
width: calc(100% - 3rem);
|
|
7
|
+
margin: 0 1.5rem;
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
.
|
|
6
|
-
|
|
5
|
+
.dropdown_input {
|
|
6
|
+
.search {
|
|
7
|
+
width: calc(100% - 3rem);
|
|
8
|
+
margin: 0 1.5rem;
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
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
|
`
|