gd-bs 6.2.4 → 6.2.6

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/generateIcons.js CHANGED
@@ -150,6 +150,8 @@ fs.readdir(dirIcons, function (err, files) {
150
150
  '\t icon.classList.add(classNames[i]);',
151
151
  '\t }',
152
152
  '\t }\n',
153
+ '\t // Make this icon invisible to the screen reader',
154
+ '\t icon.setAttribute("aria-hidden", "true");\n',
153
155
  '\t // Set the height/width',
154
156
  '\t icon.setAttribute("height", (height ? height : 32).toString());',
155
157
  '\t icon.setAttribute("width", (width ? width : 32).toString());\n',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gd-bs",
3
- "version": "6.2.4",
3
+ "version": "6.2.6",
4
4
  "description": "Bootstrap JavaScript, TypeScript and Web Components library.",
5
5
  "main": "build/index.js",
6
6
  "typings": "src/index.d.ts",
@@ -36,7 +36,7 @@
36
36
  "@popperjs/core": "^2.11.8",
37
37
  "bootstrap": "^5.3.1",
38
38
  "bootstrap-icons": "^1.10.5",
39
- "core-js": "^3.32.0",
39
+ "core-js": "^3.32.1",
40
40
  "tippy.js": "^6.3.7"
41
41
  },
42
42
  "devDependencies": {
package/pnpm-lock.yaml CHANGED
@@ -2,7 +2,7 @@ dependencies:
2
2
  '@popperjs/core': 2.11.8
3
3
  bootstrap: 5.3.1_@popperjs+core@2.11.8
4
4
  bootstrap-icons: 1.10.5
5
- core-js: 3.32.0
5
+ core-js: 3.32.1
6
6
  tippy.js: 6.3.7
7
7
  devDependencies:
8
8
  '@babel/core': 7.19.3
@@ -1834,11 +1834,11 @@ packages:
1834
1834
  dev: true
1835
1835
  resolution:
1836
1836
  integrity: sha512-ovcyhs2DEBUIE0MGEKHP4olCUW/XYte3Vroyxuh38rD1wAO4dHohsovUC4eAOuzFxE6b+RXvBU3UZ9o0YhUTkA==
1837
- /core-js/3.32.0:
1837
+ /core-js/3.32.1:
1838
1838
  dev: false
1839
1839
  requiresBuild: true
1840
1840
  resolution:
1841
- integrity: sha512-rd4rYZNlF3WuoYuRIDEmbR/ga9CeuWX9U05umAvgrrZoHY4Z++cp/xwPQMvUpBB4Ag6J8KfD80G0zwCyaSxDww==
1841
+ integrity: sha512-lqufgNn9NLnESg5mQeYsxQP5w7wrViSj0jr/kv6ECQiByzQkrn1MKvV0L3acttpDqfQrHLwr2KCMgX5b8X+lyQ==
1842
1842
  /cosmiconfig/8.2.0:
1843
1843
  dependencies:
1844
1844
  import-fresh: 3.3.0
@@ -3284,7 +3284,7 @@ specifiers:
3284
3284
  babel-loader: ^9.1.2
3285
3285
  bootstrap: ^5.3.1
3286
3286
  bootstrap-icons: ^1.10.5
3287
- core-js: ^3.32.0
3287
+ core-js: ^3.32.1
3288
3288
  css-loader: ^6.7.3
3289
3289
  dts-bundle: ^0.7.3
3290
3290
  postcss-loader: ^7.3.3
@@ -84,6 +84,10 @@ class _Button extends Base<IButtonProps> implements IButton {
84
84
  // Set the default type
85
85
  this.setType(this.props.type || ButtonTypes.Primary)
86
86
 
87
+ // Set the aria label/description
88
+ this.props.description ? this.el.setAttribute("aria-description", this.props.description) : null;
89
+ this.el.setAttribute("aria-label", this.props.label || this.props.text);
90
+
87
91
  // Set the attributes
88
92
  this.props.dismiss ? this.el.setAttribute("data-bs-dismiss", this.props.dismiss) : null;
89
93
  this.props.href ? this.el.href = this.props.href : null;
@@ -86,6 +86,7 @@ export interface IButtonProps extends IBaseProps<IButton> {
86
86
  badge?: IBadgeProps;
87
87
  controls?: string | Array<string>;
88
88
  data?: any;
89
+ description?: string;
89
90
  dismiss?: string;
90
91
  href?: string;
91
92
  iconClassName?: string;
@@ -98,6 +99,7 @@ export interface IButtonProps extends IBaseProps<IButton> {
98
99
  isLarge?: boolean;
99
100
  isLink?: boolean;
100
101
  isSmall?: boolean;
102
+ label?: string;
101
103
  onClick?: (button?: IButtonProps, ev?: Event) => void;
102
104
  spinnerProps?: ISpinnerProps;
103
105
  tabIndex?: number;
@@ -124,6 +124,7 @@ class _Dropdown extends Base<IDropdownProps> implements IDropdown {
124
124
  if (toggle) {
125
125
  toggle.classList.add(btnType);
126
126
  toggle.disabled = this.props.isReadonly ? true : false;
127
+ toggle.setAttribute("aria-label", this.props.label || "");
127
128
  }
128
129
 
129
130
  // See if we are rendering the menu only
@@ -502,6 +503,16 @@ class _Dropdown extends Base<IDropdownProps> implements IDropdown {
502
503
  }
503
504
  }
504
505
 
506
+ // Sets the label of the dropdown
507
+ setLabel(value: string) {
508
+ // Get the dropdown
509
+ let ddl = this.el.querySelector(".dropdown-toggle");
510
+ if (ddl) {
511
+ // Set the inner html
512
+ ddl.innerHTML = value;
513
+ }
514
+ }
515
+
505
516
  // Enables/Disables the dark theme
506
517
  setTheme(isDark: boolean) {
507
518
  // Get the menu
@@ -83,6 +83,9 @@ export interface IDropdown {
83
83
  /** Updates the dropdown items. */
84
84
  setItems: (items: Array<IDropdownItem>) => void;
85
85
 
86
+ /** Updates the label of the dropdown. */
87
+ setLabel: (value: string) => void;
88
+
86
89
  /** Enables/Disables the dark theme. */
87
90
  setTheme: (isDark: boolean) => void;
88
91
 
@@ -144,7 +147,6 @@ export interface IDropdownProps extends IBaseProps<IDropdown> {
144
147
  onChange?: (item?: IDropdownItem | Array<IDropdownItem>, ev?: Event) => void;
145
148
  onMenuRendering?: (props: IPopoverProps) => IPopoverProps;
146
149
  required?: boolean;
147
- setLabelToValue?: boolean;
148
150
  title?: string;
149
151
  type?: number;
150
152
  value?: any;
@@ -99,7 +99,7 @@ export class FormControl implements IFormControl {
99
99
  // Creates the control
100
100
  private create() {
101
101
  // Parse the custom classes to add
102
- let className = [(this._props.className || ""), (this._props.controlClassName || "")].join(" ").trim();
102
+ let className = this._props.controlClassName || "";
103
103
 
104
104
  // Set the value
105
105
  let formValue = this._formProps.value ? this._formProps.value[this._props.name] : null;
@@ -96,6 +96,15 @@ export class FormGroup {
96
96
  elDescription = null;
97
97
  }
98
98
 
99
+ // Set the class name
100
+ if (this._props.className) {
101
+ // Set the class
102
+ this._el.className = [
103
+ this._el.className || "",
104
+ this._props.className
105
+ ].join(' ').trim();
106
+ }
107
+
99
108
  // Create the control
100
109
  this._control = new FormControl(this._props, this._formProps, elLabel);
101
110
 
@@ -71,6 +71,12 @@ class _Tooltip extends Base<ITooltipProps> {
71
71
  let btnProps = this.props.btnProps || {};
72
72
  btnProps.type = btnProps.type || ButtonTypes.OutlineSecondary
73
73
 
74
+ // See if the content is text
75
+ if (typeof (this.props.content) === "string") {
76
+ // Set the label
77
+ btnProps.description = this.props.content;
78
+ }
79
+
74
80
  // Create the button
75
81
  this._btn = Button(btnProps);
76
82
 
@@ -15,6 +15,9 @@ export const generateIcon = (svg: string, height: number = 32, width: number = 3
15
15
  }
16
16
  }
17
17
 
18
+ // Make this icon invisible to the screen reader
19
+ icon.setAttribute("aria-hidden", "true");
20
+
18
21
  // Set the height/width
19
22
  icon.setAttribute("height", (height ? height : 32).toString());
20
23
  icon.setAttribute("width", (width ? width : 32).toString());