hds-web 1.25.4 → 1.25.6
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/index.css +1 -1
- package/dist/index.es.css +1 -1
- package/dist/index.es.js +3 -3
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/src/HDS/components/BadgesCaption/badges.js +1 -1
- package/src/HDS/helpers/Algorithms/hdssearch.js +36 -0
- package/src/HDS/helpers/Algorithms/index.js +2 -0
- package/src/HDS/helpers/Algorithms/invertedIndex.js +47 -0
- package/src/HDS/helpers/index.js +2 -1
- package/src/HDS/modules/TextCard/textCard.js +2 -2
- package/src/styles/tailwind.css +5 -0
package/package.json
CHANGED
@@ -5,7 +5,7 @@ import { Icon } from '../common-components/Icon';
|
|
5
5
|
import {Typography} from '../../foundation/Typography'
|
6
6
|
import { HDSColor } from '../../foundation/ColorPalette';
|
7
7
|
const sizeClasses = {
|
8
|
-
sm: 'py-0.5 px-
|
8
|
+
sm: 'py-0.5 px-3 hds-d-body3c',
|
9
9
|
default: 'py-1 px-3',
|
10
10
|
};
|
11
11
|
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import React, { useState } from "react";
|
2
|
+
|
3
|
+
function LiveSearch({ wordArray }) {
|
4
|
+
const [input, setInput] = useState("");
|
5
|
+
const [filteredWords, setFilteredWords] = useState([]);
|
6
|
+
|
7
|
+
const handleInputChange = (event) => {
|
8
|
+
const inputValue = event.target.value.toLowerCase();
|
9
|
+
setInput(inputValue);
|
10
|
+
|
11
|
+
const newFilteredWords = searchWords(wordArray, inputValue);
|
12
|
+
setFilteredWords(newFilteredWords);
|
13
|
+
};
|
14
|
+
|
15
|
+
return (
|
16
|
+
<div>
|
17
|
+
<input
|
18
|
+
type="text"
|
19
|
+
placeholder="Search..."
|
20
|
+
value={input}
|
21
|
+
onChange={handleInputChange}
|
22
|
+
/>
|
23
|
+
<div id="results">
|
24
|
+
{filteredWords.map((word, index) => (
|
25
|
+
<div key={index}>{word}</div>
|
26
|
+
))}
|
27
|
+
</div>
|
28
|
+
</div>
|
29
|
+
);
|
30
|
+
}
|
31
|
+
|
32
|
+
function searchWords(words, inputLetter) {
|
33
|
+
return words.filter((word) => word.toLowerCase().includes(inputLetter));
|
34
|
+
}
|
35
|
+
|
36
|
+
export default LiveSearch;
|
@@ -0,0 +1,47 @@
|
|
1
|
+
function buildInvertedIndex(data) {
|
2
|
+
const invertedIndex = {};
|
3
|
+
|
4
|
+
for (const item of data) {
|
5
|
+
const key = Object.keys(item)[0];
|
6
|
+
const tags = item[key];
|
7
|
+
|
8
|
+
for (const tag of tags) {
|
9
|
+
if (!invertedIndex[tag]) {
|
10
|
+
invertedIndex[tag] = new Set();
|
11
|
+
}
|
12
|
+
invertedIndex[tag].add(key);
|
13
|
+
}
|
14
|
+
}
|
15
|
+
|
16
|
+
return invertedIndex;
|
17
|
+
}
|
18
|
+
|
19
|
+
export default function getSimilarAndRemainingKeys(data, inputKey) {
|
20
|
+
const invertedIndex = buildInvertedIndex(data);
|
21
|
+
const inputTags = data.find(item => item[inputKey]);
|
22
|
+
const similarKeys = new Set();
|
23
|
+
const allKeys = new Set();
|
24
|
+
|
25
|
+
if (inputTags) {
|
26
|
+
for (const tag of inputTags[inputKey]) {
|
27
|
+
const keysWithSimilarTag = invertedIndex[tag];
|
28
|
+
if (keysWithSimilarTag) {
|
29
|
+
keysWithSimilarTag.forEach(key => {
|
30
|
+
if (key !== inputKey) {
|
31
|
+
similarKeys.add(key);
|
32
|
+
}
|
33
|
+
});
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
for (const item of data) {
|
39
|
+
const key = Object.keys(item)[0];
|
40
|
+
allKeys.add(key);
|
41
|
+
}
|
42
|
+
|
43
|
+
const remainingKeys = [...allKeys].filter(key => !similarKeys.has(key));
|
44
|
+
|
45
|
+
return [...similarKeys, ...remainingKeys];
|
46
|
+
}
|
47
|
+
|
package/src/HDS/helpers/index.js
CHANGED
@@ -58,7 +58,7 @@ export default function TextCard(props) {
|
|
58
58
|
<Typography
|
59
59
|
key={i}
|
60
60
|
textStyle="body1"
|
61
|
-
className="pb-6 pr-8 max-w-[412px] [&>p]:pb-2 [&>p]:text-neutral-600 last:[&>p]:pb-0 [&>ul]:ps-4 [&>ul>li]:list-disc [&>ul>li]:pb-2 last:[&>ul>li]:pb-0 [&>p>a]:text-blue-600">
|
61
|
+
className="pb-6 pr-8 max-w-[412px] [&>p]:pb-2 [&>p]:text-neutral-600 last:[&>p]:pb-0 [&>ul]:ps-4 [&>ul>li]:list-disc [&>ul>li]:pb-2 last:[&>ul>li]:pb-0 [&>p>a]:text-blue-600 [&>ul>li]:text-neutral-600">
|
62
62
|
<ReactMarkdown>
|
63
63
|
{desc.description}
|
64
64
|
</ReactMarkdown>
|
@@ -206,7 +206,7 @@ export default function TextCard(props) {
|
|
206
206
|
<Typography
|
207
207
|
key={i}
|
208
208
|
textStyle="body1"
|
209
|
-
className="pb-6 pr-8 max-w-[412px] [&>p]:pb-2 last:[&>p]:pb-0 [&>p]:text-neutral-600 [&>ul]:ps-4 [&>ul>li]:list-disc [&>ul>li]:pb-2 last:[&>ul>li]:pb-0 [&>p>a]:text-blue-600">
|
209
|
+
className="pb-6 pr-8 max-w-[412px] [&>p]:pb-2 last:[&>p]:pb-0 [&>p]:text-neutral-600 [&>ul]:ps-4 [&>ul>li]:list-disc [&>ul>li]:pb-2 last:[&>ul>li]:pb-0 [&>p>a]:text-blue-600 [&>ul>li]:text-neutral-600">
|
210
210
|
<ReactMarkdown>
|
211
211
|
{desc.description}
|
212
212
|
</ReactMarkdown>
|
package/src/styles/tailwind.css
CHANGED
@@ -12775,6 +12775,11 @@ select{
|
|
12775
12775
|
padding-bottom: 0.5rem;
|
12776
12776
|
}
|
12777
12777
|
|
12778
|
+
.\[\&\>ul\>li\]\:text-neutral-600>ul>li{
|
12779
|
+
--tw-text-opacity: 1;
|
12780
|
+
color: rgb(77 87 97 / var(--tw-text-opacity));
|
12781
|
+
}
|
12782
|
+
|
12778
12783
|
.\[\&\>ul\>li\]\:last\:pb-0:last-child>ul>li{
|
12779
12784
|
padding-bottom: 0px;
|
12780
12785
|
}
|