gd-bs 5.7.7 → 5.8.0

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/index.html CHANGED
@@ -978,7 +978,8 @@
978
978
  id: "offcanvas-demo",
979
979
  title: "Offcanvas Demo",
980
980
  body: "<h5>Hello Canvas</h5><input />",
981
- type: 2,
981
+ size: 5,
982
+ type: 3,
982
983
  options: {
983
984
  backdrop: true
984
985
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gd-bs",
3
- "version": "5.7.7",
3
+ "version": "5.8.0",
4
4
  "description": "Bootstrap JavaScript, TypeScript and Web Components library.",
5
5
  "main": "build/index.js",
6
6
  "typings": "src/index.d.ts",
@@ -35,7 +35,7 @@
35
35
  "dependencies": {
36
36
  "@popperjs/core": "^2.11.5",
37
37
  "bootstrap": "^5.1.3",
38
- "bootstrap-icons": "^1.8.2",
38
+ "bootstrap-icons": "^1.9.1",
39
39
  "core-js": "^3.22.6",
40
40
  "tippy.js": "^6.3.7"
41
41
  },
package/pnpm-lock.yaml CHANGED
@@ -3307,7 +3307,7 @@ specifiers:
3307
3307
  autoprefixer: ^10.4.7
3308
3308
  babel-loader: ^8.2.5
3309
3309
  bootstrap: ^5.1.3
3310
- bootstrap-icons: ^1.8.2
3310
+ bootstrap-icons: ^1.9.1
3311
3311
  core-js: ^3.22.6
3312
3312
  css-loader: ^6.7.1
3313
3313
  dts-bundle: ^0.7.3
package/src/bs.scss CHANGED
@@ -339,6 +339,36 @@
339
339
  margin: 0rem 0rem 0rem auto;
340
340
  padding: 1rem;
341
341
  }
342
+ /* Off-canvas sizes (Small 1) */
343
+ .offcanvas-start.offcanvas-size-sm1, .offcanvas-end.offcanvas-size-sm1 { width: 20vw; }
344
+ .offcanvas-top.offcanvas-size-sm1, .offcanvas-bottom.offcanvas-size-sm1 { height: 20vh; }
345
+ /* Off-canvas sizes (Small 2) */
346
+ .offcanvas-start.offcanvas-size-sm2, .offcanvas-end.offcanvas-size-sm2 { width: 25vw; }
347
+ .offcanvas-top.offcanvas-size-sm2, .offcanvas-bottom.offcanvas-size-sm2 { height: 25vh; }
348
+ /* Off-canvas sizes (Small 3) */
349
+ .offcanvas-start.offcanvas-size-sm3, .offcanvas-end.offcanvas-size-sm3 { width: 30vw; }
350
+ .offcanvas-top.offcanvas-size-sm3, .offcanvas-bottom.offcanvas-size-sm3 { height: 30vh; }
351
+ /* Off-canvas sizes (Medium 1) */
352
+ .offcanvas-start.offcanvas-size-md1, .offcanvas-end.offcanvas-size-md1 { width: 40vw; }
353
+ .offcanvas-top.offcanvas-size-md1, .offcanvas-bottom.offcanvas-size-md1 { height: 40vh; }
354
+ /* Off-canvas sizes (Medium 2) */
355
+ .offcanvas-start.offcanvas-size-md2, .offcanvas-end.offcanvas-size-md2 { width: 50vw; }
356
+ .offcanvas-top.offcanvas-size-md2, .offcanvas-bottom.offcanvas-size-md2 { height: 50vh; }
357
+ /* Off-canvas sizes (Medium 3) */
358
+ .offcanvas-start.offcanvas-size-md3, .offcanvas-end.offcanvas-size-md3 { width: 60vw; }
359
+ .offcanvas-top.offcanvas-size-md3, .offcanvas-bottom.offcanvas-size-md3 { height: 60vh; }
360
+ /* Off-canvas sizes (Large 1) */
361
+ .offcanvas-start.offcanvas-size-lg1, .offcanvas-end.offcanvas-size-lg1 { width: 75vw; }
362
+ .offcanvas-top.offcanvas-size-lg1, .offcanvas-bottom.offcanvas-size-lg1 { height: 75vh; }
363
+ /* Off-canvas sizes (Large 2) */
364
+ .offcanvas-start.offcanvas-size-lg2, .offcanvas-end.offcanvas-size-lg2 { width: 80vw; }
365
+ .offcanvas-top.offcanvas-size-lg2, .offcanvas-bottom.offcanvas-size-lg2 { height: 80vh; }
366
+ /* Off-canvas sizes (Large 3) */
367
+ .offcanvas-start.offcanvas-size-lg3, .offcanvas-end.offcanvas-size-lg3 { width: 90vw; }
368
+ .offcanvas-top.offcanvas-size-lg3, .offcanvas-bottom.offcanvas-size-lg3 { height: 90vh; }
369
+ /* Off-canvas sizes (Full) */
370
+ .offcanvas-start.offcanvas-size-full, .offcanvas-end.offcanvas-size-full { width: 100vw; }
371
+ .offcanvas-top.offcanvas-size-full, .offcanvas-bottom.offcanvas-size-full { height: 100vh; }
342
372
  /* Color match the pagination link color to 'SharePoint Blue' */
