@npm_leadtech/legal-lib-components 7.23.6 → 7.23.51

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.
Files changed (47) hide show
  1. package/dist/src/components/atoms/DropdownInput/DropdownInput.d.ts +1 -1
  2. package/dist/src/components/atoms/DropdownInput/DropdownInput.js +7 -9
  3. package/dist/src/components/atoms/DropdownInput/DropdownInput.styled.js +35 -52
  4. package/dist/src/components/atoms/DropdownInput/DropdownInput.styled.ts +36 -52
  5. package/dist/src/components/atoms/DropdownInput/DropdownInput.tsx +51 -55
  6. package/dist/src/components/atoms/DropdownInput/DropdownInputProps.types.d.ts +0 -1
  7. package/dist/src/components/atoms/DropdownInput/DropdownInputProps.types.ts +0 -1
  8. package/dist/src/components/atoms/SearchSelect/SearchSelect.js +3 -2
  9. package/dist/src/components/atoms/SearchSelect/SearchSelect.tsx +3 -1
  10. package/dist/src/components/molecules/SearchBar/SearchBar.js +29 -17
  11. package/dist/src/components/molecules/SearchBar/SearchBar.styled.js +55 -4
  12. package/dist/src/components/molecules/SearchBar/SearchBar.styled.ts +55 -4
  13. package/dist/src/components/molecules/SearchBar/SearchBar.tsx +61 -31
  14. package/dist/tsconfig.build.tsbuildinfo +1 -1
  15. package/package.json +1 -1
  16. package/dist/images/componentsSvg/CloseIcon.d.ts +0 -6
  17. package/dist/images/componentsSvg/CloseIcon.js +0 -2
  18. package/dist/images/componentsSvg/CloseIcon.tsx +0 -14
  19. package/dist/images/svg/close-grey-24px.svg +0 -3
  20. package/dist/images/svg/search_24px.svg +0 -3
  21. package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBar.d.ts +0 -8
  22. package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBar.js +0 -44
  23. package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBar.styled.d.ts +0 -1
  24. package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBar.styled.js +0 -48
  25. package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBar.styled.ts +0 -49
  26. package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBar.tsx +0 -77
  27. package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBarProps.types.d.ts +0 -37
  28. package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBarProps.types.js +0 -1
  29. package/dist/src/components/molecules/DesktopSearchBar/DesktopSearchBarProps.types.ts +0 -40
  30. package/dist/src/components/molecules/DesktopSearchBar/index.d.ts +0 -2
  31. package/dist/src/components/molecules/DesktopSearchBar/index.js +0 -1
  32. package/dist/src/components/molecules/DesktopSearchBar/index.ts +0 -2
  33. package/dist/src/components/molecules/MobileSearchBar/MobileSearchBar.d.ts +0 -3
  34. package/dist/src/components/molecules/MobileSearchBar/MobileSearchBar.js +0 -38
  35. package/dist/src/components/molecules/MobileSearchBar/MobileSearchBar.styled.d.ts +0 -1
  36. package/dist/src/components/molecules/MobileSearchBar/MobileSearchBar.styled.js +0 -17
  37. package/dist/src/components/molecules/MobileSearchBar/MobileSearchBar.styled.ts +0 -18
  38. package/dist/src/components/molecules/MobileSearchBar/MobileSearchBar.tsx +0 -55
  39. package/dist/src/components/molecules/MobileSearchBar/MobileSearchBarProps.types.d.ts +0 -37
  40. package/dist/src/components/molecules/MobileSearchBar/MobileSearchBarProps.types.js +0 -1
  41. package/dist/src/components/molecules/MobileSearchBar/MobileSearchBarProps.types.ts +0 -40
  42. package/dist/src/components/molecules/MobileSearchBar/index.d.ts +0 -2
  43. package/dist/src/components/molecules/MobileSearchBar/index.js +0 -1
  44. package/dist/src/components/molecules/MobileSearchBar/index.ts +0 -2
  45. package/dist/src/hooks/useSearchFunction.d.ts +0 -10
  46. package/dist/src/hooks/useSearchFunction.js +0 -28
  47. package/dist/src/hooks/useSearchFunction.tsx +0 -63
@@ -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
- }