gd-bs 5.4.0 → 5.4.3
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/.github/workflows/build.yml +4 -1
- package/build/bs.js +1 -1
- package/build/components/carousel/index.js +6 -2
- package/build/components/carousel/item.js +2 -0
- package/build/components/modal/index.js +1 -1
- package/build/components/navbar/index.js +1 -1
- package/build/components/offcanvas/index.js +1 -1
- package/dist/gd-bs-icons.js +183 -183
- package/dist/gd-bs-icons.min.js +1 -1
- package/dist/gd-bs.d.ts +3 -0
- package/dist/gd-bs.js +178 -178
- package/dist/gd-bs.min.js +1 -1
- package/package.json +6 -6
- package/pnpm-lock.yaml +447 -1372
- package/src/bs.scss +1 -0
- package/src/components/carousel/index.ts +8 -2
- package/src/components/carousel/item.ts +3 -0
- package/src/components/carousel/types.d.ts +3 -0
- package/src/components/modal/index.ts +1 -1
- package/src/components/navbar/index.ts +1 -1
- package/src/components/offcanvas/index.ts +1 -1
package/src/bs.scss
CHANGED
|
@@ -59,6 +59,9 @@ class _Carousel extends Base<ICarouselProps> implements ICarousel {
|
|
|
59
59
|
this.nextWhenVisible(options.slide);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
+
|
|
63
|
+
// Call the event if it exists
|
|
64
|
+
this.props.onRendered ? this.props.onRendered(this.el, this.props) : null;
|
|
62
65
|
}
|
|
63
66
|
|
|
64
67
|
// Configures the events
|
|
@@ -73,12 +76,12 @@ class _Carousel extends Base<ICarouselProps> implements ICarousel {
|
|
|
73
76
|
// Add a keydown event
|
|
74
77
|
el.addEventListener("keydown", (ev) => {
|
|
75
78
|
// See if the left arrow was pressed
|
|
76
|
-
if (ev.
|
|
79
|
+
if (ev.code == "37") {
|
|
77
80
|
// Move to the previous slide
|
|
78
81
|
this.previous();
|
|
79
82
|
}
|
|
80
83
|
// Else, see if the right arrow was pressed
|
|
81
|
-
else if (ev.
|
|
84
|
+
else if (ev.code == "39") {
|
|
82
85
|
// Move tot he next slide
|
|
83
86
|
this.next();
|
|
84
87
|
}
|
|
@@ -220,6 +223,9 @@ class _Carousel extends Base<ICarouselProps> implements ICarousel {
|
|
|
220
223
|
|
|
221
224
|
// Create the item element
|
|
222
225
|
slides.appendChild(slide.el);
|
|
226
|
+
|
|
227
|
+
// Call the event
|
|
228
|
+
this.props.onSlideRendered ? this.props.onSlideRendered(slide.el, items[i]) : null;
|
|
223
229
|
}
|
|
224
230
|
}
|
|
225
231
|
}
|
|
@@ -124,6 +124,7 @@ export interface ICarouselItem<T = Element> {
|
|
|
124
124
|
imageAlt?: string;
|
|
125
125
|
imageUrl?: string;
|
|
126
126
|
isActive?: boolean;
|
|
127
|
+
onRendered?: (el?: HTMLElement, props?: ICarouselItem) => void;
|
|
127
128
|
}
|
|
128
129
|
|
|
129
130
|
/**
|
|
@@ -147,5 +148,7 @@ export interface ICarouselProps<T = Element> extends IBaseProps<ICarousel> {
|
|
|
147
148
|
id?: string;
|
|
148
149
|
isDark?: boolean;
|
|
149
150
|
items?: Array<ICarouselItem<T>>;
|
|
151
|
+
onRendered?: (el?: HTMLElement, props?: ICarouselProps) => void;
|
|
152
|
+
onSlideRendered?: (el?: HTMLElement, props?: ICarouselItem) => void;
|
|
150
153
|
options?: ICarouselOptions;
|
|
151
154
|
}
|
|
@@ -195,7 +195,7 @@ class _Modal extends Base<IModalProps> implements IModal {
|
|
|
195
195
|
// Add a click event
|
|
196
196
|
(this.el as HTMLElement).addEventListener("keydown", ev => {
|
|
197
197
|
// See if the escape key was clicked and the modal is visible
|
|
198
|
-
if (ev.
|
|
198
|
+
if (ev.code === "27" && this.isVisible) {
|
|
199
199
|
// Toggle the modal
|
|
200
200
|
this.toggle();
|
|
201
201
|
}
|
|
@@ -95,7 +95,7 @@ class _Navbar extends Base<INavbarProps> implements INavbar {
|
|
|
95
95
|
// Set a keydown event to catch the "Enter" key being pressed
|
|
96
96
|
searchbox.addEventListener("keydown", ev => {
|
|
97
97
|
// See if the "Enter" key was pressed
|
|
98
|
-
if (ev.
|
|
98
|
+
if (ev.code == "13") {
|
|
99
99
|
// Disable the postback
|
|
100
100
|
ev.preventDefault();
|
|
101
101
|
|
|
@@ -144,7 +144,7 @@ class _Offcanvas extends Base<IOffcanvasProps> implements IOffcanvas {
|
|
|
144
144
|
// Add a click event
|
|
145
145
|
(this.el as HTMLElement).addEventListener("keydown", ev => {
|
|
146
146
|
// See if the escape key was clicked and the modal is visible
|
|
147
|
-
if (ev.
|
|
147
|
+
if (ev.code === "27" && this.isVisible) {
|
|
148
148
|
// Toggle the modal
|
|
149
149
|
this.toggle();
|
|
150
150
|
}
|