343
373
  .page-link {
344
374
  border-color: #6c757d;
@@ -4,22 +4,57 @@ import { Base } from "../base";
4
4
  import { appendContent } from "../common";
5
5
  import { HTML } from "./templates";
6
6
 
7
+
8
+ /**
9
+ * Offcanvas Size
10
+ */
11
+ export enum OffcanvasSize {
12
+ Small1 = 1,
13
+ Small2 = 2,
14
+ Small3 = 3,
15
+ Medium1 = 4,
16
+ Medium2 = 5,
17
+ Medium3 = 6,
18
+ Large1 = 7,
19
+ Large2 = 8,
20
+ Large3 = 9,
21
+ Full = 10
22
+ }
23
+
24
+ /**
25
+ * Offcanvas Size Classes
26
+ */
27
+ export const OffcanvasSizeClassNames = new ClassNames([
28
+ "offcanvas-size-sm1",
29
+ "offcanvas-size-sm2",
30
+ "offcanvas-size-sm3",
31
+ "offcanvas-size-md1",
32
+ "offcanvas-size-md2",
33
+ "offcanvas-size-md3",
34
+ "offcanvas-size-lg1",
35
+ "offcanvas-size-lg2",
36
+ "offcanvas-size-lg3",
37
+ "offcanvas-size-full"
38
+ ]);
39
+
7
40
  /**
8
41
  * Offcanvas Types
9
42
  */
10
43
  export enum OffcanvasTypes {
11
44
  Bottom = 1,
12
45
  End = 2,
13
- Start = 3
46
+ Start = 3,
47
+ Top = 4
14
48
  }
15
49
 
16
50
  /**
17
- * Offcanvas Classes
51
+ * Offcanvas Types Classes
18
52
  */
19
- export const OffcanvasClassNames = new ClassNames([
53
+ export const OffcanvasTypesClassNames = new ClassNames([
20
54
  "offcanvas-bottom",
21
55
  "offcanvas-end",
22
- "offcanvas-start"
56
+ "offcanvas-start",
57
+ "offcanvas-top"
23
58
  ]);
24
59
 
25
60
  /**
@@ -49,7 +84,8 @@ class _Offcanvas extends Base<IOffcanvasProps> implements IOffcanvas {
49
84
  // Set the attributes
50
85
  this.props.id ? this.el.id = this.props.id : null;
51
86
 
52
- // Set the type
87
+ // Set the size & type
88
+ this.setSize(this.props.size);
53
89
  this.setType(this.props.type);
54
90
 
55
91
  // Get the options
@@ -174,16 +210,29 @@ class _Offcanvas extends Base<IOffcanvasProps> implements IOffcanvas {
174
210
  this._autoClose ? this.configureAutoCloseEvent() : null;
175
211
  }
176
212
 
213
+ // Sets the offcanvas size
214
+ setSize(offcanvasSize: number) {
215
+ // Parse the class names
216
+ OffcanvasSizeClassNames.parse(className => {
217
+ // Remove the class names
218
+ this.el.classList.remove(className);
219
+ });
220
+
221
+ // Set the class name
222
+ let className = OffcanvasSizeClassNames.getByType(offcanvasSize);
223
+ if (className) { this.el.classList.add(className); }
224
+ }
225
+
177
226
  // Sets the offcanvas type
178
227
  setType(offcanvasType: number) {
179
228
  // Parse the class names
180
- OffcanvasClassNames.parse(className => {
229
+ OffcanvasTypesClassNames.parse(className => {
181
230
  // Remove the class names
182
231
  this.el.classList.remove(className);
183
232
  });
184
233
 
185
234
  // Set the class name
186
- let className = OffcanvasClassNames.getByType(offcanvasType) || OffcanvasClassNames.getByType(OffcanvasTypes.End);
235
+ let className = OffcanvasTypesClassNames.getByType(offcanvasType) || OffcanvasTypesClassNames.getByType(OffcanvasTypes.End);
187
236
  this.el.classList.add(className);
188
237
  }
189
238
 
@@ -88,6 +88,9 @@ export interface IOffcanvas {
88
88
  /** Updates the auto close flag. */
89
89
  setAutoClose: (value: boolean) => void;
90
90
 
91
+ /** Updates the size. */
92
+ setSize: (canvasSize: number) => void;
93
+
91
94
  /** Updates the type. */
92
95
  setType: (canvasType: number) => void;
93
96
 
@@ -108,6 +111,7 @@ export interface IOffcanvasProps<T = Element> extends IBaseProps<IOffcanvas> {
108
111
  onRenderBody?: (el?: HTMLDivElement, props?: IOffcanvasProps) => void;
109
112
  onRenderHeader?: (el?: HTMLDivElement, props?: IOffcanvasProps) => void;
110
113
  options?: IOffcanvasOptions;
114
+ size?: number;
111
115
  title?: string | T;
112
116
  type?: number;
113
117
  }
@@ -135,6 +139,22 @@ export interface IOffcanvasOptions {
135
139
  visible?: boolean;
136
140
  }
137
141
 
142
+ /**
143
+ * Offcanvas Size
144
+ */
145
+ export type IOffcanvasSize = {
146
+ Small1: number;
147
+ Small2: number;
148
+ Small3: number;
149
+ Medium1: number;
150
+ Medium2: number;
151
+ Medium3: number;
152
+ Large1: number;
153
+ Large2: number;
154
+ Large3: number;
155
+ Full: number;
156
+ }
157
+
138
158
  /**
139
159
  * Offcanvas Types
140
160
  */
@@ -142,4 +162,5 @@ export type IOffcanvasTypes = {
142
162
  Bottom: number;
143
163
  End: number;
144
164
  Start: number;
165
+ Top: number;
145
166
  }