ehscan-react-components 0.1.25 → 0.1.27

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/DropDown.js CHANGED
@@ -3,14 +3,12 @@ import { useEffect, useState, useRef, forwardRef, useImperativeHandle } from "re
3
3
  export const DropDown = forwardRef(({ openDropDown, display, addItem, searchTerm, maxDropDownEntries }, ref) => {
4
4
  const [position, setPosition] = useState({ top: 0, left: 0, width: 0, maxHeight: 0 });
5
5
  const containerRef = useRef(null);
6
- // Expose functions to parent
7
6
  useImperativeHandle(ref, () => ({
8
7
  calc: () => {
9
8
  console.log("calc");
10
9
  setTimeout(() => {
11
10
  calcDropDown();
12
11
  }, 50);
13
- // parent will implement actual state change, this is just the hook
14
12
  },
15
13
  }));
16
14
  const HighlightedText = ({ text, searchTerm, maxLength = 150 }) => {
@@ -26,7 +24,6 @@ export const DropDown = forwardRef(({ openDropDown, display, addItem, searchTerm
26
24
  return _jsx("div", { children: text.slice(0, maxLength) });
27
25
  }
28
26
  const lowerText = text.toLowerCase();
29
- // Find first match position
30
27
  let firstMatchIndex = -1;
31
28
  for (let word of searchWords) {
32
29
  const index = lowerText.indexOf(word);
@@ -34,14 +31,12 @@ export const DropDown = forwardRef(({ openDropDown, display, addItem, searchTerm
34
31
  firstMatchIndex = index;
35
32
  }
36
33
  }
37
- // Determine slice window
38
34
  let sliceStart = 0;
39
35
  let sliceEnd = maxLength;
40
36
  if (firstMatchIndex > -1) {
41
37
  const foundWord = searchWords.find(w => lowerText.includes(w));
42
38
  if (firstMatchIndex > -1 && foundWord) {
43
39
  const matchEnd = firstMatchIndex + foundWord.length;
44
- // const matchEnd = firstMatchIndex + searchWords.find(w => lowerText.includes(w)).length;
45
40
  if (matchEnd > maxLength) {
46
41
  sliceEnd = Math.min(text.length, matchEnd);
47
42
  sliceStart = sliceEnd - maxLength;
@@ -49,7 +44,6 @@ export const DropDown = forwardRef(({ openDropDown, display, addItem, searchTerm
49
44
  }
50
45
  }
51
46
  const displayText = text.slice(sliceStart, sliceEnd);
52
- // Build a regex that matches all words
53
47
  const highlightRegex = new RegExp(`(${searchWords.join('|')})`, 'gi');
54
48
  const parts = displayText.split(highlightRegex);
55
49
  return (_jsxs(_Fragment, { children: [sliceStart > 0 && '…', parts.map((part, i) => searchWords.includes(part.toLowerCase()) ? (_jsx("span", { className: "highlight-words", children: part }, i)) : (_jsx("span", { children: part }, i))), sliceEnd < text.length && '…'] }));
@@ -60,7 +54,7 @@ export const DropDown = forwardRef(({ openDropDown, display, addItem, searchTerm
60
54
  const rect = containerRef.current.getBoundingClientRect();
61
55
  const distanceToBottom = window.innerHeight - rect.bottom;
62
56
  setPosition({
63
- top: rect.bottom - 5,
57
+ top: rect.bottom - 10,
64
58
  left: rect.left,
65
59
  width: rect.width,
66
60
  maxHeight: distanceToBottom - 50
@@ -78,7 +72,7 @@ export const DropDown = forwardRef(({ openDropDown, display, addItem, searchTerm
78
72
  calcDropDown();
79
73
  }, 50);
80
74
  };
81
- return (_jsxs(_Fragment, { children: [_jsx("div", { className: "ext-window-dropdown-edge", ref: containerRef }), openDropDown && (_jsxs("div", { className: "ext-window-dropdown", style: {
75
+ return (_jsxs(_Fragment, { children: [_jsx("div", { className: "ext-window-dropdown-edge", ref: containerRef }), openDropDown && display.length > 0 && (_jsxs("div", { className: "ext-window-dropdown", style: {
82
76
  top: position.top,
83
77
  left: position.left,
84
78
  width: position.width
@@ -106,7 +106,7 @@ input:-webkit-autofill:active {
106
106
  }
107
107
 
108
108
  .ext-textarea-box-dropdown.open {
109
- border-radius: var(--ext-textarea-box-border-radius) var(--ext-textarea-box-border-radius) var(--ext-dropdown-border-radius) var(--ext-dropdown-border-radius) ;
109
+ border-radius: var(--ext-textarea-box-border-radius) var(--ext-textarea-box-border-radius) var(--ext-dropdown-border-radius) var(--ext-dropdown-border-radius);
110
110
  }
111
111
 
112
112
  .ext-textarea-wrapper {
@@ -194,7 +194,7 @@ input:-webkit-autofill:active {
194
194
  box-sizing: border-box;
195
195
  resize: none;
196
196
  overflow: hidden;
197
- padding: 10px;
197
+ padding: var(--ext-textarea-dropdown-inner-padding, 10px);
198
198
  line-height: 1.5;
199
199
  display: flex;
200
200
  flex-wrap: wrap;
@@ -212,7 +212,6 @@ input:-webkit-autofill:active {
212
212
  margin: 3px;
213
213
  background-color: var(--textarea-tag-bck-clr, white);
214
214
  color: var(--textarea-tag-clr, darkblue);
215
- padding: 5px 7px;
216
215
  border-radius: 6px;
217
216
  font-size: 90%;
218
217
  font-weight: 400;
@@ -223,8 +222,9 @@ input:-webkit-autofill:active {
223
222
  overflow: hidden;
224
223
  gap: 5px;
225
224
  flex: 0 0 auto;
226
- padding: 6px 10px;
227
- border-radius: 6px;
225
+ padding: 0 var(--loop-padding, 10px);
226
+ height: var(--loop-height, 20px);
227
+ border-radius: var(----loop-border-radius, 6px);
228
228
  align-items: center;
229
229
  justify-content: center;
230
230
  box-shadow: rgba(0, 0, 0, 0.04) 0px 3px 5px;
@@ -237,7 +237,7 @@ input:-webkit-autofill:active {
237
237
  border-radius: 50px;
238
238
  }
239
239
 
240
- .textarea-tag-erase:hover{
240
+ .textarea-tag-erase:hover {
241
241
  background-color: lightgray;
242
242
  cursor: pointer;
243
243
  }
@@ -295,6 +295,7 @@ input:-webkit-autofill:active {
295
295
  text-align: end;
296
296
  font-size: 80%;
297
297
  font-weight: 600;
298
+ border-radius: var(--ext-dropdown-border-radius) var(--ext-dropdown-border-radius) 0 0;
298
299
  }
299
300
 
300
301
  .textarea-tag.input {
@@ -325,14 +326,14 @@ input:-webkit-autofill:active {
325
326
  grid-template-columns: 1fr auto;
326
327
  align-items: center;
327
328
  justify-content: center;
328
- gap: 10px;
329
329
  }
330
330
 
331
331
  .search-x-input {
332
332
  padding: 5px 7px;
333
333
  background-color: transparent;
334
- border: 1px dashed white;
335
- border-radius: 4px;
334
+ border: 1px dashed white;
335
+ border-radius: 4px;
336
+ margin: 0 10px 0 0;
336
337
  }
337
338
 
338
339
  .search-x-btn {
@@ -369,6 +370,8 @@ input:-webkit-autofill:active {
369
370
  cursor: pointer;
370
371
  }
371
372
 
372
- .search-x-input > input{
373
- width: -webkit-fill-available;
373
+ .search-x-input>input {
374
+ min-width: 0;
375
+ width: 100%;
376
+ box-sizing: border-box;
374
377
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ehscan-react-components",
3
- "version": "0.1.25",
3
+ "version": "0.1.27",
4
4
  "description": "components",
5
5
  "main": "dist/Components.js",
6
6
  "types": "dist/Components.d.ts",