@ulu/frontend 0.1.0-beta.75 → 0.1.0-beta.77

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/ulu-frontend.min.css +1 -1
  3. package/dist/ulu-frontend.min.js +18 -17
  4. package/docs-dev/assets/main.js +7747 -503
  5. package/docs-dev/assets/style.css +221 -166
  6. package/docs-dev/changelog/index.html +22 -0
  7. package/docs-dev/demos/button/index.html +38 -7
  8. package/docs-dev/demos/card/index.html +16 -16
  9. package/docs-dev/demos/data-table/index.html +100 -100
  10. package/docs-dev/demos/modals/index.html +25 -0
  11. package/docs-dev/demos/popovers/index.html +5 -5
  12. package/docs-dev/javascript/ui-modal-builder/index.html +10 -0
  13. package/docs-dev/javascript/utils-dom/index.html +1 -215
  14. package/docs-dev/sass/components/modal/index.html +38 -10
  15. package/js/ui/dialog.js +1 -1
  16. package/js/ui/modal-builder.js +20 -3
  17. package/js/ui/page.js +2 -2
  18. package/js/ui/print.js +1 -1
  19. package/js/ui/programmatic-modal.js +1 -1
  20. package/js/ui/scrollpoint.js +1 -1
  21. package/js/ui/theme-toggle.js +2 -1
  22. package/js/utils/dom.js +2 -120
  23. package/js/utils/system.js +2 -1
  24. package/package.json +2 -2
  25. package/scss/components/_modal.scss +29 -14
  26. package/types/ui/index.d.ts +1 -1
  27. package/types/ui/modal-builder.d.ts +10 -0
  28. package/types/ui/modal-builder.d.ts.map +1 -1
  29. package/types/ui/theme-toggle.d.ts.map +1 -1
  30. package/types/utils/dom.d.ts +0 -59
  31. package/types/utils/dom.d.ts.map +1 -1
  32. package/types/utils/index.d.ts +1 -1
  33. package/types/utils/system.d.ts.map +1 -1
  34. package/docs-dev/changelog/updates-and-changes/index.html +0 -5109
  35. package/docs-dev/demos/card-new/index.html +0 -5088
  36. package/docs-dev/demos/card-old/index.html +0 -5223
  37. package/docs-dev/demos/card.1/index.html +0 -5223
  38. package/docs-dev/demos/card.TRASH/index.html +0 -5541
  39. package/docs-dev/demos/list-inline.1/index.html +0 -4727
  40. package/docs-dev/guide/updates-and-changes/index.html +0 -5033
@@ -5199,32 +5199,11 @@
5199
5199
  <li><a href="#utils%2Fdom.dataattributetodatasetkey(dataattribute)-%E2%87%92-string">utils/dom.dataAttributeToDatasetKey(dataAttribute) ⇒ string</a>
5200
5200
  </li>
5201
5201
 
5202
- <li><a href="#utils%2Fdom.getdatasetjson(element%2C-key)-%E2%87%92-object">utils/dom.getDatasetJson(element, key) ⇒ Object</a>
5203
- </li>
5204
-
5205
- <li><a href="#utils%2Fdom.getdatasetoptionaljson(element%2C-key)-%E2%87%92-object-%7C-string">utils/dom.getDatasetOptionalJson(element, key) ⇒ Object | String</a>
5206
- </li>
5207
-
5208
- <li><a href="#utils%2Fdom.wasclickoutside()">utils/dom.wasClickOutside()</a>
5209
- </li>
5210
-
5211
5202
  <li><a href="#utils%2Fdom.setpositionclasses(parent%2C-classes)">utils/dom.setPositionClasses(parent, classes)</a>
5212
5203
  </li>
5213
5204
 
5214
- <li><a href="#utils%2Fdom.getelement(target%2C-context)-%E2%87%92-htmlelement">utils/dom.getElement(target, context) ⇒ HTMLElement</a>
5215
- </li>
5216
-
5217
- <li><a href="#utils%2Fdom.getelements(target%2C-context)-%E2%87%92-array">utils/dom.getElements(target, context) ⇒ Array</a>
5218
- </li>
5219
-
5220
5205
  <li><a href="#utils%2Fdom.resolveclasses(input)-%E2%87%92-array.%3Cstring%3E">utils/dom.resolveClasses(input) ⇒ Array.<string></string></a>
5221
5206
  </li>
5222
-
5223
- <li><a href="#utils%2Fdom.addscrollbarproperty(options)">utils/dom.addScrollbarProperty(options)</a>
5224
- </li>
5225
-
5226
- <li><a href="#utils%2Fdom.getscrollbarwidth(%5Belement%5D%2C-%5Bcontainer%5D)-%E2%87%92-number">utils/dom.getScrollbarWidth([element], [container]) ⇒ number</a>
5227
- </li>
5228
5207
  </ol>
5229
5208
  </div>
5230
5209
  </div>
@@ -5242,15 +5221,8 @@
5242
5221
  <li><a href="#module_utils/dom">utils/dom</a>
5243
5222
  <ul>
