@npm_leadtech/legal-lib-components 7.22.11 → 7.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/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,42 +1,72 @@
|
|
|
1
|
-
/* eslint-disable jsx-a11y/click-events-have-key-events */
|
|
2
|
-
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
3
|
-
/* eslint-disable jsx-a11y/anchor-is-valid */
|
|
4
1
|
import React, { useState } from 'react'
|
|
5
|
-
|
|
6
|
-
import {
|
|
2
|
+
|
|
3
|
+
import { DropdownInput } from '../../atoms/DropdownInput/DropdownInput'
|
|
4
|
+
import { SearchIcon } from '../../../../images/componentsSvg/SearchIcon'
|
|
5
|
+
import { useWindowSize } from '../../../hooks/useWindowSize'
|
|
6
|
+
|
|
7
7
|
import { type SearchBarProps } from './SearchBarProps.types'
|
|
8
8
|
import { SearchBarStyled } from './SearchBar.styled'
|
|
9
|
-
import search from '../../../../images/svg/search_24px.svg'
|
|
10
9
|
|
|
11
|
-
export const SearchBar: React.FC<SearchBarProps> = (
|
|
12
|
-
const [
|
|
10
|
+
export const SearchBar: React.FC<SearchBarProps> = ({ products, searchBarTexts, routes, handleResultClick }) => {
|
|
11
|
+
const [results, setResults] = useState<React.JSX.Element[]>([])
|
|
13
12
|
|
|
14
|
-
const
|
|
13
|
+
const windowSize = useWindowSize()
|
|
14
|
+
const _placeholder = windowSize.width === null || windowSize.width >= 720 ? '' : searchBarTexts.placeholder
|
|
15
|
+
const searchFunction = (text: string): void => {
|
|
16
|
+
const searchTerm = text.toLowerCase()
|
|
17
|
+
|
|
18
|
+
const productsFiltered = products.filter((item) => item.linkText.toLowerCase().includes(searchTerm))
|
|
19
|
+
const results = productsFiltered
|
|
20
|
+
.map((item) => {
|
|
21
|
+
const product = item.linkText
|
|
22
|
+
const preMatch = product.slice(0, product.toLowerCase().indexOf(searchTerm))
|
|
23
|
+
const match = product.slice(product.toLowerCase().indexOf(searchTerm), preMatch.length + searchTerm.length)
|
|
24
|
+
const postMatch = product.slice(product.toLowerCase().indexOf(searchTerm) + searchTerm.length, product.length)
|
|
25
|
+
const link = item.categoryUrl ? `${item.categoryUrl}/${item.slug}` : item.slug
|
|
26
|
+
return (
|
|
27
|
+
<li key={searchBarTexts.title} className='dropdown_input__item'>
|
|
28
|
+
<a
|
|
29
|
+
href={routes.CUSTOM_URL_FROM_TARGET_ADDRESS(link)}
|
|
30
|
+
className='dropdown_input__link'
|
|
31
|
+
key={item.linkText}
|
|
32
|
+
onClick={(e) => {
|
|
33
|
+
e.preventDefault()
|
|
34
|
+
handleResultClick(product, routes.CUSTOM_URL_FROM_TARGET_ADDRESS(link))
|
|
35
|
+
}}
|
|
36
|
+
title={product}
|
|
37
|
+
>
|
|
38
|
+
{preMatch}
|
|
39
|
+
<strong className='dropdown_input__link__emphasis'>{match}</strong>
|
|
40
|
+
{postMatch}
|
|
41
|
+
</a>
|
|
42
|
+
</li>
|
|
43
|
+
)
|
|
44
|
+
})
|
|
45
|
+
.slice(0, 9)
|
|
46
|
+
|
|
47
|
+
results.push(
|
|
48
|
+
<li key={searchBarTexts.title} className='dropdown_input__item'>
|
|
49
|
+
<a className='dropdown_input__link--all' title={searchBarTexts.title} href={routes.LEGAL_DOCUMENTS}>
|
|
50
|
+
{searchBarTexts.title}
|
|
51
|
+
</a>
|
|
52
|
+
</li>
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
setResults(results)
|
|
56
|
+
}
|
|
15
57
|
|
|
16
58
|
return (
|
|
17
59
|
<SearchBarStyled>
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
<img
|
|
29
|
-
src={search}
|
|
30
|
-
alt='search-icon-primary'
|
|
31
|
-
style={{
|
|
32
|
-
width: '100%',
|
|
33
|
-
height: '100%'
|
|
34
|
-
}}
|
|
35
|
-
/>
|
|
36
|
-
</a>
|
|
37
|
-
<DesktopSearchBar {...props} isOpen={isModalOpen} onClose={closeModal} />
|
|
38
|
-
<MobileSearchBar {...props} />
|
|
39
|
-
</div>
|
|
60
|
+
<DropdownInput
|
|
61
|
+
name='search'
|
|
62
|
+
className='search'
|
|
63
|
+
placeholder={_placeholder}
|
|
64
|
+
icon={<SearchIcon />}
|
|
65
|
+
onChange={(text: string) => {
|
|
66
|
+
searchFunction(text)
|
|
67
|
+
}}
|
|
68
|
+
results={results}
|
|
69
|
+
/>
|
|
40
70
|
</SearchBarStyled>
|
|
41
71
|
)
|
|
42
72
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { VariablesList } from './VisibleEnvVariables.styled';
|
|
3
|
+
const VisibleEnvVariables = ({ variables }) => {
|
|
4
|
+
return (_jsx(VariablesList, { className: 'stage-variables', children: Object.entries(variables).map(([key, value]) => (_jsxs("li", { children: [_jsxs("strong", { className: 'stage-variable-name', children: [key, ": "] }), _jsx("span", { className: 'stage-variable-value', children: value })] }, key))) }));
|
|
5
|
+
};
|
|
6
|
+
export default VisibleEnvVariables;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const VariablesList: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, never>> & string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { device } from '../../../globalStyles/breakpoints';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
export const VariablesList = styled.ul `
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: row;
|
|
6
|
+
justify-content: space-around;
|
|
7
|
+
align-items: center;
|
|
8
|
+
flex-wrap: wrap;
|
|
9
|
+
@media ${device['mobile']} {
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
align-items: flex-start;
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { device } from '../../../globalStyles/breakpoints'
|
|
2
|
+
import styled from 'styled-components'
|
|
3
|
+
|
|
4
|
+
export const VariablesList = styled.ul`
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: row;
|
|
7
|
+
justify-content: space-around;
|
|
8
|
+
align-items: center;
|
|
9
|
+
flex-wrap: wrap;
|
|
10
|
+
@media ${device['mobile']} {
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
align-items: flex-start;
|
|
13
|
+
}
|
|
14
|
+
`
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { VariablesList } from './VisibleEnvVariables.styled'
|
|
3
|
+
import { VisibleVariablesProps } from './VisibleEnvVariablesProps.types'
|
|
4
|
+
|
|
5
|
+
const VisibleEnvVariables: React.FC<VisibleVariablesProps> = ({ variables }) => {
|
|
6
|
+
return (
|
|
7
|
+
<VariablesList className='stage-variables'>
|
|
8
|
+
{Object.entries(variables).map(([key, value]) => (
|
|
9
|
+
<li key={key}>
|
|
10
|
+
<strong className='stage-variable-name'>{key}: </strong>
|
|
11
|
+
<span className='stage-variable-value'>{value}</span>
|
|
12
|
+
</li>
|
|
13
|
+
))}
|
|
14
|
+
</VariablesList>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default VisibleEnvVariables
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as VisibleEnvVariables } from './VisibleEnvVariables';
|