@ulu/frontend 0.1.0-beta.72 → 0.1.0-beta.74

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.
@@ -5378,6 +5378,11 @@ in twig for example)</li>
5378
5378
  <td>Extra class/classes to add to title</td>
5379
5379
  </tr>
5380
5380
  <tr>
5381
+ <td>titleId</td>
5382
+ <td><code>string</code></td>
5383
+ <td>Set the title id (to tie to a custom title implementation, if using built in title this will be set automatically)</td>
5384
+ </tr>
5385
+ <tr>
5381
5386
  <td>nonModal</td>
5382
5387
  <td><code>boolean</code></td>
5383
5388
  <td>If <code>true</code>, the modal will not prevent interaction with elements behind it. Defaults to <code>false</code>.</td>
@@ -10,6 +10,7 @@ import { createElementFromHtml } from "@ulu/utils/browser/dom.js";
10
10
  import { Resizer } from "./resizer.js";
11
11
  import { baseAttribute, closeAttribute, defaults as dialogDefaults } from "./dialog.js";
12
12
 
13
+
13
14
  /**
14
15
  * Modal Builder Component Initializer
15
16
  */
@@ -27,6 +28,7 @@ export const initializer = new ComponentInitializer({
27
28
  * @property {string|null} title - The title of the modal. Defaults to `null`.
28
29
  * @property {string|null} titleIcon - The class name for an icon to display in the title. Defaults to `null`.
29
30
  * @property {string} titleClass - Extra class/classes to add to title
31
+ * @property {string} titleId - Set the title id (to tie to a custom title implementation, if using built in title this will be set automatically)
30
32
  * @property {boolean} nonModal - If `true`, the modal will not prevent interaction with elements behind it. Defaults to `false`.
31
33
  * @property {boolean} documentEnd - If `true`, the modal will be appended to the end of the `document.body`. Defaults to `true`.
32
34
  * @property {boolean} allowResize - If `true`, the modal will be resizable. Defaults to `false`.
@@ -56,6 +58,8 @@ export const defaults = {
56
58
  title: null,
57
59
  titleIcon: null,
58
60
  titleClass: "",
61
+ labelledby: null,
62
+ describedby: null,
59
63
  nonModal: false,
60
64
  documentEnd: true,
61
65
  allowResize: false,
@@ -85,7 +89,7 @@ export const defaults = {
85
89
  * @returns {String} Markup for modal
86
90
  */
87
91
  template(id, config) {
88
- const { baseClass } = config;
92
+ const { baseClass, describedby } = config;
89
93
  const classes = [
90
94
  baseClass,
91
95
  `${ baseClass }--${ config.position }`,
@@ -97,11 +101,17 @@ export const defaults = {
97
101
  ...(config.noMinHeight ? [`${ baseClass }--no-min-height`] : [] ),
98
102
  ...(config.class ? [config.class] : []),
99
103
  ];
104
+ const labelledby = config.title ? `${ id }--title` : config.labelledby;
100
105
  return `
101
- <dialog id="${ id }" class="${ classes.join(" ") }">
106
+ <dialog
107
+ id="${ id }"
108
+ class="${ classes.join(" ") }"
109
+ ${ labelledby ? `aria-labelledby="${ labelledby }"` : "" }
110
+ ${ describedby ? `aria-describedby="${ describedby }"` : "" }
111
+ >
102
112
  ${ config.title ? `
103
113
  <header class="${ baseClass }__header">
104
- <h2 class="${ baseClass }__title ${ config.titleClass }">
114
+ <h2 id="${ labelledby }" class="${ baseClass }__title ${ config.titleClass }">
105
115
  ${ config.titleIcon ?
106
116
  `<span class="${ baseClass }__title-icon ${ config.titleIcon }" aria-hidden="true"></span>` : ""
107
117
  }
@@ -118,7 +128,7 @@ export const defaults = {
118
128
  ${ config.templateResizerIcon(config) }
119
129
  </div>` : ""
120
130
  }
121
- </div>
131
+ </dialog>
122
132
  `;
123
133
  }
124
134
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ulu/frontend",
3
- "version": "0.1.0-beta.72",
3
+ "version": "0.1.0-beta.74",
4
4
  "description": "A versatile SCSS and JavaScript component library offering configurable, accessible components and flexible integration into any project, with SCSS modules suitable for modern JS frameworks.",
5
5
  "browser": "js/index.js",
6
6
  "main": "index.js",
@@ -20,5 +20,5 @@ export * as printDetails from "./print-details.js";
20
20
  export * as scrollSlider from "./scroll-slider.js";
21
21
  export * as themeToggle from "./theme-toggle.js";
22
22
  export * as detailsGroup from "./details-group.js";
23
- declare namespace ___Users_joe_Projects_Personal_Github_frontend_js_ui_index_ { }
23
+ declare namespace ___Users_joescherben_Personal_Projects_ULU_frontend_js_ui_index_ { }
24
24
  //# sourceMappingURL=index.d.ts.map
@@ -23,6 +23,8 @@ export namespace defaults {
23
23
  export let title: any;
24
24
  export let titleIcon: any;
25
25
  export let titleClass: string;
26
+ export let labelledby: any;
27
+ export let describedby: any;
26
28
  export let nonModal: boolean;
27
29
  export let documentEnd: boolean;
28
30
  export let allowResize: boolean;
@@ -67,6 +69,10 @@ export type DefaultModalOptions = {
67
69
  * - Extra class/classes to add to title
68
70
  */
69
71
  titleClass: string;
72
+ /**
73
+ * - Set the title id (to tie to a custom title implementation, if using built in title this will be set automatically)
74
+ */
75
+ titleId: string;
70
76
  /**
71
77
  * - If `true`, the modal will not prevent interaction with elements behind it. Defaults to `false`.
72
78
  */
@@ -1 +1 @@
1
- {"version":3,"file":"modal-builder.d.ts","sourceRoot":"","sources":["../../js/ui/modal-builder.js"],"names":[],"mappings":"AAgIA;;GAEG;AACH,gDAEC;AAED;;;GAGG;AACH,6BAQC;AAED;;;;GAIG;AACH,oCAHW,IAAI;;EAmDd;AA9LD;;GAEG;AACH,+CAGG;;;;;;;;;;;;;;;;;;;;IAsDD,uDAGC;IACD,yDAGC;IACD;;;;;OAKG;IACH,0DAoCC;;;;;;;;;;;;WAhGW,MAAM,GAAC,IAAI;;;;eACX,MAAM,GAAC,IAAI;;;;gBACX,MAAM;;;;cACN,OAAO;;;;iBACP,OAAO;;;;iBACP,OAAO;;;;cACP,QAAQ,GAAC,UAAU,GAAC,YAAY,GAAC,WAAW,GAAC,aAAa,GAAC,eAAe,GAAC,cAAc;;;;eACzF,OAAO;;;;gBACP,OAAO;;;;UACP,SAAS,GAAC,OAAO,GAAC,OAAO,GAAC,YAAY;;;;WACtC,OAAO;;;;iBACP,OAAO;;;;WACP,MAAM;;;;eACN,MAAM;;;;oBACN,MAAM;;;;sBACN,MAAM;;;;WACN,OAAO;;;;8BACE,MAAM,KAAG,MAAM;;;;mBACf,MAAM,KAAG,MAAM;;qCAvCD,oBAAoB"}
1
+ {"version":3,"file":"modal-builder.d.ts","sourceRoot":"","sources":["../../js/ui/modal-builder.js"],"names":[],"mappings":"AA0IA;;GAEG;AACH,gDAEC;AAED;;;GAGG;AACH,6BAQC;AAED;;;;GAIG;AACH,oCAHW,IAAI;;EAmDd;AAvMD;;GAEG;AACH,+CAGG;;;;;;;;;;;;;;;;;;;;;;IAyDD,uDAGC;IACD,yDAGC;IACD;;;;;OAKG;IACH,0DA0CC;;;;;;;;;;;;WAzGW,MAAM,GAAC,IAAI;;;;eACX,MAAM,GAAC,IAAI;;;;gBACX,MAAM;;;;aACN,MAAM;;;;cACN,OAAO;;;;iBACP,OAAO;;;;iBACP,OAAO;;;;cACP,QAAQ,GAAC,UAAU,GAAC,YAAY,GAAC,WAAW,GAAC,aAAa,GAAC,eAAe,GAAC,cAAc;;;;eACzF,OAAO;;;;gBACP,OAAO;;;;UACP,SAAS,GAAC,OAAO,GAAC,OAAO,GAAC,YAAY;;;;WACtC,OAAO;;;;iBACP,OAAO;;;;WACP,MAAM;;;;eACN,MAAM;;;;oBACN,MAAM;;;;sBACN,MAAM;;;;WACN,OAAO;;;;8BACE,MAAM,KAAG,MAAM;;;;mBACf,MAAM,KAAG,MAAM;;qCAzCD,oBAAoB"}
@@ -6,5 +6,5 @@ export * as index from "./index.js";
6
6
  export * as pauseYoutubeVideo from "./pause-youtube-video.js";
7
7
  export * as fileSave from "./file-save.js";
8
8
  export * as fontAwesome from "./font-awesome.js";
9
- declare namespace ___Users_joe_Projects_Personal_Github_frontend_js_utils_index_ { }
9
+ declare namespace ___Users_joescherben_Personal_Projects_ULU_frontend_js_utils_index_ { }
10
10
  //# sourceMappingURL=index.d.ts.map