5244
5223
  <li><a href="#module_utils/dom.dataAttributeToDatasetKey">.dataAttributeToDatasetKey(dataAttribute)</a> ⇒ <code>string</code></li>
5245
- <li><a href="#module_utils/dom.getDatasetJson">.getDatasetJson(element, key)</a> ⇒ <code>Object</code></li>
5246
- <li><a href="#module_utils/dom.getDatasetOptionalJson">.getDatasetOptionalJson(element, key)</a> ⇒ <code>Object</code> | <code>String</code></li>
5247
- <li><a href="#module_utils/dom.wasClickOutside">.wasClickOutside()</a></li>
5248
5224
  <li><a href="#module_utils/dom.setPositionClasses">.setPositionClasses(parent, classes)</a></li>
5249
- <li><a href="#module_utils/dom.getElement">.getElement(target, context)</a> ⇒ <code>HTMLElement</code></li>
5250
- <li><a href="#module_utils/dom.getElements">.getElements(target, context)</a> ⇒ <code>Array</code></li>
5251
5225
  <li><a href="#module_utils/dom.resolveClasses">.resolveClasses(input)</a> ⇒ <code>Array.&lt;string&gt;</code></li>
5252
- <li><a href="#module_utils/dom.addScrollbarProperty">.addScrollbarProperty(options)</a></li>
5253
- <li><a href="#module_utils/dom.getScrollbarWidth">.getScrollbarWidth([element], [container])</a> ⇒ <code>number</code></li>
5254
5226
  </ul>
5255
5227
  </li>
5256
5228
  </ul>
@@ -5275,66 +5247,7 @@
5275
5247
  </tr>
5276
5248
  </tbody>
5277
5249
  </table>
5278
- <p><a name="module_utils/dom.getDatasetJson"></a></p>
5279
- <h2 id="utils%2Fdom.getdatasetjson(element%2C-key)-%E2%87%92-object" tabindex="-1">utils/dom.getDatasetJson(element, key) ⇒ <code>Object</code></h2>
5280
- <p>Get an elements JSON dataset value</p>
5281
- <p><strong>Kind</strong>: static method of <a href="#module_utils/dom"><code>utils/dom</code></a><br>
5282
- <strong>Returns</strong>: <code>Object</code> - Empty object or JSON object from dataset</p>
5283
- <table>
5284
- <thead>
5285
- <tr>
5286
- <th>Param</th>
5287
- <th>Type</th>
5288
- <th>Description</th>
5289
- </tr>
5290
- </thead>
5291
- <tbody>
5292
- <tr>
5293
- <td>element</td>
5294
- <td><code>Node</code></td>
5295
- <td></td>
5296
- </tr>
5297
- <tr>
5298
- <td>key</td>
5299
- <td><code>String</code></td>
5300
- <td>key in dataset object for element</td>
5301
- </tr>
5302
- </tbody>
5303
- </table>
5304
- <p><a name="module_utils/dom.getDatasetOptionalJson"></a></p>
5305
- <h2 id="utils%2Fdom.getdatasetoptionaljson(element%2C-key)-%E2%87%92-object-%7C-string" tabindex="-1">utils/dom.getDatasetOptionalJson(element, key) ⇒ <code>Object</code> | <code>String</code></h2>
5306
- <p>Get an elements JSON dataset value that could potentially just be a single string</p>
5307
- <ul>
5308
- <li>If JSON it will return the object else it will return the value directly</li>
5309
- </ul>
5310
- <p><strong>Kind</strong>: static method of <a href="#module_utils/dom"><code>utils/dom</code></a><br>
5311
- <strong>Returns</strong>: <code>Object</code> | <code>String</code> - JSON object or current dataset value (string or empty string if no value)</p>
5312
- <table>
5313
- <thead>
5314
- <tr>
5315
- <th>Param</th>
5316
- <th>Type</th>
5317
- <th>Description</th>
5318
- </tr>
5319
- </thead>
5320
- <tbody>
5321
- <tr>
5322
- <td>element</td>
5323
- <td><code>Node</code></td>
5324
- <td></td>
5325
- </tr>
5326
- <tr>
5327
- <td>key</td>
5328
- <td><code>String</code></td>
5329
- <td>key in dataset object for element</td>
5330
- </tr>
5331
- </tbody>
5332
- </table>
5333
- <p><a name="module_utils/dom.wasClickOutside"></a></p>
5334
- <h2 id="utils%2Fdom.wasclickoutside()" tabindex="-1">utils/dom.wasClickOutside()</h2>
5335
- <p>Check if a pointer event x/y was outside an elements bounding box</p>
5336
- <p><strong>Kind</strong>: static method of <a href="#module_utils/dom"><code>utils/dom</code></a><br>
5337
- <a name="module_utils/dom.setPositionClasses"></a></p>
5250
+ <p><a name="module_utils/dom.setPositionClasses"></a></p>
5338
5251
  <h2 id="utils%2Fdom.setpositionclasses(parent%2C-classes)" tabindex="-1">utils/dom.setPositionClasses(parent, classes)</h2>
5339
5252
  <p>Sets up the positional classes that would come from the equal
5340
5253
  height module. Needs to be rerun by user when layout changes
