@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
|
@@ -1,49 +0,0 @@
|
|
|
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: 45px;
|
|
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
|
-
padding: 1.5rem;
|
|
20
|
-
border-radius: 8px;
|
|
21
|
-
width: 100%;
|
|
22
|
-
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
23
|
-
|
|
24
|
-
@media ${device['laptop']} {
|
|
25
|
-
padding: 0;
|
|
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
|
-
`
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useRef } from 'react'
|
|
2
|
-
import { CloseIcon } from '../../../../images/componentsSvg/CloseIcon'
|
|
3
|
-
import { DesktopSearchBarStyled } from './DesktopSearchBar.styled'
|
|
4
|
-
import { DropdownInput } from '../../atoms/DropdownInput/DropdownInput'
|
|
5
|
-
import { type SearchBarProps } from '../SearchBar/SearchBarProps.types'
|
|
6
|
-
import { useSearchFunction } from '../../../hooks/useSearchFunction'
|
|
7
|
-
|
|
8
|
-
interface DesktopSearchBarProps extends SearchBarProps {
|
|
9
|
-
isOpen: boolean
|
|
10
|
-
onClose: () => void
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const DesktopSearchBar: React.FC<DesktopSearchBarProps> = ({
|
|
14
|
-
products,
|
|
15
|
-
searchBarTexts,
|
|
16
|
-
routes,
|
|
17
|
-
handleResultClick,
|
|
18
|
-
isOpen,
|
|
19
|
-
onClose
|
|
20
|
-
}) => {
|
|
21
|
-
const { results, searchFunction } = useSearchFunction({
|
|
22
|
-
products,
|
|
23
|
-
searchBarTexts,
|
|
24
|
-
routes,
|
|
25
|
-
handleResultClick,
|
|
26
|
-
onClose
|
|
27
|
-
})
|
|
28
|
-
const searchInputRef = useRef<HTMLInputElement>(null)
|
|
29
|
-
const searchBarContainerRef = useRef<HTMLDivElement>(null)
|
|
30
|
-
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
const handleKeyDown = (event: KeyboardEvent) => {
|
|
33
|
-
if (event.key === 'Escape') {
|
|
34
|
-
onClose()
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
const handleClickOutside = (event: MouseEvent) => {
|
|
38
|
-
if (searchBarContainerRef.current && !searchBarContainerRef.current.contains(event.target as Node)) {
|
|
39
|
-
onClose()
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (isOpen) {
|
|
44
|
-
document.addEventListener('keydown', handleKeyDown)
|
|
45
|
-
document.addEventListener('mousedown', handleClickOutside)
|
|
46
|
-
if (searchInputRef.current) {
|
|
47
|
-
searchInputRef.current.focus()
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return () => {
|
|
52
|
-
document.removeEventListener('keydown', handleKeyDown)
|
|
53
|
-
document.removeEventListener('mousedown', handleClickOutside)
|
|
54
|
-
}
|
|
55
|
-
}, [isOpen, onClose])
|
|
56
|
-
|
|
57
|
-
if (!isOpen) {
|
|
58
|
-
return null
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<DesktopSearchBarStyled ref={searchBarContainerRef} className='modal_searchbar'>
|
|
63
|
-
<div className='modal_searchbar__content'>
|
|
64
|
-
<DropdownInput
|
|
65
|
-
ref={searchInputRef}
|
|
66
|
-
name='desktop-search'
|
|
67
|
-
className='search'
|
|
68
|
-
placeholder={searchBarTexts.placeholder}
|
|
69
|
-
icon={<CloseIcon />}
|
|
70
|
-
onChange={searchFunction}
|
|
71
|
-
results={results}
|
|
72
|
-
onClose={onClose}
|
|
73
|
-
/>
|
|
74
|
-
</div>
|
|
75
|
-
</DesktopSearchBarStyled>
|
|
76
|
-
)
|
|
77
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export interface Products {
|
|
2
|
-
categoryUrl?: string;
|
|
3
|
-
isFeatured?: boolean;
|
|
4
|
-
popularOrder: number;
|
|
5
|
-
jumboTitle: string;
|
|
6
|
-
linkText: string;
|
|
7
|
-
slug: string;
|
|
8
|
-
footerPopularDocument?: boolean;
|
|
9
|
-
logoImgBig?: string;
|
|
10
|
-
logoImgSmall?: string;
|
|
11
|
-
categoryProduct?: {
|
|
12
|
-
name: string;
|
|
13
|
-
icon: string;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
export interface StrapiSearchBar {
|
|
17
|
-
title: string;
|
|
18
|
-
placeholder: string;
|
|
19
|
-
}
|
|
20
|
-
export interface Routes {
|
|
21
|
-
CUSTOM_URL_FROM_APP_SUBDOMAIN: (url: string) => string;
|
|
22
|
-
CUSTOM_URL_FROM_TARGET_ADDRESS: (url: string) => string;
|
|
23
|
-
LEGAL_DOCUMENTS: string;
|
|
24
|
-
LEGAL_DOCUMENTS_WITH_HASH: (category: string) => string;
|
|
25
|
-
LEGAL_DOCUMENTS_WITH_CATEGORY: (category: string) => string;
|
|
26
|
-
LOGIN: string;
|
|
27
|
-
MY_DOCUMENTS: string;
|
|
28
|
-
REGISTER: string;
|
|
29
|
-
RATAFIA_LOGIN: string;
|
|
30
|
-
SIGN_EDITOR: string;
|
|
31
|
-
}
|
|
32
|
-
export interface DesktopSearchBarProps {
|
|
33
|
-
products: Products[];
|
|
34
|
-
searchBarTexts: StrapiSearchBar;
|
|
35
|
-
routes: Routes;
|
|
36
|
-
handleResultClick: (product: string, link: string) => void;
|
|
37
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export interface Products {
|
|
2
|
-
categoryUrl?: string
|
|
3
|
-
isFeatured?: boolean
|
|
4
|
-
popularOrder: number
|
|
5
|
-
jumboTitle: string
|
|
6
|
-
linkText: string
|
|
7
|
-
slug: string
|
|
8
|
-
footerPopularDocument?: boolean
|
|
9
|
-
logoImgBig?: string
|
|
10
|
-
logoImgSmall?: string
|
|
11
|
-
categoryProduct?: {
|
|
12
|
-
name: string
|
|
13
|
-
icon: string
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface StrapiSearchBar {
|
|
18
|
-
title: string
|
|
19
|
-
placeholder: string
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface Routes {
|
|
23
|
-
CUSTOM_URL_FROM_APP_SUBDOMAIN: (url: string) => string
|
|
24
|
-
CUSTOM_URL_FROM_TARGET_ADDRESS: (url: string) => string
|
|
25
|
-
LEGAL_DOCUMENTS: string
|
|
26
|
-
LEGAL_DOCUMENTS_WITH_HASH: (category: string) => string
|
|
27
|
-
LEGAL_DOCUMENTS_WITH_CATEGORY: (category: string) => string
|
|
28
|
-
LOGIN: string
|
|
29
|
-
MY_DOCUMENTS: string
|
|
30
|
-
REGISTER: string
|
|
31
|
-
RATAFIA_LOGIN: string
|
|
32
|
-
SIGN_EDITOR: string
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface DesktopSearchBarProps {
|
|
36
|
-
products: Products[]
|
|
37
|
-
searchBarTexts: StrapiSearchBar
|
|
38
|
-
routes: Routes
|
|
39
|
-
handleResultClick: (product: string, link: string) => void
|
|
40
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { DesktopSearchBar } from './DesktopSearchBar';
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useRef } from 'react';
|
|
3
|
-
import { DropdownInput } from '../../atoms/DropdownInput/DropdownInput';
|
|
4
|
-
import { MobileSearchBarStyled } from './MobileSearchBar.styled';
|
|
5
|
-
import { SearchIcon } from '../../../../images/componentsSvg/SearchIcon';
|
|
6
|
-
import { useSearchFunction } from '../../../hooks/useSearchFunction';
|
|
7
|
-
export const MobileSearchBar = ({ products, searchBarTexts, routes, handleResultClick }) => {
|
|
8
|
-
const { results, searchFunction } = useSearchFunction({
|
|
9
|
-
products,
|
|
10
|
-
searchBarTexts,
|
|
11
|
-
routes,
|
|
12
|
-
handleResultClick
|
|
13
|
-
});
|
|
14
|
-
const searchInputRef = useRef(null);
|
|
15
|
-
const searchBarContainerRef = useRef(null);
|
|
16
|
-
const isResultsVisible = Array.isArray(results) && results.length > 0;
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
const handleKeyDown = (event) => {
|
|
19
|
-
if (event.key === 'Escape') {
|
|
20
|
-
searchFunction('');
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
const handleClickOutside = (event) => {
|
|
24
|
-
if (searchBarContainerRef.current && !searchBarContainerRef.current.contains(event.target)) {
|
|
25
|
-
searchFunction('');
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
if (isResultsVisible) {
|
|
29
|
-
document.addEventListener('keydown', handleKeyDown);
|
|
30
|
-
document.addEventListener('mousedown', handleClickOutside);
|
|
31
|
-
}
|
|
32
|
-
return () => {
|
|
33
|
-
document.removeEventListener('keydown', handleKeyDown);
|
|
34
|
-
document.removeEventListener('mousedown', handleClickOutside);
|
|
35
|
-
};
|
|
36
|
-
}, [isResultsVisible, searchFunction]);
|
|
37
|
-
return (_jsx(MobileSearchBarStyled, { ref: searchBarContainerRef, children: _jsx(DropdownInput, { ref: searchInputRef, name: 'mobile-and-tablet-search', className: 'search', placeholder: searchBarTexts.placeholder, icon: _jsx(SearchIcon, {}), onChange: searchFunction, results: results }) }));
|
|
38
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const MobileSearchBarStyled: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { device } from '../../../globalStyles/breakpoints';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
export const MobileSearchBarStyled = styled.div `
|
|
4
|
-
display: block;
|
|
5
|
-
width: 100%;
|
|
6
|
-
|
|
7
|
-
@media ${device['landscape-tablets']} {
|
|
8
|
-
display: none;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.dropdown_input {
|
|
12
|
-
.search {
|
|
13
|
-
width: calc(100% - 3rem);
|
|
14
|
-
margin: 0 1.5rem;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
`;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { device } from '../../../globalStyles/breakpoints'
|
|
2
|
-
import styled from 'styled-components'
|
|
3
|
-
|
|
4
|
-
export const MobileSearchBarStyled = styled.div`
|
|
5
|
-
display: block;
|
|
6
|
-
width: 100%;
|
|
7
|
-
|
|
8
|
-
@media ${device['landscape-tablets']} {
|
|
9
|
-
display: none;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.dropdown_input {
|
|
13
|
-
.search {
|
|
14
|
-
width: calc(100% - 3rem);
|
|
15
|
-
margin: 0 1.5rem;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
`
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useRef } from 'react'
|
|
2
|
-
import { DropdownInput } from '../../atoms/DropdownInput/DropdownInput'
|
|
3
|
-
import { MobileSearchBarStyled } from './MobileSearchBar.styled'
|
|
4
|
-
import { type SearchBarProps } from '../SearchBar/SearchBarProps.types'
|
|
5
|
-
import { SearchIcon } from '../../../../images/componentsSvg/SearchIcon'
|
|
6
|
-
import { useSearchFunction } from '../../../hooks/useSearchFunction'
|
|
7
|
-
|
|
8
|
-
export const MobileSearchBar: React.FC<SearchBarProps> = ({ products, searchBarTexts, routes, handleResultClick }) => {
|
|
9
|
-
const { results, searchFunction } = useSearchFunction({
|
|
10
|
-
products,
|
|
11
|
-
searchBarTexts,
|
|
12
|
-
routes,
|
|
13
|
-
handleResultClick
|
|
14
|
-
})
|
|
15
|
-
const searchInputRef = useRef<HTMLInputElement>(null)
|
|
16
|
-
const searchBarContainerRef = useRef<HTMLDivElement>(null)
|
|
17
|
-
const isResultsVisible = Array.isArray(results) && results.length > 0
|
|
18
|
-
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
const handleKeyDown = (event: KeyboardEvent) => {
|
|
21
|
-
if (event.key === 'Escape') {
|
|
22
|
-
searchFunction('')
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
const handleClickOutside = (event: MouseEvent) => {
|
|
26
|
-
if (searchBarContainerRef.current && !searchBarContainerRef.current.contains(event.target as Node)) {
|
|
27
|
-
searchFunction('')
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (isResultsVisible) {
|
|
32
|
-
document.addEventListener('keydown', handleKeyDown)
|
|
33
|
-
document.addEventListener('mousedown', handleClickOutside)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return () => {
|
|
37
|
-
document.removeEventListener('keydown', handleKeyDown)
|
|
38
|
-
document.removeEventListener('mousedown', handleClickOutside)
|
|
39
|
-
}
|
|
40
|
-
}, [isResultsVisible, searchFunction])
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<MobileSearchBarStyled ref={searchBarContainerRef}>
|
|
44
|
-
<DropdownInput
|
|
45
|
-
ref={searchInputRef}
|
|
46
|
-
name='mobile-and-tablet-search'
|
|
47
|
-
className='search'
|
|
48
|
-
placeholder={searchBarTexts.placeholder}
|
|
49
|
-
icon={<SearchIcon />}
|
|
50
|
-
onChange={searchFunction}
|
|
51
|
-
results={results}
|
|
52
|
-
/>
|
|
53
|
-
</MobileSearchBarStyled>
|
|
54
|
-
)
|
|
55
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export interface Products {
|
|
2
|
-
categoryUrl?: string;
|
|
3
|
-
isFeatured?: boolean;
|
|
4
|
-
popularOrder: number;
|
|
5
|
-
jumboTitle: string;
|
|
6
|
-
linkText: string;
|
|
7
|
-
slug: string;
|
|
8
|
-
footerPopularDocument?: boolean;
|
|
9
|
-
logoImgBig?: string;
|
|
10
|
-
logoImgSmall?: string;
|
|
11
|
-
categoryProduct?: {
|
|
12
|
-
name: string;
|
|
13
|
-
icon: string;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
export interface StrapiSearchBar {
|
|
17
|
-
title: string;
|
|
18
|
-
placeholder: string;
|
|
19
|
-
}
|
|
20
|
-
export interface Routes {
|
|
21
|
-
CUSTOM_URL_FROM_APP_SUBDOMAIN: (url: string) => string;
|
|
22
|
-
CUSTOM_URL_FROM_TARGET_ADDRESS: (url: string) => string;
|
|
23
|
-
LEGAL_DOCUMENTS: string;
|
|
24
|
-
LEGAL_DOCUMENTS_WITH_HASH: (category: string) => string;
|
|
25
|
-
LEGAL_DOCUMENTS_WITH_CATEGORY: (category: string) => string;
|
|
26
|
-
LOGIN: string;
|
|
27
|
-
MY_DOCUMENTS: string;
|
|
28
|
-
REGISTER: string;
|
|
29
|
-
RATAFIA_LOGIN: string;
|
|
30
|
-
SIGN_EDITOR: string;
|
|
31
|
-
}
|
|
32
|
-
export interface SearchBarProps {
|
|
33
|
-
products: Products[];
|
|
34
|
-
searchBarTexts: StrapiSearchBar;
|
|
35
|
-
routes: Routes;
|
|
36
|
-
handleResultClick: (product: string, link: string) => void;
|
|
37
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export interface Products {
|
|
2
|
-
categoryUrl?: string
|
|
3
|
-
isFeatured?: boolean
|
|
4
|
-
popularOrder: number
|
|
5
|
-
jumboTitle: string
|
|
6
|
-
linkText: string
|
|
7
|
-
slug: string
|
|
8
|
-
footerPopularDocument?: boolean
|
|
9
|
-
logoImgBig?: string
|
|
10
|
-
logoImgSmall?: string
|
|
11
|
-
categoryProduct?: {
|
|
12
|
-
name: string
|
|
13
|
-
icon: string
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface StrapiSearchBar {
|
|
18
|
-
title: string
|
|
19
|
-
placeholder: string
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface Routes {
|
|
23
|
-
CUSTOM_URL_FROM_APP_SUBDOMAIN: (url: string) => string
|
|
24
|
-
CUSTOM_URL_FROM_TARGET_ADDRESS: (url: string) => string
|
|
25
|
-
LEGAL_DOCUMENTS: string
|
|
26
|
-
LEGAL_DOCUMENTS_WITH_HASH: (category: string) => string
|
|
27
|
-
LEGAL_DOCUMENTS_WITH_CATEGORY: (category: string) => string
|
|
28
|
-
LOGIN: string
|
|
29
|
-
MY_DOCUMENTS: string
|
|
30
|
-
REGISTER: string
|
|
31
|
-
RATAFIA_LOGIN: string
|
|
32
|
-
SIGN_EDITOR: string
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface SearchBarProps {
|
|
36
|
-
products: Products[]
|
|
37
|
-
searchBarTexts: StrapiSearchBar
|
|
38
|
-
routes: Routes
|
|
39
|
-
handleResultClick: (product: string, link: string) => void
|
|
40
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { MobileSearchBar } from './MobileSearchBar';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type SearchBarProps } from '../components/molecules/SearchBar/SearchBarProps.types';
|
|
3
|
-
interface SearchFunctionProps extends SearchBarProps {
|
|
4
|
-
onClose?: () => void;
|
|
5
|
-
}
|
|
6
|
-
export declare const useSearchFunction: (props: SearchFunctionProps) => {
|
|
7
|
-
results: React.JSX.Element[];
|
|
8
|
-
searchFunction: (text: string) => void;
|
|
9
|
-
};
|
|
10
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
export const useSearchFunction = (props) => {
|
|
4
|
-
const [results, setResults] = useState([]);
|
|
5
|
-
const searchFunction = (text) => {
|
|
6
|
-
const { products, searchBarTexts, routes, handleResultClick, onClose } = props;
|
|
7
|
-
const searchTerm = text.toLowerCase();
|
|
8
|
-
const productsFiltered = products.filter((item) => item.linkText.toLowerCase().includes(searchTerm));
|
|
9
|
-
const newResults = productsFiltered
|
|
10
|
-
.map((item) => {
|
|
11
|
-
const product = item.linkText;
|
|
12
|
-
const preMatch = product.slice(0, product.toLowerCase().indexOf(searchTerm));
|
|
13
|
-
const match = product.slice(product.toLowerCase().indexOf(searchTerm), preMatch.length + searchTerm.length);
|
|
14
|
-
const postMatch = product.slice(product.toLowerCase().indexOf(searchTerm) + searchTerm.length, product.length);
|
|
15
|
-
const link = item.categoryUrl ? `${item.categoryUrl}/${item.slug}` : item.slug;
|
|
16
|
-
return (_jsx("li", { className: 'dropdown_input__item', children: _jsxs("a", { href: routes.CUSTOM_URL_FROM_TARGET_ADDRESS(link), className: 'dropdown_input__link', onClick: (e) => {
|
|
17
|
-
e.preventDefault();
|
|
18
|
-
handleResultClick(product, routes.CUSTOM_URL_FROM_TARGET_ADDRESS(link));
|
|
19
|
-
if (onClose)
|
|
20
|
-
onClose();
|
|
21
|
-
}, title: product, children: [preMatch, _jsx("strong", { className: 'dropdown_input__link__emphasis', children: match }), postMatch] }) }, item.linkText));
|
|
22
|
-
})
|
|
23
|
-
.slice(0, 9);
|
|
24
|
-
newResults.push(_jsx("li", { className: 'dropdown_input__item', children: _jsx("a", { className: 'dropdown_input__link--all', title: searchBarTexts.title, href: routes.LEGAL_DOCUMENTS, onClick: onClose, children: searchBarTexts.title }) }, searchBarTexts.title));
|
|
25
|
-
setResults(newResults);
|
|
26
|
-
};
|
|
27
|
-
return { results, searchFunction };
|
|
28
|
-
};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
2
|
-
import { type SearchBarProps } from '../components/molecules/SearchBar/SearchBarProps.types'
|
|
3
|
-
|
|
4
|
-
interface SearchFunctionProps extends SearchBarProps {
|
|
5
|
-
onClose?: () => void
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export const useSearchFunction = (props: SearchFunctionProps) => {
|
|
9
|
-
const [results, setResults] = useState<React.JSX.Element[]>([])
|
|
10
|
-
|
|
11
|
-
const searchFunction = (text: string): void => {
|
|
12
|
-
const { products, searchBarTexts, routes, handleResultClick, onClose } = props
|
|
13
|
-
const searchTerm = text.toLowerCase()
|
|
14
|
-
|
|
15
|
-
const productsFiltered = products.filter((item) => item.linkText.toLowerCase().includes(searchTerm))
|
|
16
|
-
|
|
17
|
-
const newResults = productsFiltered
|
|
18
|
-
.map((item) => {
|
|
19
|
-
const product = item.linkText
|
|
20
|
-
const preMatch = product.slice(0, product.toLowerCase().indexOf(searchTerm))
|
|
21
|
-
const match = product.slice(product.toLowerCase().indexOf(searchTerm), preMatch.length + searchTerm.length)
|
|
22
|
-
const postMatch = product.slice(product.toLowerCase().indexOf(searchTerm) + searchTerm.length, product.length)
|
|
23
|
-
const link = item.categoryUrl ? `${item.categoryUrl}/${item.slug}` : item.slug
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<li key={item.linkText} className='dropdown_input__item'>
|
|
27
|
-
<a
|
|
28
|
-
href={routes.CUSTOM_URL_FROM_TARGET_ADDRESS(link)}
|
|
29
|
-
className='dropdown_input__link'
|
|
30
|
-
onClick={(e) => {
|
|
31
|
-
e.preventDefault()
|
|
32
|
-
handleResultClick(product, routes.CUSTOM_URL_FROM_TARGET_ADDRESS(link))
|
|
33
|
-
if (onClose) onClose()
|
|
34
|
-
}}
|
|
35
|
-
title={product}
|
|
36
|
-
>
|
|
37
|
-
{preMatch}
|
|
38
|
-
<strong className='dropdown_input__link__emphasis'>{match}</strong>
|
|
39
|
-
{postMatch}
|
|
40
|
-
</a>
|
|
41
|
-
</li>
|
|
42
|
-
)
|
|
43
|
-
})
|
|
44
|
-
.slice(0, 9)
|
|
45
|
-
|
|
46
|
-
newResults.push(
|
|
47
|
-
<li key={searchBarTexts.title} className='dropdown_input__item'>
|
|
48
|
-
<a
|
|
49
|
-
className='dropdown_input__link--all'
|
|
50
|
-
title={searchBarTexts.title}
|
|
51
|
-
href={routes.LEGAL_DOCUMENTS}
|
|
52
|
-
onClick={onClose}
|
|
53
|
-
>
|
|
54
|
-
{searchBarTexts.title}
|
|
55
|
-
</a>
|
|
56
|
-
</li>
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
setResults(newResults)
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return { results, searchFunction }
|
|
63
|
-
}
|