@npm_leadtech/legal-lib-components 7.22.4 → 7.22.5

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.
@@ -0,0 +1,6 @@
1
+ import { FC } from 'react';
2
+ interface Close24Props {
3
+ className?: string;
4
+ }
5
+ export declare const CloseIcon: FC<Close24Props>;
6
+ export {};
@@ -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="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>
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  /* eslint-disable jsx-a11y/no-static-element-interactions */
3
3
  import React, { forwardRef, useState } from 'react';
4
4
  import { DropdownInputStyled } from './DropdownInput.styled';
5
- export const DropdownInput = forwardRef(({ onChange, results, className = '', name, icon, placeholder }, ref) => {
5
+ export const DropdownInput = forwardRef(({ onChange, results, className = '', name, icon, placeholder, onClose }, ref) => {
6
6
  const [searchTerm, setSearchTerm] = useState('');
7
7
  const updateInput = (e) => {
8
8
  setSearchTerm(e.target.value);
@@ -15,7 +15,8 @@ export const DropdownInput = forwardRef(({ onChange, results, className = '', na
15
15
  updateInput(e);
16
16
  } }), _jsxs("div", { className: `dropdown_input__container__icon ${searchTerm ? 'active' : ''}`, children: [icon &&
17
17
  React.cloneElement(icon, {
18
- className: 'dropdown_input__container__icon__main'
18
+ className: 'dropdown_input__container__icon__main',
19
+ onClick: onClose
19
20
  }), searchTerm && (_jsx("div", { className: 'icon-cross main-color dropdown_input__container__icon__clear', onClick: () => {
20
21
  resetInput();
21
22
  }, onKeyDown: () => {
@@ -2,6 +2,7 @@ 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;
5
6
 
6
7
  @media ${device['landscape-tablets']} {
7
8
  padding: 1rem 2rem;
@@ -132,7 +133,7 @@ export const DropdownInputStyled = styled.div `
132
133
  left: 0;
133
134
  top: 100%;
134
135
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
135
- margin-top: 0;
136
+ margin-top: -5px;
136
137
  border: none;
137
138
  border-radius: 0 0 8px 8px;
138
139
  }
@@ -3,6 +3,7 @@ import styled from 'styled-components'
3
3
 
4
4
  export const DropdownInputStyled = styled.div`
5
5
  position: relative;
6
+ padding: 1.5rem;
6
7
 
7
8
  @media ${device['landscape-tablets']} {
8
9
  padding: 1rem 2rem;
@@ -133,7 +134,7 @@ export const DropdownInputStyled = styled.div`
133
134
  left: 0;
134
135
  top: 100%;
135
136
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
136
- margin-top: 0;
137
+ margin-top: -5px;
137
138
  border: none;
138
139
  border-radius: 0 0 8px 8px;
139
140
  }
@@ -1,10 +1,11 @@
1
1
  /* eslint-disable jsx-a11y/no-static-element-interactions */
2
2
  import React, { forwardRef, useState } from 'react'
3
+
3
4
  import { DropdownInputProps } from './DropdownInputProps.types'
4
5
  import { DropdownInputStyled } from './DropdownInput.styled'
5
6
 
6
7
  export const DropdownInput = forwardRef<HTMLInputElement, DropdownInputProps>(
7
- ({ onChange, results, className = '', name, icon, placeholder }, ref) => {
8
+ ({ onChange, results, className = '', name, icon, placeholder, onClose }, ref) => {
8
9
  const [searchTerm, setSearchTerm] = useState('')
9
10
 
10
11
  const updateInput = (e): void => {
@@ -33,7 +34,8 @@ export const DropdownInput = forwardRef<HTMLInputElement, DropdownInputProps>(
33
34
  <div className={`dropdown_input__container__icon ${searchTerm ? 'active' : ''}`}>
34
35
  {icon &&
35
36
  React.cloneElement(icon, {
36
- className: 'dropdown_input__container__icon__main'
37
+ className: 'dropdown_input__container__icon__main',
38
+ onClick: onClose
37
39
  })}
38
40
  {searchTerm && (
39
41
  <div
@@ -5,4 +5,5 @@ export interface DropdownInputProps {
5
5
  icon: any;
6
6
  onChange: (arg: string) => void;
7
7
  results: React.JSX.Element[];
8
+ onClose?: () => void;
8
9
  }
@@ -7,4 +7,5 @@ export interface DropdownInputProps {
7
7
  icon: any
8
8
  onChange: (arg: string) => void
9
9
  results: React.JSX.Element[]
10
+ onClose?: () => void
10
11
  }
@@ -3,8 +3,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  /* eslint-disable jsx-a11y/anchor-is-valid */
4
4
  /* eslint-disable jsx-a11y/no-static-element-interactions */
5
5
  import { useEffect, useRef, useState } from 'react';
6
+ import { CloseIcon } from '../../../../images/componentsSvg/CloseIcon';
6
7
  import { DropdownInput } from '../../atoms/DropdownInput/DropdownInput';
7
8
  import { SearchIcon } from '../../../../images/componentsSvg/SearchIcon';
9
+ import search from '../../../../images/svg/search_24px.svg';
8
10
  import { useWindowSize } from '../../../hooks/useWindowSize';
9
11
  import { SearchBarStyled } from './SearchBar.styled';
10
12
  import { useSearchFunction } from '../../../hooks/useSearchFunction';
@@ -44,7 +46,7 @@ const DesktopSearchBar = ({ products, searchBarTexts, routes, handleResultClick,
44
46
  if (!isOpen) {
45
47
  return null;
46
48
  }
47
- return (_jsx(SearchBarStyled, { ref: searchBarContainerRef, className: 'modal_searchbar', children: _jsx("div", { className: 'modal_searchbar__content', children: _jsx(DropdownInput, { ref: searchInputRef, name: 'search', className: 'search', placeholder: searchBarTexts.placeholder, icon: _jsx(SearchIcon, {}), onChange: searchFunction, results: results }) }) }));
49
+ return (_jsx(SearchBarStyled, { 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 }) }) }));
48
50
  };
49
51
  const MobileSearchBar = ({ products, searchBarTexts, routes, handleResultClick }) => {
50
52
  const { results, searchFunction } = useSearchFunction({
@@ -76,7 +78,7 @@ const MobileSearchBar = ({ products, searchBarTexts, routes, handleResultClick }
76
78
  document.removeEventListener('mousedown', handleClickOutside);
77
79
  };
78
80
  }, [isResultsVisible, searchFunction]);
79
- return (_jsx(SearchBarStyled, { ref: searchBarContainerRef, children: _jsx(DropdownInput, { ref: searchInputRef, name: 'search', className: 'search', placeholder: searchBarTexts.placeholder, icon: _jsx(SearchIcon, {}), onChange: searchFunction, results: results }) }));
81
+ return (_jsx(SearchBarStyled, { ref: searchBarContainerRef, children: _jsx(DropdownInput, { ref: searchInputRef, name: 'mobile-and-tablet-search', className: 'search', placeholder: searchBarTexts.placeholder, icon: _jsx(SearchIcon, {}), onChange: searchFunction, results: results }) }));
80
82
  };
81
83
  export const SearchBar = (props) => {
82
84
  const windowSize = useWindowSize();
@@ -84,7 +86,15 @@ export const SearchBar = (props) => {
84
86
  const [isModalOpen, setIsModalOpen] = useState(false);
85
87
  const closeModal = () => setIsModalOpen(false);
86
88
  if (isDesktop) {
87
- return (_jsxs("div", { style: { position: 'relative' }, children: [_jsx("a", { onClick: () => setIsModalOpen(true), className: 'search-toggle-link', children: _jsx(SearchIcon, {}) }), _jsx(DesktopSearchBar, { ...props, isOpen: isModalOpen, onClose: closeModal })] }));
89
+ return (_jsxs("div", { style: { position: 'relative', display: 'flex' }, children: [_jsx("a", { onClick: () => setIsModalOpen(true), style: {
90
+ cursor: 'pointer',
91
+ display: 'inline-block',
92
+ width: '20px',
93
+ height: '20px'
94
+ }, children: _jsx("img", { src: search, alt: 'search-icon-primary', style: {
95
+ width: '100%',
96
+ height: '100%'
97
+ } }) }), _jsx(DesktopSearchBar, { ...props, isOpen: isModalOpen, onClose: closeModal })] }));
88
98
  }
89
99
  return _jsx(MobileSearchBar, { ...props });
90
100
  };
@@ -9,31 +9,10 @@ export const SearchBarStyled = styled.div `
9
9
  }
10
10
 
11
11
  @media ${device['landscape-tablets']} {
12
- .search-toggle-link {
13
- display: inline-block;
14
- width: 20px;
15
- height: 20px;
16
- cursor: pointer;
17
- line-height: 20px;
18
-
19
- & > svg {
20
- transition: fill 0.25s;
21
- fill: currentColor;
22
- }
23
-
24
- &:hover > svg {
25
- fill: var(--primary-main);
26
- }
27
-
28
- .modal_searchbar + .search-toggle-link > svg {
29
- fill: #078080;
30
- }
31
- }
32
-
33
12
  &.modal_searchbar {
34
13
  position: absolute;
35
- top: 8px;
36
- left: 32px;
14
+ top: 45px;
15
+ left: 0;
37
16
  z-index: 10000;
38
17
  width: 400px;
39
18
  max-width: 90vw;
@@ -48,7 +27,6 @@ export const SearchBarStyled = styled.div `
48
27
 
49
28
  @media ${device['laptop']} {
50
29
  padding: 0;
51
- border-radius: 8px 8px 0 0;
52
30
  }
53
31
  }
54
32
 
@@ -10,31 +10,10 @@ export const SearchBarStyled = styled.div`
10
10
  }
11
11
 
12
12
  @media ${device['landscape-tablets']} {
13
- .search-toggle-link {
14
- display: inline-block;
15
- width: 20px;
16
- height: 20px;
17
- cursor: pointer;
18
- line-height: 20px;
19
-
20
- & > svg {
21
- transition: fill 0.25s;
22
- fill: currentColor;
23
- }
24
-
25
- &:hover > svg {
26
- fill: var(--primary-main);
27
- }
28
-
29
- .modal_searchbar + .search-toggle-link > svg {
30
- fill: #078080;
31
- }
32
- }
33
-
34
13
  &.modal_searchbar {
35
14
  position: absolute;
36
- top: 8px;
37
- left: 32px;
15
+ top: 45px;
16
+ left: 0;
38
17
  z-index: 10000;
39
18
  width: 400px;
40
19
  max-width: 90vw;
@@ -49,7 +28,6 @@ export const SearchBarStyled = styled.div`
49
28
 
50
29
  @media ${device['laptop']} {
51
30
  padding: 0;
52
- border-radius: 8px 8px 0 0;
53
31
  }
54
32
  }
55
33
 
@@ -2,8 +2,10 @@
2
2
  /* eslint-disable jsx-a11y/anchor-is-valid */
3
3
  /* eslint-disable jsx-a11y/no-static-element-interactions */
4
4
  import React, { useEffect, useRef, useState } from 'react'
5
+ import { CloseIcon } from '../../../../images/componentsSvg/CloseIcon'
5
6
  import { DropdownInput } from '../../atoms/DropdownInput/DropdownInput'
6
7
  import { SearchIcon } from '../../../../images/componentsSvg/SearchIcon'
8
+ import search from '../../../../images/svg/search_24px.svg'
7
9
  import { useWindowSize } from '../../../hooks/useWindowSize'
8
10
 
9
11
  import { type SearchBarProps } from './SearchBarProps.types'
@@ -68,12 +70,13 @@ const DesktopSearchBar: React.FC<DesktopSearchBarProps> = ({
68
70
  <div className='modal_searchbar__content'>
69
71
  <DropdownInput
70
72
  ref={searchInputRef}
71
- name='search'
73
+ name='desktop-search'
72
74
  className='search'
73
75
  placeholder={searchBarTexts.placeholder}
74
- icon={<SearchIcon />}
76
+ icon={<CloseIcon />}
75
77
  onChange={searchFunction}
76
78
  results={results}
79
+ onClose={onClose}
77
80
  />
78
81
  </div>
79
82
  </SearchBarStyled>
@@ -118,7 +121,7 @@ const MobileSearchBar: React.FC<SearchBarProps> = ({ products, searchBarTexts, r
118
121
  <SearchBarStyled ref={searchBarContainerRef}>
119
122
  <DropdownInput
120
123
  ref={searchInputRef}
121
- name='search'
124
+ name='mobile-and-tablet-search'
122
125
  className='search'
123
126
  placeholder={searchBarTexts.placeholder}
124
127
  icon={<SearchIcon />}
@@ -138,9 +141,24 @@ export const SearchBar: React.FC<SearchBarProps> = (props) => {
138
141
 
139
142
  if (isDesktop) {
140
143
  return (
141
- <div style={{ position: 'relative' }}>
142
- <a onClick={() => setIsModalOpen(true)} className='search-toggle-link'>
143
- <SearchIcon />
144
+ <div style={{ position: 'relative', display: 'flex' }}>
145
+ <a
146
+ onClick={() => setIsModalOpen(true)}
147
+ style={{
148
+ cursor: 'pointer',
149
+ display: 'inline-block',
150
+ width: '20px',
151
+ height: '20px'
152
+ }}
153
+ >
154
+ <img
155
+ src={search}
156
+ alt='search-icon-primary'
157
+ style={{
158
+ width: '100%',
159
+ height: '100%'
160
+ }}
161
+ />
144
162
  </a>
145
163
  <DesktopSearchBar {...props} isOpen={isModalOpen} onClose={closeModal} />
146
164
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npm_leadtech/legal-lib-components",
3
- "version": "7.22.4",
3
+ "version": "7.22.5",
4
4
  "license": "ISC",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",