@@ -5366,58 +5279,6 @@ or new instances are added to the screen</p>
5366
5279
  </tr>
5367
5280
  </tbody>
5368
5281
  </table>
5369
- <p><a name="module_utils/dom.getElement"></a></p>
5370
- <h2 id="utils%2Fdom.getelement(target%2C-context)-%E2%87%92-htmlelement" tabindex="-1">utils/dom.getElement(target, context) ⇒ <code>HTMLElement</code></h2>
5371
- <p>Resolve a target to Element</p>
5372
- <p><strong>Kind</strong>: static method of <a href="#module_utils/dom"><code>utils/dom</code></a><br>
5373
- <strong>Returns</strong>: <code>HTMLElement</code> - The element or null if not found</p>
5374
- <table>
5375
- <thead>
5376
- <tr>
5377
- <th>Param</th>
5378
- <th>Type</th>
5379
- <th>Description</th>
5380
- </tr>
5381
- </thead>
5382
- <tbody>
5383
- <tr>
5384
- <td>target</td>
5385
- <td><code>String</code> | <code>Node</code></td>
5386
- <td>The selector or node/element</td>
5387
- </tr>
5388
- <tr>
5389
- <td>context</td>
5390
- <td><code>Object</code></td>
5391
- <td>[document] The context to query possible selectors from</td>
5392
- </tr>
5393
- </tbody>
5394
- </table>
5395
- <p><a name="module_utils/dom.getElements"></a></p>
5396
- <h2 id="utils%2Fdom.getelements(target%2C-context)-%E2%87%92-array" tabindex="-1">utils/dom.getElements(target, context) ⇒ <code>Array</code></h2>
5397
- <p>Resolve a target to Elements</p>
5398
- <p><strong>Kind</strong>: static method of <a href="#module_utils/dom"><code>utils/dom</code></a><br>
5399
- <strong>Returns</strong>: <code>Array</code> - The elements or null if not found</p>
5400
- <table>
5401
- <thead>
5402
- <tr>
5403
- <th>Param</th>
5404
- <th>Type</th>
5405
- <th>Description</th>
5406
- </tr>
5407
- </thead>
5408
- <tbody>
5409
- <tr>
5410
- <td>target</td>
5411
- <td><code>String</code> | <code>Node</code></td>
5412
- <td>The selector or node/element</td>
5413
- </tr>
5414
- <tr>
5415
- <td>context</td>
5416
- <td><code>Object</code></td>
5417
- <td>[document] The context to query possible selectors from</td>
5418
- </tr>
5419
- </tbody>
5420
- </table>
5421
5282
  <p><a name="module_utils/dom.resolveClasses"></a></p>
5422
5283
  <h2 id="utils%2Fdom.resolveclasses(input)-%E2%87%92-array.%3Cstring%3E" tabindex="-1">utils/dom.resolveClasses(input) ⇒ <code>Array.&lt;string&gt;</code></h2>
5423
5284
  <p>Resolves a class input (string or array) into a consistent array of class names.</p>
@@ -5443,81 +5304,6 @@ or new instances are added to the screen</p>
5443
5304
  <pre class="language-js"><code class="language-js"><span class="pjs-token pjs-function">resolveClassArray</span><span class="pjs-token pjs-punctuation">(</span><span class="pjs-token pjs-string">"fas fa-check my-class"</span><span class="pjs-token pjs-punctuation">)</span><span class="pjs-token pjs-punctuation">;</span> <span class="pjs-token pjs-comment">// Returns ["fas", "fa-check", "my-class"]</span>
5444
5305
  <span class="pjs-token pjs-function">resolveClassArray</span><span class="pjs-token pjs-punctuation">(</span><span class="pjs-token pjs-punctuation">[</span><span class="pjs-token pjs-string">"another-class"</span><span class="pjs-token pjs-punctuation">,</span> <span class="pjs-token pjs-string">"yet-another-class"</span><span class="pjs-token pjs-punctuation">]</span><span class="pjs-token pjs-punctuation">)</span><span class="pjs-token pjs-punctuation">;</span> <span class="pjs-token pjs-comment">// Returns ["another-class", "yet-another-class"]</span>
5445
5306
  <span class="pjs-token pjs-function">resolveClassArray</span><span class="pjs-token pjs-punctuation">(</span><span class="pjs-token pjs-string">"single-class"</span><span class="pjs-token pjs-punctuation">)</span><span class="pjs-token pjs-punctuation">;</span> <span class="pjs-token pjs-comment">// Returns ["single-class"]</span></code></pre>
