@coyalabs/bts-style 1.1.12545 → 1.1.125456

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.
@@ -64,9 +64,27 @@
64
64
  * @type {HTMLDivElement}
65
65
  */
66
66
  let dropdownRef;
67
+
68
+ /**
69
+ * @type {HTMLDivElement}
70
+ */
71
+ let buttonRef;
72
+
73
+ /**
74
+ * @type {{top: number, left: number, width: number}}
75
+ */
76
+ let menuPosition = { top: 0, left: 0, width: 0 };
67
77
 
68
78
  function toggleDropdown() {
69
79
  isOpen = !isOpen;
80
+ if (isOpen && buttonRef) {
81
+ const rect = buttonRef.getBoundingClientRect();
82
+ menuPosition = {
83
+ top: rect.bottom + 4,
84
+ left: rect.left,
85
+ width: rect.width
86
+ };
87
+ }
70
88
  }
71
89
 
72
90
  /**
@@ -94,23 +112,29 @@
94
112
  <svelte:window on:click={handleClickOutside} />
95
113
 
96
114
  <div class="dropdown-container" bind:this={dropdownRef} style="width: {width};">
97
- <Button
98
- {theme}
99
- {icon}
100
- actionIcon={icons.icon_expand}
101
- actionIconSize="12px"
102
- actionIconRotation={isOpen ? 180 : 0}
103
- {borderRadiusTopLeft}
104
- {borderRadiusTopRight}
105
- {borderRadiusBottomLeft}
106
- {borderRadiusBottomRight}
107
- on:click={toggleDropdown}
108
- >
109
- <span class="button-label">{displayLabel}</span>
110
- </Button>
115
+ <div bind:this={buttonRef}>
116
+ <Button
117
+ {theme}
118
+ {icon}
119
+ actionIcon={icons.icon_expand}
120
+ actionIconSize="12px"
121
+ actionIconRotation={isOpen ? 180 : 0}
122
+ {borderRadiusTopLeft}
123
+ {borderRadiusTopRight}
124
+ {borderRadiusBottomLeft}
125
+ {borderRadiusBottomRight}
126
+ on:click={toggleDropdown}
127
+ >
128
+ <span class="button-label">{displayLabel}</span>
129
+ </Button>
130
+ </div>
111
131
 
112
132
  {#if isOpen}
113
- <div class="dropdown-menu" transition:slide={{ duration: 150 }}>
133
+ <div
134
+ class="dropdown-menu"
135
+ transition:slide={{ duration: 150 }}
136
+ style="top: {menuPosition.top}px; left: {menuPosition.left}px; width: {menuPosition.width}px;"
137
+ >
114
138
  <ContextMenu items={options} selectedValue={value} onSelect={selectOption} />
115
139
  </div>
116
140
  {/if}
@@ -134,10 +158,7 @@
134
158
  }
135
159
 
136
160
  .dropdown-menu {
137
- position: absolute;
138
- top: calc(100% + 4px);
139
- left: 0;
140
- right: 0;
141
- z-index: 1000;
161
+ position: fixed;
162
+ z-index: 10000;
142
163
  }
143
164
  </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coyalabs/bts-style",
3
- "version": "1.1.12545",
3
+ "version": "1.1.125456",
4
4
  "description": "BTS Theme Svelte component templates",
5
5
  "type": "module",
6
6
  "exports": {