@nectary/components 5.11.0 → 5.11.1
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/bundle.js +15 -19
- package/package.json +1 -1
- package/pagination/index.js +9 -13
package/bundle.js
CHANGED
|
@@ -295,8 +295,8 @@ class Text extends NectaryElement {
|
|
|
295
295
|
get inline() {
|
|
296
296
|
return getBooleanAttribute(this, "inline");
|
|
297
297
|
}
|
|
298
|
-
set ellipsis(
|
|
299
|
-
updateBooleanAttribute(this, "ellipsis",
|
|
298
|
+
set ellipsis(isEllipsis2) {
|
|
299
|
+
updateBooleanAttribute(this, "ellipsis", isEllipsis2);
|
|
300
300
|
}
|
|
301
301
|
get ellipsis() {
|
|
302
302
|
return getBooleanAttribute(this, "ellipsis");
|
|
@@ -364,8 +364,8 @@ class Title extends NectaryElement {
|
|
|
364
364
|
get type() {
|
|
365
365
|
return getLiteralAttribute(this, typeValues$6, "type");
|
|
366
366
|
}
|
|
367
|
-
set ellipsis(
|
|
368
|
-
updateBooleanAttribute(this, "ellipsis",
|
|
367
|
+
set ellipsis(isEllipsis2) {
|
|
368
|
+
updateBooleanAttribute(this, "ellipsis", isEllipsis2);
|
|
369
369
|
}
|
|
370
370
|
get ellipsis() {
|
|
371
371
|
return getBooleanAttribute(this, "ellipsis");
|
|
@@ -3358,8 +3358,8 @@ class CardV2Title extends NectaryElement {
|
|
|
3358
3358
|
set orientation(value) {
|
|
3359
3359
|
updateAttribute(this, "orientation", value);
|
|
3360
3360
|
}
|
|
3361
|
-
set ellipsis(
|
|
3362
|
-
updateBooleanAttribute(this, "ellipsis",
|
|
3361
|
+
set ellipsis(isEllipsis2) {
|
|
3362
|
+
updateBooleanAttribute(this, "ellipsis", isEllipsis2);
|
|
3363
3363
|
}
|
|
3364
3364
|
get ellipsis() {
|
|
3365
3365
|
return getBooleanAttribute(this, "ellipsis");
|
|
@@ -7696,6 +7696,9 @@ const FIRST_BTN_INDEX = 0;
|
|
|
7696
7696
|
const LAST_BTN_INDEX = NUM_BUTTONS - 1;
|
|
7697
7697
|
const DOTS_LEFT_INDEX = 1;
|
|
7698
7698
|
const DOTS_RIGHT_INDEX = LAST_BTN_INDEX - 1;
|
|
7699
|
+
const isEllipsis = (btnIndex, value, max) => {
|
|
7700
|
+
return btnIndex === DOTS_LEFT_INDEX && value > MIDDLE_BTN_INDEX || btnIndex === DOTS_RIGHT_INDEX && value <= max - DOTS_RIGHT_INDEX;
|
|
7701
|
+
};
|
|
7699
7702
|
const template$t = document.createElement("template");
|
|
7700
7703
|
template$t.innerHTML = templateHTML$t;
|
|
7701
7704
|
class Pagination extends NectaryElement {
|
|
@@ -7763,19 +7766,12 @@ class Pagination extends NectaryElement {
|
|
|
7763
7766
|
isActive = i === MIDDLE_BTN_INDEX;
|
|
7764
7767
|
}
|
|
7765
7768
|
setClass($b, "active", isActive);
|
|
7766
|
-
|
|
7767
|
-
$b.setAttribute("aria-current", "page");
|
|
7768
|
-
} else {
|
|
7769
|
-
$b.removeAttribute("aria-current");
|
|
7770
|
-
}
|
|
7769
|
+
updateAttribute($b, "aria-current", isActive ? "page" : null);
|
|
7771
7770
|
if (max > NUM_BUTTONS) {
|
|
7772
|
-
const
|
|
7773
|
-
setClass($b, "dots",
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
} else {
|
|
7777
|
-
$b.removeAttribute("aria-hidden");
|
|
7778
|
-
}
|
|
7771
|
+
const ellipsis = isEllipsis(i, value, max);
|
|
7772
|
+
setClass($b, "dots", ellipsis);
|
|
7773
|
+
updateAttribute($b, "aria-hidden", ellipsis);
|
|
7774
|
+
$b.disabled = ellipsis;
|
|
7779
7775
|
}
|
|
7780
7776
|
setClass($b, "hidden", i >= max);
|
|
7781
7777
|
const btnText = $b.firstElementChild;
|
|
@@ -7791,7 +7787,7 @@ class Pagination extends NectaryElement {
|
|
|
7791
7787
|
}
|
|
7792
7788
|
#onButtonClick = (e) => {
|
|
7793
7789
|
e.stopPropagation();
|
|
7794
|
-
const value =
|
|
7790
|
+
const value = getIntegerAttribute(this, "value", 0) - 1;
|
|
7795
7791
|
const max = Math.max(0, getIntegerAttribute(this, "max", 0));
|
|
7796
7792
|
if (isTargetEqual(e, this.#$left)) {
|
|
7797
7793
|
return this.#dispatchChangeEvent(Math.max(value - 1, 0));
|
package/package.json
CHANGED
package/pagination/index.js
CHANGED
|
@@ -11,6 +11,9 @@ const FIRST_BTN_INDEX = 0;
|
|
|
11
11
|
const LAST_BTN_INDEX = NUM_BUTTONS - 1;
|
|
12
12
|
const DOTS_LEFT_INDEX = 1;
|
|
13
13
|
const DOTS_RIGHT_INDEX = LAST_BTN_INDEX - 1;
|
|
14
|
+
const isEllipsis = (btnIndex, value, max) => {
|
|
15
|
+
return btnIndex === DOTS_LEFT_INDEX && value > MIDDLE_BTN_INDEX || btnIndex === DOTS_RIGHT_INDEX && value <= max - DOTS_RIGHT_INDEX;
|
|
16
|
+
};
|
|
14
17
|
const template = document.createElement("template");
|
|
15
18
|
template.innerHTML = templateHTML;
|
|
16
19
|
class Pagination extends NectaryElement {
|
|
@@ -78,19 +81,12 @@ class Pagination extends NectaryElement {
|
|
|
78
81
|
isActive = i === MIDDLE_BTN_INDEX;
|
|
79
82
|
}
|
|
80
83
|
setClass($b, "active", isActive);
|
|
81
|
-
|
|
82
|
-
$b.setAttribute("aria-current", "page");
|
|
83
|
-
} else {
|
|
84
|
-
$b.removeAttribute("aria-current");
|
|
85
|
-
}
|
|
84
|
+
updateAttribute($b, "aria-current", isActive ? "page" : null);
|
|
86
85
|
if (max > NUM_BUTTONS) {
|
|
87
|
-
const
|
|
88
|
-
setClass($b, "dots",
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
} else {
|
|
92
|
-
$b.removeAttribute("aria-hidden");
|
|
93
|
-
}
|
|
86
|
+
const ellipsis = isEllipsis(i, value, max);
|
|
87
|
+
setClass($b, "dots", ellipsis);
|
|
88
|
+
updateAttribute($b, "aria-hidden", ellipsis);
|
|
89
|
+
$b.disabled = ellipsis;
|
|
94
90
|
}
|
|
95
91
|
setClass($b, "hidden", i >= max);
|
|
96
92
|
const btnText = $b.firstElementChild;
|
|
@@ -106,7 +102,7 @@ class Pagination extends NectaryElement {
|
|
|
106
102
|
}
|
|
107
103
|
#onButtonClick = (e) => {
|
|
108
104
|
e.stopPropagation();
|
|
109
|
-
const value =
|
|
105
|
+
const value = getIntegerAttribute(this, "value", 0) - 1;
|
|
110
106
|
const max = Math.max(0, getIntegerAttribute(this, "max", 0));
|
|
111
107
|
if (isTargetEqual(e, this.#$left)) {
|
|
112
108
|
return this.#dispatchChangeEvent(Math.max(value - 1, 0));
|