5446
- <p><a name="module_utils/dom.addScrollbarProperty"></a></p>
5447
- <h2 id="utils%2Fdom.addscrollbarproperty(options)" tabindex="-1">utils/dom.addScrollbarProperty(options)</h2>
5448
- <p>Sets a CSS custom property equal to the scrollbar width.</p>
5449
- <p><strong>Kind</strong>: static method of <a href="#module_utils/dom"><code>utils/dom</code></a></p>
5450
- <table>
5451
- <thead>
5452
- <tr>
5453
- <th>Param</th>
5454
- <th>Type</th>
5455
- <th>Default</th>
5456
- <th>Description</th>
5457
- </tr>
5458
- </thead>
5459
- <tbody>
5460
- <tr>
5461
- <td>options</td>
5462
- <td><code>object</code></td>
5463
- <td></td>
5464
- <td>Configuration options.</td>
5465
- </tr>
5466
- <tr>
5467
- <td>[options.scrollableChild]</td>
5468
- <td><code>HTMLElement</code></td>
5469
- <td><code>document.body</code></td>
5470
- <td>An element that is a child of a scrollable container (used for width calculation).</td>
5471
- </tr>
5472
- <tr>
5473
- <td>[options.container]</td>
5474
- <td><code>Window</code> | <code>HTMLElement</code></td>
5475
- <td><code>window</code></td>
5476
- <td>The container that can be scrolled (used for width calculation).</td>
5477
- </tr>
5478
- <tr>
5479
- <td>[options.propertyElement]</td>
5480
- <td><code>HTMLElement</code></td>
5481
- <td><code>document.documentElement</code></td>
5482
- <td>The element to which the custom property will be added. Defaults to document.documentElement for :root access.</td>
5483
- </tr>
5484
- <tr>
5485
- <td>[options.propName]</td>
5486
- <td><code>string</code></td>
5487
- <td><code>&quot;&amp;quot;--ulu-scrollbar-width&amp;quot;&quot;</code></td>
5488
- <td>The name of the custom property to set.</td>
5489
- </tr>
5490
- </tbody>
5491
- </table>
5492
- <p><a name="module_utils/dom.getScrollbarWidth"></a></p>
5493
- <h2 id="utils%2Fdom.getscrollbarwidth(%5Belement%5D%2C-%5Bcontainer%5D)-%E2%87%92-number" tabindex="-1">utils/dom.getScrollbarWidth([element], [container]) ⇒ <code>number</code></h2>
5494
- <p>Calculates the width of the scrollbar.</p>
5495
- <p><strong>Kind</strong>: static method of <a href="#module_utils/dom"><code>utils/dom</code></a><br>
5496
- <strong>Returns</strong>: <code>number</code> - The width of the scrollbar in pixels.</p>
5497
- <table>
5498
- <thead>
5499
- <tr>
5500
- <th>Param</th>
5501
- <th>Type</th>
5502
- <th>Default</th>
5503
- <th>Description</th>
5504
- </tr>
5505
- </thead>
5506
- <tbody>
5507
- <tr>
5508
- <td>[element]</td>
5509
- <td><code>HTMLElement</code></td>
5510
- <td><code>document.body</code></td>
5511
- <td>The element that is the child of a scrollable container</td>
5512
- </tr>
5513
- <tr>
5514
- <td>[container]</td>
5515
- <td><code>Window</code> | <code>HTMLElement</code></td>
5516
- <td><code>window</code></td>
5517
- <td>The container that can be scrolled</td>
5518
- </tr>
5519
- </tbody>
5520
- </table>
5521
5307
 
5522
5308
  </div>
5523
5309
  </div>
