@fw-components/formula-editor 2.0.7-formula-editor.1 → 2.0.7-formula-editor.2

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.
@@ -56,6 +56,19 @@ let FormulaEditor = class FormulaEditor extends LitElement {
56
56
  ? (currentIndex - 1 + this._recommendations.length) % this._recommendations.length
57
57
  : currentIndex;
58
58
  this._selectedRecommendation = this._recommendations[newIndex];
59
+ this.scrollToSelectedRecommendation(newIndex);
60
+ }
61
+ scrollToSelectedRecommendation(index) {
62
+ const suggestionMenu = this.shadowRoot?.querySelector("suggestion-menu");
63
+ if (suggestionMenu) {
64
+ const listItem = suggestionMenu.shadowRoot?.querySelectorAll("li")[index];
65
+ if (listItem) {
66
+ listItem.scrollIntoView({
67
+ block: "nearest",
68
+ inline: "nearest",
69
+ });
70
+ }
71
+ }
59
72
  }
60
73
  handleKeyboardEvents(event) {
61
74
  if (event.code == "Tab" && this._recommendations?.length == 1) {
@@ -14,35 +14,69 @@ let SuggestionMenu = class SuggestionMenu extends LitElement {
14
14
  this.currentSelection = "";
15
15
  }
16
16
  static { this.styles = css `
17
- ul {
18
- border: 1px solid var(--fe-suggestion-color, white);
19
- color: var(--fe-suggestion-color, #bab6c0);
20
- background-color: var(--fe-suggestion-background-color, #363537);
21
- box-sizing: border-box;
22
- width: fit-content;
23
- list-style-type: none;
24
- padding: 4px 0px;
25
- margin: 2px;
26
- }
17
+ ul {
18
+ border: 1px solid var(--fe-suggestion-color, white);
19
+ color: var(--fe-suggestion-color, #bab6c0);
20
+ background-color: var(--fe-suggestion-background-color, white);
21
+ box-sizing: border-box;
22
+ width: 20vw;
23
+ max-height: 25vh;
24
+ overflow-x: auto;
25
+ overflow-y: auto;
26
+ list-style-type: none;
27
+ padding: 0;
28
+ margin: 0;
29
+ box-shadow: 1px 2px 5px rgba(0, 0, 0, 0.13);
30
+ border-radius: 5px;
31
+ }
27
32
 
28
- li {
29
- margin: 0px;
30
- padding: 2px 6px;
31
- cursor: pointer;
32
- }
33
+ li {
34
+ margin: 0;
35
+ padding: 0.5em 1rem;
36
+ cursor: pointer;
37
+ font-family: var(--theme-font);
38
+ font-size: var(--secondary-font-size, 16px);
39
+ color: var(--secondary-color, #bab6c0);
40
+ }
33
41
 
34
- li.selected {
35
- background-color: var(--fe-suggestion-selected-background-color, darkgrey);
36
- color: var(--fe-suggestion-selected-color, yellow);
37
- }
42
+ li:hover,
43
+ li:focus-visible {
44
+ font-weight: bold;
45
+ color: var(--fe-suggestion-focus-color, #69676c);
46
+ }
38
47
 
39
- li:focus-visible {
40
- /* outline: 1px solid red; */
41
- outline: 0px;
42
- color: var(--fe-suggestion-focus-color, #fce566);
43
- background-color: var(--fe-suggestion-focus-background-color, #69676c);
44
- }
45
- `; }
48
+ li.selected {
49
+ color: var(--fe-suggestion-focus-color, #69676c);
50
+ font-weight: bold;
51
+ }
52
+
53
+ li[focused] {
54
+ font-weight: bold;
55
+ }
56
+
57
+ /* Scrollbar styling */
58
+ ::-webkit-scrollbar {
59
+ width: 10px;
60
+ }
61
+
62
+ ::-webkit-scrollbar-track {
63
+ background: transparent;
64
+ }
65
+
66
+ ::-webkit-scrollbar-thumb {
67
+ background: #ccc;
68
+ border-radius: 5px;
69
+ }
70
+
71
+ ::-webkit-scrollbar-thumb:hover {
72
+ background: #aaa;
73
+ }
74
+
75
+ /* Optional shadow for the dropdown */
76
+ .content {
77
+ box-shadow: 1px 2px 5px rgba(0, 0, 0, 0.13);
78
+ }
79
+ `; }
46
80
  handleKeydown(event, recommendation) {
47
81
  if (event.code == "Enter") {
48
82
  event.preventDefault();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fw-components/formula-editor",
3
- "version": "2.0.7-formula-editor.1",
3
+ "version": "2.0.7-formula-editor.2",
4
4
  "description": "A WYSIWYG type formula editor",
5
5
  "main": "dist/formula-editor/src/formula-builder.js",
6
6
  "publishConfig": {
@@ -25,5 +25,5 @@
25
25
  "@types/big.js": "^6.1.6",
26
26
  "es-dev-server": "^2.1.0"
27
27
  },
28
- "gitHead": "ac3d8a9eb757e3b2b5001bd46e9e7003a323f46e"
28
+ "gitHead": "dd5507965a60cb53b241d974d5e3c74d5388263b"
29
29
  }