Skip to content

Commit

Permalink
Merge branch 'pr_updates'
Browse files Browse the repository at this point in the history
  • Loading branch information
brianvoe committed Nov 21, 2024
2 parents a4461d6 + abc637c commit 373c543
Show file tree
Hide file tree
Showing 25 changed files with 819 additions and 605 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v21.5.0
v22.11.0
2 changes: 1 addition & 1 deletion dist/settings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default class Settings {
searchHighlight: boolean;
closeOnSelect: boolean;
contentLocation: HTMLElement | null;
contentPosition: 'relative' | 'absolute';
contentPosition: 'relative' | 'absolute' | 'fixed';
openPosition: 'auto' | 'up' | 'down';
placeholderText: string;
allowDeselect: boolean;
Expand Down
21 changes: 15 additions & 6 deletions dist/slimselect.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ class Render {
}
}
}
if (this.settings.contentPosition === 'relative') {
if (this.settings.contentPosition === 'relative' || this.settings.contentPosition === 'fixed') {
this.content.main.classList.add('ss-' + this.settings.contentPosition);
}
}
Expand Down Expand Up @@ -465,6 +465,9 @@ class Render {
this.callbacks.close();
return false;
}
if (e.key.length === 1) {
this.callbacks.open();
}
return true;
};
main.onclick = (e) => {
Expand Down Expand Up @@ -1147,7 +1150,6 @@ class Render {
}
const optionEl = document.createElement('div');
optionEl.dataset.id = option.id;
optionEl.id = option.id;
optionEl.classList.add(this.classes.option);
optionEl.setAttribute('role', 'option');
if (option.class) {
Expand Down Expand Up @@ -1271,8 +1273,10 @@ class Render {
this.content.main.classList.add(this.classes.openAbove);
const containerRect = this.main.main.getBoundingClientRect();
this.content.main.style.margin = '-' + (mainHeight + contentHeight - 1) + 'px 0px 0px 0px';
this.content.main.style.top = containerRect.top + containerRect.height + window.scrollY + 'px';
this.content.main.style.left = containerRect.left + window.scrollX + 'px';
this.content.main.style.top =
containerRect.top + containerRect.height + (this.settings.contentPosition === 'fixed' ? 0 : window.scrollY) + 'px';
this.content.main.style.left =
containerRect.left + (this.settings.contentPosition === 'fixed' ? 0 : window.scrollX) + 'px';
this.content.main.style.width = containerRect.width + 'px';
}
moveContentBelow() {
Expand All @@ -1283,8 +1287,13 @@ class Render {
const containerRect = this.main.main.getBoundingClientRect();
this.content.main.style.margin = '-1px 0px 0px 0px';
if (this.settings.contentPosition !== 'relative') {
this.content.main.style.top = containerRect.top + containerRect.height + window.scrollY + 'px';
this.content.main.style.left = containerRect.left + window.scrollX + 'px';
this.content.main.style.top =
containerRect.top +
containerRect.height +
(this.settings.contentPosition === 'fixed' ? 0 : window.scrollY) +
'px';
this.content.main.style.left =
containerRect.left + (this.settings.contentPosition === 'fixed' ? 0 : window.scrollX) + 'px';
this.content.main.style.width = containerRect.width + 'px';
}
}
Expand Down
2 changes: 1 addition & 1 deletion dist/slimselect.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/slimselect.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 15 additions & 6 deletions dist/slimselect.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ class Render {
}
}
}
if (this.settings.contentPosition === 'relative') {
if (this.settings.contentPosition === 'relative' || this.settings.contentPosition === 'fixed') {
this.content.main.classList.add('ss-' + this.settings.contentPosition);
}
}
Expand Down Expand Up @@ -463,6 +463,9 @@ class Render {
this.callbacks.close();
return false;
}
if (e.key.length === 1) {
this.callbacks.open();
}
return true;
};
main.onclick = (e) => {
Expand Down Expand Up @@ -1145,7 +1148,6 @@ class Render {
}
const optionEl = document.createElement('div');
optionEl.dataset.id = option.id;
optionEl.id = option.id;
optionEl.classList.add(this.classes.option);
optionEl.setAttribute('role', 'option');
if (option.class) {
Expand Down Expand Up @@ -1269,8 +1271,10 @@ class Render {
this.content.main.classList.add(this.classes.openAbove);
const containerRect = this.main.main.getBoundingClientRect();
this.content.main.style.margin = '-' + (mainHeight + contentHeight - 1) + 'px 0px 0px 0px';
this.content.main.style.top = containerRect.top + containerRect.height + window.scrollY + 'px';
this.content.main.style.left = containerRect.left + window.scrollX + 'px';
this.content.main.style.top =
containerRect.top + containerRect.height + (this.settings.contentPosition === 'fixed' ? 0 : window.scrollY) + 'px';
this.content.main.style.left =
containerRect.left + (this.settings.contentPosition === 'fixed' ? 0 : window.scrollX) + 'px';
this.content.main.style.width = containerRect.width + 'px';
}
moveContentBelow() {
Expand All @@ -1281,8 +1285,13 @@ class Render {
const containerRect = this.main.main.getBoundingClientRect();
this.content.main.style.margin = '-1px 0px 0px 0px';
if (this.settings.contentPosition !== 'relative') {
this.content.main.style.top = containerRect.top + containerRect.height + window.scrollY + 'px';
this.content.main.style.left = containerRect.left + window.scrollX + 'px';
this.content.main.style.top =
containerRect.top +
containerRect.height +
(this.settings.contentPosition === 'fixed' ? 0 : window.scrollY) +
'px';
this.content.main.style.left =
containerRect.left + (this.settings.contentPosition === 'fixed' ? 0 : window.scrollX) + 'px';
this.content.main.style.width = containerRect.width + 'px';
}
}
Expand Down
21 changes: 15 additions & 6 deletions dist/slimselect.global.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ var SlimSelect = (function () {
}
}
}
if (this.settings.contentPosition === 'relative') {
if (this.settings.contentPosition === 'relative' || this.settings.contentPosition === 'fixed') {
this.content.main.classList.add('ss-' + this.settings.contentPosition);
}
}
Expand Down Expand Up @@ -466,6 +466,9 @@ var SlimSelect = (function () {
this.callbacks.close();
return false;
}
if (e.key.length === 1) {
this.callbacks.open();
}
return true;
};
main.onclick = (e) => {
Expand Down Expand Up @@ -1148,7 +1151,6 @@ var SlimSelect = (function () {
}
const optionEl = document.createElement('div');
optionEl.dataset.id = option.id;
optionEl.id = option.id;
optionEl.classList.add(this.classes.option);
optionEl.setAttribute('role', 'option');
if (option.class) {
Expand Down Expand Up @@ -1272,8 +1274,10 @@ var SlimSelect = (function () {
this.content.main.classList.add(this.classes.openAbove);
const containerRect = this.main.main.getBoundingClientRect();
this.content.main.style.margin = '-' + (mainHeight + contentHeight - 1) + 'px 0px 0px 0px';
this.content.main.style.top = containerRect.top + containerRect.height + window.scrollY + 'px';
this.content.main.style.left = containerRect.left + window.scrollX + 'px';
this.content.main.style.top =
containerRect.top + containerRect.height + (this.settings.contentPosition === 'fixed' ? 0 : window.scrollY) + 'px';
this.content.main.style.left =
containerRect.left + (this.settings.contentPosition === 'fixed' ? 0 : window.scrollX) + 'px';
this.content.main.style.width = containerRect.width + 'px';
}
moveContentBelow() {
Expand All @@ -1284,8 +1288,13 @@ var SlimSelect = (function () {
const containerRect = this.main.main.getBoundingClientRect();
this.content.main.style.margin = '-1px 0px 0px 0px';
if (this.settings.contentPosition !== 'relative') {
this.content.main.style.top = containerRect.top + containerRect.height + window.scrollY + 'px';
this.content.main.style.left = containerRect.left + window.scrollX + 'px';
this.content.main.style.top =
containerRect.top +
containerRect.height +
(this.settings.contentPosition === 'fixed' ? 0 : window.scrollY) +
'px';
this.content.main.style.left =
containerRect.left + (this.settings.contentPosition === 'fixed' ? 0 : window.scrollX) + 'px';
this.content.main.style.width = containerRect.width + 'px';
}
}
Expand Down
21 changes: 15 additions & 6 deletions dist/slimselect.js
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@
}
}
}
if (this.settings.contentPosition === 'relative') {
if (this.settings.contentPosition === 'relative' || this.settings.contentPosition === 'fixed') {
this.content.main.classList.add('ss-' + this.settings.contentPosition);
}
}
Expand Down Expand Up @@ -469,6 +469,9 @@
this.callbacks.close();
return false;
}
if (e.key.length === 1) {
this.callbacks.open();
}
return true;
};
main.onclick = (e) => {
Expand Down Expand Up @@ -1151,7 +1154,6 @@
}
const optionEl = document.createElement('div');
optionEl.dataset.id = option.id;
optionEl.id = option.id;
optionEl.classList.add(this.classes.option);
optionEl.setAttribute('role', 'option');
if (option.class) {
Expand Down Expand Up @@ -1275,8 +1277,10 @@
this.content.main.classList.add(this.classes.openAbove);
const containerRect = this.main.main.getBoundingClientRect();
this.content.main.style.margin = '-' + (mainHeight + contentHeight - 1) + 'px 0px 0px 0px';
this.content.main.style.top = containerRect.top + containerRect.height + window.scrollY + 'px';
this.content.main.style.left = containerRect.left + window.scrollX + 'px';
this.content.main.style.top =
containerRect.top + containerRect.height + (this.settings.contentPosition === 'fixed' ? 0 : window.scrollY) + 'px';
this.content.main.style.left =
containerRect.left + (this.settings.contentPosition === 'fixed' ? 0 : window.scrollX) + 'px';
this.content.main.style.width = containerRect.width + 'px';
}
moveContentBelow() {
Expand All @@ -1287,8 +1291,13 @@
const containerRect = this.main.main.getBoundingClientRect();
this.content.main.style.margin = '-1px 0px 0px 0px';
if (this.settings.contentPosition !== 'relative') {
this.content.main.style.top = containerRect.top + containerRect.height + window.scrollY + 'px';
this.content.main.style.left = containerRect.left + window.scrollX + 'px';
this.content.main.style.top =
containerRect.top +
containerRect.height +
(this.settings.contentPosition === 'fixed' ? 0 : window.scrollY) +
'px';
this.content.main.style.left =
containerRect.left + (this.settings.contentPosition === 'fixed' ? 0 : window.scrollX) + 'px';
this.content.main.style.width = containerRect.width + 'px';
}
}
Expand Down
2 changes: 1 addition & 1 deletion dist/slimselect.min.js

Large diffs are not rendered by default.

21 changes: 15 additions & 6 deletions dist/slimselect.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@
}
}
}
if (this.settings.contentPosition === 'relative') {
if (this.settings.contentPosition === 'relative' || this.settings.contentPosition === 'fixed') {
this.content.main.classList.add('ss-' + this.settings.contentPosition);
}
}
Expand Down Expand Up @@ -469,6 +469,9 @@
this.callbacks.close();
return false;
}
if (e.key.length === 1) {
this.callbacks.open();
}
return true;
};
main.onclick = (e) => {
Expand Down Expand Up @@ -1151,7 +1154,6 @@
}
const optionEl = document.createElement('div');
optionEl.dataset.id = option.id;
optionEl.id = option.id;
optionEl.classList.add(this.classes.option);
optionEl.setAttribute('role', 'option');
if (option.class) {
Expand Down Expand Up @@ -1275,8 +1277,10 @@
this.content.main.classList.add(this.classes.openAbove);
const containerRect = this.main.main.getBoundingClientRect();
this.content.main.style.margin = '-' + (mainHeight + contentHeight - 1) + 'px 0px 0px 0px';
this.content.main.style.top = containerRect.top + containerRect.height + window.scrollY + 'px';
this.content.main.style.left = containerRect.left + window.scrollX + 'px';
this.content.main.style.top =
containerRect.top + containerRect.height + (this.settings.contentPosition === 'fixed' ? 0 : window.scrollY) + 'px';
this.content.main.style.left =
containerRect.left + (this.settings.contentPosition === 'fixed' ? 0 : window.scrollX) + 'px';
this.content.main.style.width = containerRect.width + 'px';
}
moveContentBelow() {
Expand All @@ -1287,8 +1291,13 @@
const containerRect = this.main.main.getBoundingClientRect();
this.content.main.style.margin = '-1px 0px 0px 0px';
if (this.settings.contentPosition !== 'relative') {
this.content.main.style.top = containerRect.top + containerRect.height + window.scrollY + 'px';
this.content.main.style.left = containerRect.left + window.scrollX + 'px';
this.content.main.style.top =
containerRect.top +
containerRect.height +
(this.settings.contentPosition === 'fixed' ? 0 : window.scrollY) +
'px';
this.content.main.style.left =
containerRect.left + (this.settings.contentPosition === 'fixed' ? 0 : window.scrollX) + 'px';
this.content.main.style.width = containerRect.width + 'px';
}
}
Expand Down
2 changes: 1 addition & 1 deletion dist/slimselect.umd.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/assets/index.css

Large diffs are not rendered by default.

Loading

0 comments on commit 373c543

Please sign in to comment.