@@ -5250,8 +5250,8 @@
5250
5250
  <pre class="language-scss"><code class="language-scss"><span class="pjs-token pjs-property"><span class="pjs-token pjs-variable">$config</span></span><span class="pjs-token pjs-punctuation">:</span> <span class="pjs-token pjs-punctuation">(</span>
5251
5251
  <span class="pjs-token pjs-string">"backdrop-color"</span> <span class="pjs-token pjs-punctuation">:</span> <span class="pjs-token pjs-boolean">true</span><span class="pjs-token pjs-punctuation">,</span>
5252
5252
  <span class="pjs-token pjs-string">"backdrop-blur"</span> <span class="pjs-token pjs-punctuation">:</span> 4px<span class="pjs-token pjs-punctuation">,</span>
5253
- <span class="pjs-token pjs-string">"background-color"</span><span class="pjs-token pjs-punctuation">:</span> white<span class="pjs-token pjs-punctuation">,</span>
5254
- <span class="pjs-token pjs-string">"body-padding"</span><span class="pjs-token pjs-punctuation">:</span> 1rem<span class="pjs-token pjs-punctuation">,</span>
5253
+ <span class="pjs-token pjs-string">"background-color"</span> <span class="pjs-token pjs-punctuation">:</span> white<span class="pjs-token pjs-punctuation">,</span>
5254
+ <span class="pjs-token pjs-string">"body-padding"</span> <span class="pjs-token pjs-punctuation">:</span> 1rem<span class="pjs-token pjs-punctuation">,</span>
5255
5255
  <span class="pjs-token pjs-string">"border-radius"</span> <span class="pjs-token pjs-punctuation">:</span> <span class="pjs-token pjs-boolean">true</span><span class="pjs-token pjs-punctuation">,</span>
5256
5256
  <span class="pjs-token pjs-string">"box-shadow"</span> <span class="pjs-token pjs-punctuation">:</span> <span class="pjs-token pjs-boolean">true</span><span class="pjs-token pjs-punctuation">,</span>
5257
5257
  <span class="pjs-token pjs-string">"height"</span><span class="pjs-token pjs-punctuation">:</span> 340px<span class="pjs-token pjs-punctuation">,</span>
@@ -5272,6 +5272,10 @@
5272
5272
  <span class="pjs-token pjs-string">"header-border-bottom"</span><span class="pjs-token pjs-punctuation">:</span> none<span class="pjs-token pjs-punctuation">,</span>
5273
5273
  <span class="pjs-token pjs-string">"header-color"</span><span class="pjs-token pjs-punctuation">:</span> white<span class="pjs-token pjs-punctuation">,</span>
5274
5274
  <span class="pjs-token pjs-string">"header-padding"</span><span class="pjs-token pjs-punctuation">:</span> 1rem<span class="pjs-token pjs-punctuation">,</span>
5275
+ <span class="pjs-token pjs-string">"footer-padding"</span> <span class="pjs-token pjs-punctuation">:</span> <span class="pjs-token pjs-punctuation">(</span>0.5rem 1rem<span class="pjs-token pjs-punctuation">)</span><span class="pjs-token pjs-punctuation">,</span>
5276
+ <span class="pjs-token pjs-string">"footer-background-color"</span> <span class="pjs-token pjs-punctuation">:</span> #f6f6f6<span class="pjs-token pjs-punctuation">,</span>
5277
+ <span class="pjs-token pjs-string">"footer-border-top"</span> <span class="pjs-token pjs-punctuation">:</span> none<span class="pjs-token pjs-punctuation">,</span>
5278
+ <span class="pjs-token pjs-string">"footer-text-align"</span> <span class="pjs-token pjs-punctuation">:</span> right<span class="pjs-token pjs-punctuation">,</span>
5275
5279
  <span class="pjs-token pjs-string">"resizer-background-color"</span><span class="pjs-token pjs-punctuation">:</span> <span class="pjs-token pjs-function">rgb</span><span class="pjs-token pjs-punctuation">(</span>221<span class="pjs-token pjs-punctuation">,</span> 221<span class="pjs-token pjs-punctuation">,</span> 221<span class="pjs-token pjs-punctuation">)</span><span class="pjs-token pjs-punctuation">,</span>
5276
5280
  <span class="pjs-token pjs-string">"resizer-background-color-hover"</span><span class="pjs-token pjs-punctuation">:</span> <span class="pjs-token pjs-function">rgb</span><span class="pjs-token pjs-punctuation">(</span>192<span class="pjs-token pjs-punctuation">,</span> 192<span class="pjs-token pjs-punctuation">,</span> 192<span class="pjs-token pjs-punctuation">)</span><span class="pjs-token pjs-punctuation">,</span>
5277
5281
  <span class="pjs-token pjs-string">"resizer-color"</span><span class="pjs-token pjs-punctuation">:</span> <span class="pjs-token pjs-function">rgb</span><span class="pjs-token pjs-punctuation">(</span>99<span class="pjs-token pjs-punctuation">,</span> 99<span class="pjs-token pjs-punctuation">,</span> 99<span class="pjs-token pjs-punctuation">)</span><span class="pjs-token pjs-punctuation">,</span>
@@ -5294,8 +5298,8 @@
5294
5298
  <li><strong>File:</strong> _modal.scss</li>
5295
5299
  <li><strong>Group:</strong> modal</li>
5296
5300
  <li><strong>Type:</strong> variable</li>
5297
- <li><strong>Lines (comments):</strong> 31-67</li>
5298
- <li><strong>Lines (code):</strong> 69-109</li>
5301
+ <li><strong>Lines (comments):</strong> 31-71</li>
5302
+ <li><strong>Lines (code):</strong> 73-117</li>
5299
5303
  </ul>
5300
5304
  </details>
5301
5305
  <h4 id="map-properties" tabindex="-1">Map Properties</h4>
@@ -5448,6 +5452,30 @@
5448
5452
  <td style="text-align:left">The padding of the modal header.</td>
5449
5453
  </tr>
5450
5454
  <tr>
5455
+ <td style="text-align:left">footer-padding</td>
5456
+ <td style="text-align:left">Dimension</td>
5457
+ <td style="text-align:left">(0.5rem 1rem)</td>
5458
+ <td style="text-align:left">The padding of the modal footer.</td>
5459
+ </tr>
5460
+ <tr>
5461
+ <td style="text-align:left">footer-background-color</td>
5462
+ <td style="text-align:left">Color</td>
5463
+ <td style="text-align:left">(0.5rem 1rem)</td>
5464
+ <td style="text-align:left">The background color of the footer</td>
5465
+ </tr>
5466
+ <tr>
5467
+ <td style="text-align:left">footer-border-top</td>
5468
+ <td style="text-align:left">Color</td>
5469
+ <td style="text-align:left">(0.5rem 1rem)</td>
5470
+ <td style="text-align:left">The border between body and footer</td>
5471
+ </tr>
5472
+ <tr>
5473
+ <td style="text-align:left">footer-text-align</td>
5474
+ <td style="text-align:left">CssValue</td>
5475
+ <td style="text-align:left">right</td>
5476
+ <td style="text-align:left">Text alignment for footer</td>
5477
+ </tr>
5478
+ <tr>
5451
5479
  <td style="text-align:left">resizer-background-color</td>
5452
5480
  <td style="text-align:left">Color</td>
5453
5481
  <td style="text-align:left">rgb(221, 221, 221)</td>
@@ -5535,8 +5563,8 @@
5535
5563
  <li><strong>File:</strong> _modal.scss</li>
5536
5564
  <li><strong>Group:</strong> modal</li>
5537
5565
  <li><strong>Type:</strong> mixin</li>
5538
- <li><strong>Lines (comments):</strong> 111-114</li>
5539
- <li><strong>Lines (code):</strong> 116-118</li>
5566
+ <li><strong>Lines (comments):</strong> 119-122</li>
5567
+ <li><strong>Lines (code):</strong> 124-126</li>
5540
5568
  </ul>
5541
5569
  </details>
5542
5570
  <h4 id="examples" tabindex="-1">Examples</h4>
@@ -5575,8 +5603,8 @@
5575
5603
  <li><strong>File:</strong> _modal.scss</li>
5576
5604
  <li><strong>Group:</strong> modal</li>
5577
5605
  <li><strong>Type:</strong> mixin</li>
5578
- <li><strong>Lines (comments):</strong> 130-132</li>
5579
- <li><strong>Lines (code):</strong> 134-485</li>
5606
+ <li><strong>Lines (comments):</strong> 138-140</li>
5607
+ <li><strong>Lines (code):</strong> 142-500</li>
5580
5608
  </ul>
5581
5609
  </details>
5582
5610
  <h4 id="examples-1" tabindex="-1">Examples</h4>
@@ -5599,8 +5627,8 @@
5599
5627
  <li><strong>File:</strong> _modal.scss</li>
5600
5628
  <li><strong>Group:</strong> modal</li>
5601
5629
  <li><strong>Type:</strong> function</li>
5602
- <li><strong>Lines (comments):</strong> 120-123</li>
5603
- <li><strong>Lines (code):</strong> 125-128</li>
5630
+ <li><strong>Lines (comments):</strong> 128-131</li>
5631
+ <li><strong>Lines (code):</strong> 133-136</li>
5604
5632
  </ul>
5605
5633
  </details>
5606
5634
  <h4 id="examples-2" tabindex="-1">Examples</h4>
package/js/ui/dialog.js CHANGED
@@ -3,7 +3,7 @@
3
3
  */
4
4
 
5
5
  import { ComponentInitializer } from "../utils/system.js";
6
- import { wasClickOutside, getScrollbarWidth } from "../utils/dom.js";
6
+ import { wasClickOutside, getScrollbarWidth } from "@ulu/utils/browser/dom.js";
7
7
  import { pauseVideos as pauseYoutubeVideos, prepVideos as prepYoutubeVideos } from "../utils/pause-youtube-video.js";
8
8
 
9
9
  /**
@@ -6,10 +6,10 @@
6
6
  import { ComponentInitializer } from "../utils/system.js";
7
7
  import { wrapSettingString } from "../settings.js";
8
8
  import { getName } from "../events/index.js";
9
- import { createElementFromHtml } from "@ulu/utils/browser/dom.js";
10
9
  import { Resizer } from "./resizer.js";
11
10
  import { baseAttribute, closeAttribute, defaults as dialogDefaults } from "./dialog.js";
12
-
11
+ import { getElement } from "@ulu/utils/browser/dom.js";
12
+ import { createElementFromHtml } from "@ulu/utils/browser/dom.js";
13
13
 
14
14
  /**
15
15
  * Modal Builder Component Initializer
@@ -42,6 +42,8 @@ export const initializer = new ComponentInitializer({
42
42
  * @property {string} baseClass - The base CSS class for the modal elements. Defaults to `"modal"`.
43
43
  * @property {string} classCloseIcon - The class name for the close icon. Uses the wrapped setting string.
44
44
  * @property {string} classResizerIcon - The class name for the resizer icon. Uses the wrapped setting string.
45
+ * @property {string|Node} footerElement - Element or selector to use as the footer (will be moved to dialog on creation, used for DOM API)
46
+ * @property {string|Node} footerHtml - Markup to use in the footer
45
47
  * @property {boolean} debug - Enables debug logging. Defaults to `false`.
46
48
  * @property {function(object): string} templateCloseIcon - A function that returns the HTML for the close icon.
47
49
  * @property {function(object): string} templateCloseIcon.config - The resolved modal configuration object.
@@ -71,6 +73,8 @@ export const defaults = {
71
73
  noMinHeight: false,
72
74
  class: "",
73
75
  baseClass: "modal",
76
+ footerElement: null,
77
+ footerHtml: null,
74
78
  classCloseIcon: wrapSettingString("iconClassClose"),
75
79
  classResizerIcon: wrapSettingString("iconClassDragX"),
76
80
  debug: false,
@@ -89,7 +93,7 @@ export const defaults = {
89
93
  * @returns {String} Markup for modal
90
94
  */
91
95
  template(id, config) {
92
- const { baseClass, describedby } = config;
96
+ const { baseClass, describedby, footerElement, footerHtml } = config;
93
97
  const classes = [
94
98
  baseClass,
95
99
  `${ baseClass }--${ config.position }`,
@@ -123,6 +127,7 @@ export const defaults = {
123
127
  </header>
124
128
  ` : "" }
125
129
  <div class="${ baseClass }__body" ${ initializer.getAttribute("body") }></div>
130
+ ${ footerHtml ? `<div class="${ baseClass }__footer">${ footerHtml }</div>`: "" }
126
131
  ${ config.hasResizer ?
127
132
  `<div class="${ baseClass }__resizer" ${ initializer.getAttribute("resizer") }>
128
133
  ${ config.templateResizerIcon(config) }
@@ -175,6 +180,8 @@ export function buildModal(content, options) {
175
180
  if (!content.id) {
176
181
  throw new Error("Missing ID on modal");
177
182
  }
183
+
184
+ const { footerHtml, footerElement } = config;
178
185
 
179
186
  const markup = config.template(content.id, config);
180
187
  const modal = createElementFromHtml(markup.trim());
@@ -193,6 +200,16 @@ export function buildModal(content, options) {
193
200
  // Add dialog options for other scripts
194
201
  modal.setAttribute(baseAttribute, JSON.stringify(dialogOptions));
195
202
 
203
+ // If they passed a footer element we need to move it in and
204
+ // make sure it has the class
205
+ if (config.footerElement) {
206
+ const footerElement = getElement(config.footerElement);
207
+ if (footerElement) {
208
+ footerElement.classList.add(`${ config.baseClass }__footer`);
209
+ body.after(footerElement);
210
+ }
211
+ }
212
+
196
213
  if (config.hasResizer) {
197
214
  new Resizer(modal, resizer, {
198
215
  fromLeft: config.position === "right"
package/js/ui/page.js CHANGED
@@ -4,11 +4,11 @@
4
4
  * @module ui/page
5
5
  */
6
6
 
7
- import { addScrollbarProperty } from "../utils/dom";
7
+ import { addScrollbarCustomProperty } from "@ulu/utils/browser/dom.js";
8
8
 
9
9
  /**
10
10
  * Initialize page module
11
11
  */
12
12
  export function init() {
13
- addScrollbarProperty();
13
+ addScrollbarCustomProperty();
14
14
  }
package/js/ui/print.js CHANGED
@@ -3,7 +3,7 @@
3
3
  */
4
4
 
5
5
  import { ComponentInitializer } from "../utils/system.js";
6
- import { getElement } from "../utils/dom.js";
6
+ import { getElement } from "@ulu/utils/browser/dom.js";
7
7
  import { printElement } from "@ulu/utils/browser/print.js";
8
8
 
9
9
  const initializer = new ComponentInitializer({
@@ -5,8 +5,8 @@
5
5
 
6
6
  import { getName, dispatch } from "../events/index.js";
7
7
  import { newId } from "../utils/id.js";
8
- import { getElement } from "../utils/dom.js";
9
8
  import { buildModal } from "./modal-builder.js";
9
+ import { getElement } from "@ulu/utils/browser/dom.js";
10
10
 
11
11
  export class ProgrammaticModalManager {
12
12
  static defaults = {
@@ -5,7 +5,7 @@
5
5
 
6
6
  import { ComponentInitializer } from "../utils/system.js";
7
7
  import { logError } from "../utils/class-logger.js";
8
- import { getElement } from "../utils/dom.js";
8
+ import { getElement } from "@ulu/utils/browser/dom.js";
9
9
 
10
10
  // TODO:
11
11
  // - Included a group option or attribute (on container), for things like anchor menus (one active in group at a time).
@@ -4,8 +4,9 @@
4
4
 
5
5
  import { ComponentInitializer } from "../utils/system.js";
6
6
  import { getName } from "../events/index.js";
7
- import { getElements, resolveClasses } from "../utils/dom.js";
7
+ import { resolveClasses } from "../utils/dom.js";
8
8
  import { hasRequiredProps } from "@ulu/utils/object.js";
9
+ import { getElements } from "@ulu/utils/browser/dom.js";
9
10
 
10
11
  /**
11
12
  * Theme Toggle Component Initializer
package/js/utils/dom.js CHANGED
@@ -2,8 +2,7 @@
2
2
  * @module utils/dom
3
3
  */
4
4
 
5
-
6
- export const regexJsonString = /^[{\[][\s\S]*[}\]]$/;
5
+ import { kebabToCamel } from "@ulu/utils/string.js";
7
6
 
8
7
  /**
9
8
  * Converts a data attribute name to its corresponding dataset property name.
@@ -11,56 +10,9 @@ export const regexJsonString = /^[{\[][\s\S]*[}\]]$/;
11
10
  * @returns {string} - The dataset property name (e.g., "uluDialog").
12
11
  */
13
12
  export function dataAttributeToDatasetKey(attribute) {
14
- // Remove "data-" prefix then convert kebab-case to camelCase
15
- return attribute
16
- .replace(/^data-/, "")
17
- .replace(/-([a-z])/g, (_match, letter) => letter.toUpperCase());
18
- }
19
-
20
- /**
21
- * Get an elements JSON dataset value
22
- * @param {Node} element
23
- * @param {String} key key in dataset object for element
24
- * @returns {Object} Empty object or JSON object from dataset
25
- */
26
- export function getDatasetJson(element, key) {
27
- const passed = element.dataset[key];
28
- try {
29
- return JSON.parse(passed);
30
- } catch (error) {
31
- console.error(`Error getting JSON from dataset (${ key }) -- "${ passed }"\n`, element, error);
32
- return {};
33
- }
34
- }
35
-
36
- /**
37
- * Get an elements JSON dataset value that could potentially just be a single string
38
- * - If JSON it will return the object else it will return the value directly
39
- * @param {Node} element
40
- * @param {String} key key in dataset object for element
41
- * @returns {Object|String} JSON object or current dataset value (string or empty string if no value)
42
- */
43
- export function getDatasetOptionalJson(element, key) {
44
- const passed = element.dataset[key];
45
- if (passed && regexJsonString.test(passed.trim())) {
46
- return getDatasetJson(element, key);
47
- } else {
48
- return passed;
49
- }
13
+ return kebabToCamel(attribute.replace(/^data-/, ""));
50
14
  }
51
15
 
52
- /**
53
- * Check if a pointer event x/y was outside an elements bounding box
54
- */
55
- export function wasClickOutside(element, event) {
56
- const rect = element.getBoundingClientRect();
57
- return (event.clientY < rect.top || // above
58
- event.clientY > rect.top + rect.height || // below
59
- event.clientX < rect.left || // left side
60
- event.clientX > rect.left + rect.width); // right side
61
- }
62
-
63
-
64
16
  /**
65
17
  * Sets up the positional classes that would come from the equal
66
18
  * height module. Needs to be rerun by user when layout changes
@@ -106,42 +58,6 @@ export function setPositionClasses(parent, classes = {
106
58
  });
107
59
  }
108
60
 
109
- /**
110
- * Resolve a target to Element
111
- * @param {String|Node} target The selector or node/element
112
- * @param {Object} context [document] The context to query possible selectors from
113
- * @return {HTMLElement} The element or null if not found
114
- */
115
- export function getElement(target, context = document) {
116
- if (typeof target === "string") {
117
- return context.querySelector(target);
118
- } else if (target instanceof Element) {
119
- return target;
120
- } else {
121
- console.warn("getElement: Invalid target type (expected String/Node)", target);
122
- return null;
123
- }
124
- }
125
-
126
- /**
127
- * Resolve a target to Elements
128
- * @param {String|Node} target The selector or node/element
129
- * @param {Object} context [document] The context to query possible selectors from
130
- * @return {Array} The elements or null if not found
131
- */
132
- export function getElements(target, context = document) {
133
- if (typeof target === "string") {
134
- return [...context.querySelectorAll(target)];
135
- } else if (target instanceof Element) {
136
- return [target];
137
- } else if (Array.isArray(target) || target instanceof NodeList) {
138
- return [...target];
139
- } else {
140
- console.warn("getElement: Invalid target type (expected String/Node/Array/Node List)", target);
141
- return null;
142
- }
143
- }
144
-
145
61
  /**
146
62
  * Resolves a class input (string or array) into a consistent array of class names.
147
63
  * @param {string|string[]} input - The class input, which can be a string, an array of strings, or any other value.
@@ -163,37 +79,3 @@ export function resolveClasses(classes) {
163
79
  return [];
164
80
  }
165
81
  }
166
-
167
- /**
168
- * Sets a CSS custom property equal to the scrollbar width.
169
- * @param {object} options - Configuration options.
170
- * @param {HTMLElement} [options.scrollableChild=document.body] - An element that is a child of a scrollable container (used for width calculation).
171
- * @param {Window|HTMLElement} [options.container=window] - The container that can be scrolled (used for width calculation).
172
- * @param {HTMLElement} [options.propertyElement=document.documentElement] - The element to which the custom property will be added. Defaults to document.documentElement for :root access.
173
- * @param {string} [options.propName="--ulu-scrollbar-width"] - The name of the custom property to set.
174
- */
175
- export function addScrollbarProperty(options) {
176
- const defaults = {
177
- scrollableChild: document.body,
178
- container: window,
179
- propertyElement: document.documentElement,
180
- propName: "--ulu-scrollbar-width",
181
- };
182
-
183
- const config = { ...defaults, ...options };
184
- const { scrollableChild, container, propertyElement, propName } = config;
185
-
186
- const scrollbarWidth = getScrollbarWidth(scrollableChild, container);
187
- propertyElement.style.setProperty(propName, `${ scrollbarWidth }px`);
188
- }
189
-
190
- /**
191
- * Calculates the width of the scrollbar.
192
- *
193
- * @param {HTMLElement} [element=document.body] -The element that is the child of a scrollable container
194
- * @param {Window|HTMLElement} [container=window] - The container that can be scrolled
195
- * @returns {number} The width of the scrollbar in pixels.
196
- */
197
- export function getScrollbarWidth(element = document.body, container = window) {
198
- return container.innerWidth - element.clientWidth;
199
- }