hds-web 1.25.3 → 1.25.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.
- package/dist/index.css +2 -2
- package/dist/index.es.css +2 -2
- package/dist/index.es.js +5 -5
- package/dist/index.js +5 -5
- package/package.json +1 -1
- package/src/HDS/components/BadgesCaption/badges.js +1 -1
- package/src/HDS/components/Buttons/index.js +2 -1
- package/src/HDS/components/Buttons/specialBtn.js +38 -0
- package/src/HDS/components/Cards/InviteCard/index.js +1 -0
- package/src/HDS/components/Cards/InviteCard/invitecard.js +157 -0
- package/src/HDS/components/Cards/index.js +2 -1
- package/src/HDS/components/InputFields/index.js +2 -1
- package/src/HDS/components/InputFields/inviteIF.js +43 -0
- 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/styles/tailwind.css +190 -134
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
|
|
@@ -1 +1,2 @@
|
|
1
|
-
export {default as HDSButton} from './button';
|
1
|
+
export {default as HDSButton} from './button';
|
2
|
+
export { default as HDSButtonVariants } from './specialBtn';
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { HDSColor } from "../../foundation/ColorPalette";
|
3
|
+
import { Typography } from "../../foundation/Typography";
|
4
|
+
import { Icon } from "../common-components";
|
5
|
+
|
6
|
+
export default function ButtonVariants(props) {
|
7
|
+
const {
|
8
|
+
variant,
|
9
|
+
label,
|
10
|
+
labelColor,
|
11
|
+
iconVariant,
|
12
|
+
iconStrokeClass,
|
13
|
+
onClick
|
14
|
+
} = props;
|
15
|
+
const addToCalendar = () => (
|
16
|
+
<div>
|
17
|
+
<button
|
18
|
+
onClick={onClick}
|
19
|
+
className=" border-2 border-blue-500 rounded-full hover:bg-blue-500 group">
|
20
|
+
<div className="flex py-2 pl-[18px] pr-3 items-center">
|
21
|
+
<Typography textStyle='body3-medium' className={HDSColor(labelColor) + ' group-hover:text-neutral-0'}>
|
22
|
+
{label}
|
23
|
+
</Typography>
|
24
|
+
<Icon variant={iconVariant} strokeClass={HDSColor(iconStrokeClass)} className='h-5 w-5 stroke-2 group-hover:stroke-neutral-0' />
|
25
|
+
</div>
|
26
|
+
</button>
|
27
|
+
</div>
|
28
|
+
)
|
29
|
+
return (
|
30
|
+
<>
|
31
|
+
{variant && variant === 'calendarButton' &&
|
32
|
+
<>
|
33
|
+
{addToCalendar()}
|
34
|
+
</>
|
35
|
+
}
|
36
|
+
</>
|
37
|
+
)
|
38
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as InviteCard } from './invitecard';
|
@@ -0,0 +1,157 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { Typography } from "../../../foundation/Typography";
|
3
|
+
import { InviteIF } from "../../InputFields";
|
4
|
+
import { Icon } from "../../common-components";
|
5
|
+
import { HDSButtonVariants } from "../../Buttons";
|
6
|
+
export default function InviteCard(props) {
|
7
|
+
|
8
|
+
const inviteFunction = () => {
|
9
|
+
const numberOfInvites = props.invites || 0;
|
10
|
+
const inviteComponents = Array.from({ length: numberOfInvites }, (_, index) => (
|
11
|
+
<div className="" key={index} >
|
12
|
+
<InviteIF
|
13
|
+
label={props.IFbuttonLabel}
|
14
|
+
placeholder={props.IFbuttonPlaceholder}
|
15
|
+
/>
|
16
|
+
</div>
|
17
|
+
));
|
18
|
+
return <div className="flex flex-col gap-4">{inviteComponents}</div>;
|
19
|
+
};
|
20
|
+
|
21
|
+
return (
|
22
|
+
<div className="">
|
23
|
+
<div className={" flex " + ((props.cardType === 'primary') ? ' flex flex-col-reverse ' : 'pb-6 flex flex-col' )}>
|
24
|
+
{props.imgURL &&
|
25
|
+
<div className={(props.cardType === 'primary') ? 'py-11' : 'pb-4'}>
|
26
|
+
<img src={props.imgURL}
|
27
|
+
loading="lazy"
|
28
|
+
alt={props.title}
|
29
|
+
className={" object-contain " + (props.cardType === 'primary') ? 'max-h-[200px]' : 'max-h-[144px]' }
|
30
|
+
/>
|
31
|
+
</div>}
|
32
|
+
<div>
|
33
|
+
{props.titleTag &&
|
34
|
+
<div
|
35
|
+
className=' text-hds-m-h6 text-neutral-500 uppercase'>
|
36
|
+
{props.titleTag}
|
37
|
+
</div>
|
38
|
+
}
|
39
|
+
{props.title &&
|
40
|
+
<Typography
|
41
|
+
textStyle='h4'
|
42
|
+
className='text-neutral-1000'>
|
43
|
+
{props.title}
|
44
|
+
</Typography>
|
45
|
+
}
|
46
|
+
{props.schedule &&
|
47
|
+
<div className="flex gap-4 pt-4 flex-wrap">
|
48
|
+
{props.schedule.date &&
|
49
|
+
<div
|
50
|
+
className="border border-neutral-200 rounded-2xl p-4 min-w-[152px] "
|
51
|
+
>
|
52
|
+
{props.schedule.day &&
|
53
|
+
<Typography
|
54
|
+
textStyle='h6'
|
55
|
+
className='text-neutral-600'>
|
56
|
+
{props.schedule.day}
|
57
|
+
</Typography>}
|
58
|
+
{props.schedule.date
|
59
|
+
&& <Typography
|
60
|
+
textStyle='h4'
|
61
|
+
className='text-neutral-1000'>
|
62
|
+
{props.schedule.date}
|
63
|
+
</Typography>}
|
64
|
+
</div>}
|
65
|
+
{props.schedule.time &&
|
66
|
+
<div
|
67
|
+
className="border border-neutral-200 rounded-2xl p-4 min-w-[152px]"
|
68
|
+
>
|
69
|
+
{props.schedule.timezone &&
|
70
|
+
<Typography
|
71
|
+
textStyle='h6'
|
72
|
+
className='text-neutral-600'>
|
73
|
+
{props.schedule.timezone}
|
74
|
+
</Typography>}
|
75
|
+
{props.schedule.time &&
|
76
|
+
<Typography
|
77
|
+
textStyle='h4'
|
78
|
+
className='text-neutral-1000'>
|
79
|
+
{props.schedule.time}
|
80
|
+
</Typography>}
|
81
|
+
</div>}
|
82
|
+
</div>
|
83
|
+
}
|
84
|
+
</div>
|
85
|
+
</div>
|
86
|
+
<div className="pb-6 border-neutral-200">
|
87
|
+
{props.inviteTitle &&
|
88
|
+
<Typography
|
89
|
+
textStyle='h5'
|
90
|
+
className='text-neutral-800 border-t border-neutral-200 pt-6'>
|
91
|
+
{props.inviteTitle}
|
92
|
+
</Typography>
|
93
|
+
}
|
94
|
+
{props.inviteTitle2 &&
|
95
|
+
<Typography
|
96
|
+
textStyle='h4'
|
97
|
+
className='text-neutral-1000'>
|
98
|
+
{props.inviteTitle2}
|
99
|
+
</Typography>
|
100
|
+
}
|
101
|
+
{props.inviteSubtitle &&
|
102
|
+
<Typography
|
103
|
+
textStyle='body1'
|
104
|
+
className='text-neutral-800'>
|
105
|
+
{props.inviteSubtitle}
|
106
|
+
</Typography>}
|
107
|
+
|
108
|
+
</div>
|
109
|
+
<div className="pb-6">
|
110
|
+
{inviteFunction()}
|
111
|
+
</div>
|
112
|
+
{(props.social || props.calendarLink) &&
|
113
|
+
<div className="border-t border-neutral-200 pt-6 flex gap-6 flex-wrap justify-center">
|
114
|
+
{props.social &&
|
115
|
+
<div className="flex flex-wrap items-center">
|
116
|
+
{props.social &&
|
117
|
+
props.social.twitter &&
|
118
|
+
<a href={props.social.twitter}
|
119
|
+
className='w-[45px] flex justify-center'>
|
120
|
+
<Icon
|
121
|
+
variant='twitter'
|
122
|
+
className='brightness-0 hover:brightness-100 cursor-pointer transition-all duration-300'
|
123
|
+
/>
|
124
|
+
</a>
|
125
|
+
}
|
126
|
+
{props.social &&
|
127
|
+
props.social.linkedin &&
|
128
|
+
<a href={props.social.linkedin}
|
129
|
+
className='w-[45px] flex justify-center'>
|
130
|
+
<Icon
|
131
|
+
variant='linkedin'
|
132
|
+
className='brightness-0 hover:brightness-100 cursor-pointer transition-all duration-300'
|
133
|
+
/>
|
134
|
+
</a>
|
135
|
+
}
|
136
|
+
{props.social &&
|
137
|
+
props.social.facebook &&
|
138
|
+
<a href={props.social.facebook}
|
139
|
+
className='w-[45px] flex justify-center'>
|
140
|
+
<Icon
|
141
|
+
variant='facebookBlue'
|
142
|
+
className='brightness-0 hover:brightness-100 cursor-pointer transition-all duration-300' />
|
143
|
+
</a>
|
144
|
+
}
|
145
|
+
</div>}
|
146
|
+
<div>
|
147
|
+
<HDSButtonVariants
|
148
|
+
variant='calendarButton'
|
149
|
+
label='Add to Calendar'
|
150
|
+
labelColor='text-blue-500'
|
151
|
+
iconStrokeClass='stroke-blue-500'
|
152
|
+
iconVariant='calendarplus02'></HDSButtonVariants>
|
153
|
+
</div>
|
154
|
+
</div>}
|
155
|
+
</div>
|
156
|
+
)
|
157
|
+
}
|
@@ -6,4 +6,5 @@ export {default as LeadingDropIF} from './leadingDrop';
|
|
6
6
|
export {default as LeadingTextIF} from './leadingText';
|
7
7
|
export {default as TextAreaIF} from './textArea';
|
8
8
|
export {default as TrailingButtonIF} from './trailingButton';
|
9
|
-
export {default as TrailingDropdownIF} from './trailingDropdown';
|
9
|
+
export {default as TrailingDropdownIF} from './trailingDropdown';
|
10
|
+
export {default as InviteIF} from './inviteIF';
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { useState } from 'react';
|
3
|
+
import { HDSButton } from '../Buttons';
|
4
|
+
export default function InviteIF({ disabled, label, helper, size, placeholder, onChange }) {
|
5
|
+
const [value, setValue] = useState('');
|
6
|
+
|
7
|
+
const handleChange = (event) => {
|
8
|
+
const newValue = event.target.value;
|
9
|
+
setValue(newValue);
|
10
|
+
if (onChange) {
|
11
|
+
onChange(newValue);
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
return (
|
16
|
+
<div>
|
17
|
+
<div className="flex bg-neutral-0 border border-neutral-300 rounded-full shadow-sm">
|
18
|
+
<div className="relative flex flex-grow items-stretch ">
|
19
|
+
<input
|
20
|
+
type="email"
|
21
|
+
name="email"
|
22
|
+
id="email"
|
23
|
+
disabled={disabled}
|
24
|
+
className="block w-full rounded-l-full border-0 text-hds-m-body3c tb:text-hds-t-body3c db:text-hds-d-body3c py-3 pl-5 placeholder:text-hds-m-body3c placeholder:tb:text-hds-t-body3c placeholder:db:text-hds-d-body3c placeholder:text-neutral-500 placeholder:bg-neutral-0
|
25
|
+
focus:ring-0 active:bg-neutral-0 focus:bg-neutral-0 visited:bg-neutral-0
|
26
|
+
disabled:cursor-not-allowed disabled:bg-neutral-100 disabled:text-neutral-500 disabled:ring-neutral-200"
|
27
|
+
placeholder={placeholder}
|
28
|
+
/>
|
29
|
+
</div>
|
30
|
+
<div className=' py-[3.5px] pr-[3px] z-20'>
|
31
|
+
<HDSButton
|
32
|
+
type='tonal'
|
33
|
+
btnBgColorClass='bg-blue-100'
|
34
|
+
btnbgHoverClass='hover:bg-blue-500'
|
35
|
+
rightAnimatedArrowColor='#3970FD'
|
36
|
+
label={label}
|
37
|
+
/>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
</div>
|
41
|
+
|
42
|
+
)
|
43
|
+
}
|
@@ -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