Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit 5a5a45f

Browse files
authored
feat(date-textbox): added floating-ui support (#2529)
1 parent 4265bed commit 5a5a45f

File tree

5 files changed

+25
-3
lines changed

5 files changed

+25
-3
lines changed

.changeset/smart-bugs-turn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@ebay/skin": major
3+
---
4+
5+
feat(floating-ui): added support in date-textbox

dist/date-textbox/date-textbox.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
}
55
.date-textbox {
66
--calendar-month-width: 311px;
7+
display: inline-block;
78
}
89

910
.date-textbox > .textbox + .textbox {

src/routes/_index/component/date-textbox/+page.marko

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
class="icon-btn icon-btn--transparent"
4545
type="button"
4646
aria-label="Calendar"
47-
onclick="this.parentElement.nextElementSibling.toggleAttribute('hidden')"
4847
>
4948
<svg
5049
aria-hidden="true"
@@ -420,7 +419,6 @@
420419
class="icon-btn icon-btn--transparent"
421420
type="button"
422421
aria-label="Calendar"
423-
onclick="this.parentElement.nextElementSibling.toggleAttribute('hidden')"
424422
disabled
425423
>
426424
<svg
@@ -485,7 +483,6 @@
485483
class="icon-btn icon-btn--transparent"
486484
type="button"
487485
aria-label="Calendar"
488-
onclick="this.parentElement.nextElementSibling.toggleAttribute('hidden')"
489486
>
490487
<svg
491488
aria-hidden="true"

src/routes/main.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,23 @@ document.querySelectorAll(".expand-btn").forEach(function (el) {
187187
});
188188
});
189189

190+
document.querySelectorAll(".date-textbox").forEach(function (el) {
191+
const popperDropdown = new PopperDropdown(
192+
el,
193+
null,
194+
".date-textbox__popover",
195+
);
196+
197+
el.querySelector("button").addEventListener("click", function () {
198+
this.parentElement.nextElementSibling.toggleAttribute("hidden");
199+
if (this.parentElement.nextElementSibling.hasAttribute("hidden")) {
200+
popperDropdown.hide();
201+
} else {
202+
popperDropdown.show();
203+
}
204+
});
205+
});
206+
190207
document.querySelectorAll(".filter-menu-button--form").forEach(function (el) {
191208
const popperDropdown = new PopperDropdown(
192209
el,

src/sass/date-textbox/date-textbox.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
.date-textbox {
66
/* 343px - (2 * var(--spacing-200)) [not autmatically compiled by LESS] */
77
--calendar-month-width: 311px;
8+
9+
display: inline-block;
810
}
911

1012
.date-textbox > .textbox + .textbox {

0 commit comments

Comments
 (0)