@ulu/frontend 0.1.0-beta.32 → 0.1.0-beta.34
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/CHANGELOG.md +53 -0
- package/dist/ulu-frontend.min.css +1 -1
- package/dist/ulu-frontend.min.js +23 -23
- package/docs-dev/changelog/index.html +161 -8
- package/docs-dev/demos/accordion/index.html +38 -8
- package/docs-dev/demos/button/index.html +38 -8
- package/docs-dev/demos/button-verbose/index.html +38 -8
- package/docs-dev/demos/callout/index.html +65 -8
- package/docs-dev/demos/captioned-figure/index.html +38 -8
- package/docs-dev/demos/card/index.html +59 -33
- package/docs-dev/demos/card-grid/index.html +42 -12
- package/docs-dev/demos/css-icons/index.html +38 -8
- package/docs-dev/demos/data-grid/index.html +38 -8
- package/docs-dev/demos/data-table/index.html +63 -33
- package/docs-dev/demos/details-group/index.html +71 -8
- package/docs-dev/demos/file-save/index.html +38 -8
- package/docs-dev/demos/flipcard/index.html +38 -8
- package/docs-dev/demos/form-theme/index.html +38 -8
- package/docs-dev/demos/index.html +38 -8
- package/docs-dev/demos/list-inline/index.html +38 -8
- package/docs-dev/demos/list-lines/index.html +38 -8
- package/docs-dev/demos/menu-stack/index.html +38 -8
- package/docs-dev/demos/modals/index.html +51 -10
- package/docs-dev/demos/nav-strip/index.html +38 -8
- package/docs-dev/demos/overlay-section/index.html +38 -8
- package/docs-dev/demos/popovers/index.html +38 -8
- package/docs-dev/demos/print/index.html +38 -8
- package/docs-dev/demos/pull-quote/index.html +38 -8
- package/docs-dev/demos/rule/index.html +38 -8
- package/docs-dev/demos/scrollpoints/index.html +39 -9
- package/docs-dev/demos/spoke-spinner/index.html +38 -8
- package/docs-dev/demos/sticky-list/index.html +38 -8
- package/docs-dev/demos/tabs/index.html +74 -8
- package/docs-dev/demos/tag/index.html +38 -8
- package/docs-dev/demos/theme-toggle/index.html +38 -8
- package/docs-dev/demos/tiles/index.html +38 -8
- package/docs-dev/demos/tooltip/index.html +38 -8
- package/docs-dev/guide/building-stylesheet/index.html +38 -8
- package/docs-dev/guide/developing-ulu-scss-module/index.html +38 -8
- package/docs-dev/guide/index.html +38 -8
- package/docs-dev/index.html +38 -8
- package/docs-dev/javascript/events/index.html +38 -8
- package/docs-dev/javascript/index.html +38 -8
- package/docs-dev/javascript/settings/index.html +38 -8
- package/docs-dev/javascript/ui-breakpoints/index.html +38 -8
- package/docs-dev/javascript/ui-collapsible/index.html +38 -8
- package/docs-dev/javascript/ui-details-group/index.html +56 -38
- package/docs-dev/javascript/ui-dialog/index.html +70 -25
- package/docs-dev/javascript/ui-flipcard/index.html +99 -13
- package/docs-dev/javascript/ui-grid/index.html +48 -44
- package/docs-dev/javascript/ui-modal-builder/index.html +49 -40
- package/docs-dev/javascript/ui-overflow-scroller/index.html +38 -8
- package/docs-dev/javascript/ui-overflow-scroller-pager/index.html +38 -8
- package/docs-dev/javascript/ui-page/index.html +38 -8
- package/docs-dev/javascript/ui-popover/index.html +46 -20
- package/docs-dev/javascript/ui-print/index.html +38 -16
- package/docs-dev/javascript/ui-print-details/index.html +38 -8
- package/docs-dev/javascript/ui-programmatic-modal/index.html +38 -8
- package/docs-dev/javascript/ui-proxy-click/index.html +125 -10
- package/docs-dev/javascript/ui-resizer/index.html +38 -8
- package/docs-dev/javascript/ui-scroll-slider/index.html +76 -14
- package/docs-dev/javascript/ui-scrollpoint/index.html +44 -21
- package/docs-dev/javascript/ui-slider/index.html +234 -13
- package/docs-dev/javascript/ui-tabs/index.html +49 -56
- package/docs-dev/javascript/ui-theme-toggle/index.html +43 -21
- package/docs-dev/javascript/ui-tooltip/index.html +45 -19
- package/docs-dev/javascript/utils-class-logger/index.html +38 -8
- package/docs-dev/javascript/utils-dom/index.html +63 -8
- package/docs-dev/javascript/utils-file-save/index.html +38 -8
- package/docs-dev/javascript/utils-floating-ui/index.html +38 -8
- package/docs-dev/javascript/utils-id/index.html +38 -8
- package/docs-dev/javascript/utils-pause-youtube-video/index.html +38 -8
- package/docs-dev/javascript/utils-system/index.html +5437 -0
- package/docs-dev/sass/base/color/index.html +38 -8
- package/docs-dev/sass/base/elements/index.html +38 -8
- package/docs-dev/sass/base/index/index.html +38 -8
- package/docs-dev/sass/base/index.html +38 -8
- package/docs-dev/sass/base/keyframes/index.html +38 -8
- package/docs-dev/sass/base/layout/index.html +38 -8
- package/docs-dev/sass/base/normalize/index.html +38 -8
- package/docs-dev/sass/base/print/index.html +38 -8
- package/docs-dev/sass/base/root/index.html +38 -8
- package/docs-dev/sass/base/typography/index.html +38 -8
- package/docs-dev/sass/components/accordion/index.html +39 -9
- package/docs-dev/sass/components/adaptive-spacing/index.html +38 -8
- package/docs-dev/sass/components/badge/index.html +38 -8
- package/docs-dev/sass/components/basic-hero/index.html +38 -8
- package/docs-dev/sass/components/button/index.html +38 -8
- package/docs-dev/sass/components/button-verbose/index.html +72 -37
- package/docs-dev/sass/components/callout/index.html +124 -35
- package/docs-dev/sass/components/captioned-figure/index.html +38 -8
- package/docs-dev/sass/components/card/index.html +38 -8
- package/docs-dev/sass/components/card-grid/index.html +38 -8
- package/docs-dev/sass/components/css-icon/index.html +38 -8
- package/docs-dev/sass/components/data-grid/index.html +38 -8
- package/docs-dev/sass/components/data-table/index.html +53 -16
- package/docs-dev/sass/components/fill-context/index.html +38 -8
- package/docs-dev/sass/components/flipcard/index.html +38 -8
- package/docs-dev/sass/components/flipcard-grid/index.html +38 -8
- package/docs-dev/sass/components/form-theme/index.html +84 -60
- package/docs-dev/sass/components/hero/index.html +38 -8
- package/docs-dev/sass/components/horizontal-rule/index.html +38 -8
- package/docs-dev/sass/components/image-grid/index.html +38 -8
- package/docs-dev/sass/components/index/index.html +38 -8
- package/docs-dev/sass/components/index.html +38 -8
- package/docs-dev/sass/components/links/index.html +38 -8
- package/docs-dev/sass/components/list-inline/index.html +38 -8
- package/docs-dev/sass/components/list-lines/index.html +38 -8
- package/docs-dev/sass/components/list-ordered/index.html +38 -8
- package/docs-dev/sass/components/list-unordered/index.html +38 -8
- package/docs-dev/sass/components/menu-stack/index.html +38 -8
- package/docs-dev/sass/components/modal/index.html +38 -8
- package/docs-dev/sass/components/nav-strip/index.html +38 -8
- package/docs-dev/sass/components/overlay-section/index.html +38 -8
- package/docs-dev/sass/components/pager/index.html +38 -8
- package/docs-dev/sass/components/placeholder-block/index.html +38 -8
- package/docs-dev/sass/components/popover/index.html +38 -8
- package/docs-dev/sass/components/pull-quote/index.html +38 -8
- package/docs-dev/sass/components/ratio-box/index.html +38 -8
- package/docs-dev/sass/components/rule/index.html +38 -8
- package/docs-dev/sass/components/scroll-slider/index.html +46 -28
- package/docs-dev/sass/components/skip-link/index.html +38 -8
- package/docs-dev/sass/components/slider/index.html +38 -8
- package/docs-dev/sass/components/spoke-spinner/index.html +40 -10
- package/docs-dev/sass/components/sticky-list/index.html +38 -8
- package/docs-dev/sass/components/tabs/index.html +38 -8
- package/docs-dev/sass/components/tag/index.html +40 -10
- package/docs-dev/sass/components/tile-button/index.html +38 -8
- package/docs-dev/sass/components/tile-grid/index.html +38 -8
- package/docs-dev/sass/components/tile-grid-overlay/index.html +38 -8
- package/docs-dev/sass/components/vignette/index.html +38 -8
- package/docs-dev/sass/components/wysiwyg/index.html +38 -8
- package/docs-dev/sass/core/breakpoint/index.html +38 -8
- package/docs-dev/sass/core/button/index.html +38 -8
- package/docs-dev/sass/core/color/index.html +38 -8
- package/docs-dev/sass/core/cssvar/index.html +38 -8
- package/docs-dev/sass/core/element/index.html +218 -47
- package/docs-dev/sass/core/index.html +38 -8
- package/docs-dev/sass/core/layout/index.html +94 -45
- package/docs-dev/sass/core/path/index.html +38 -8
- package/docs-dev/sass/core/selector/index.html +38 -8
- package/docs-dev/sass/core/typography/index.html +38 -8
- package/docs-dev/sass/core/units/index.html +38 -8
- package/docs-dev/sass/core/utils/index.html +302 -68
- package/docs-dev/sass/helpers/color/index.html +38 -8
- package/docs-dev/sass/helpers/display/index.html +38 -8
- package/docs-dev/sass/helpers/index/index.html +38 -8
- package/docs-dev/sass/helpers/index.html +38 -8
- package/docs-dev/sass/helpers/print/index.html +38 -8
- package/docs-dev/sass/helpers/typography/index.html +38 -8
- package/docs-dev/sass/helpers/units/index.html +38 -8
- package/docs-dev/sass/helpers/utilities/index.html +38 -8
- package/docs-dev/sass/index.html +38 -8
- package/js/ui/breakpoints.js +1 -2
- package/js/ui/details-group.js +33 -42
- package/js/ui/dialog.js +64 -41
- package/js/ui/dialog.todo +2 -36
- package/js/ui/flipcard.js +37 -57
- package/js/ui/grid.js +15 -13
- package/js/ui/modal-builder.js +24 -38
- package/js/ui/popover.js +38 -39
- package/js/ui/print.js +16 -25
- package/js/ui/proxy-click.js +50 -36
- package/js/ui/scroll-slider.js +24 -30
- package/js/ui/scrollpoint.js +27 -63
- package/js/ui/slider.js +53 -55
- package/js/ui/tabs.js +23 -36
- package/js/ui/theme-toggle.js +37 -41
- package/js/ui/tooltip.js +27 -32
- package/js/utils/dom.js +12 -0
- package/js/utils/system.js +154 -0
- package/package.json +1 -1
- package/scss/_element.scss +91 -0
- package/scss/_layout.scss +3 -1
- package/scss/_utils.scss +42 -0
- package/scss/components/_accordion.scss +1 -2
- package/scss/components/_button-verbose.scss +41 -36
- package/scss/components/_callout.scss +113 -53
- package/scss/components/_data-table.scss +3 -0
- package/scss/components/_form-theme.scss +24 -25
- package/scss/components/_scroll-slider.scss +0 -4
- package/types/ui/breakpoints.d.ts.map +1 -1
- package/types/ui/details-group.d.ts +7 -12
- package/types/ui/details-group.d.ts.map +1 -1
- package/types/ui/dialog.d.ts +19 -14
- package/types/ui/dialog.d.ts.map +1 -1
- package/types/ui/flipcard.d.ts +16 -10
- package/types/ui/flipcard.d.ts.map +1 -1
- package/types/ui/grid.d.ts +4 -6
- package/types/ui/grid.d.ts.map +1 -1
- package/types/ui/modal-builder.d.ts +5 -9
- package/types/ui/modal-builder.d.ts.map +1 -1
- package/types/ui/popover.d.ts +6 -7
- package/types/ui/popover.d.ts.map +1 -1
- package/types/ui/print.d.ts +0 -4
- package/types/ui/print.d.ts.map +1 -1
- package/types/ui/proxy-click.d.ts +19 -3
- package/types/ui/proxy-click.d.ts.map +1 -1
- package/types/ui/scroll-slider.d.ts +5 -7
- package/types/ui/scroll-slider.d.ts.map +1 -1
- package/types/ui/scrollpoint.d.ts +3 -8
- package/types/ui/scrollpoint.d.ts.map +1 -1
- package/types/ui/slider.d.ts +22 -12
- package/types/ui/slider.d.ts.map +1 -1
- package/types/ui/tabs.d.ts +6 -8
- package/types/ui/tabs.d.ts.map +1 -1
- package/types/ui/theme-toggle.d.ts +6 -13
- package/types/ui/theme-toggle.d.ts.map +1 -1
- package/types/ui/tooltip.d.ts +3 -5
- package/types/ui/tooltip.d.ts.map +1 -1
- package/types/utils/dom.d.ts +6 -0
- package/types/utils/dom.d.ts.map +1 -1
- package/types/utils/system.d.ts +113 -0
- package/types/utils/system.d.ts.map +1 -0
|
@@ -243,11 +243,11 @@
|
|
|
243
243
|
|
|
244
244
|
<li class="nav-tree__item ">
|
|
245
245
|
|
|
246
|
-
<a class="nav-tree__link " href="/frontend/demos/card
|
|
246
|
+
<a class="nav-tree__link " href="/frontend/demos/card/">
|
|
247
247
|
|
|
248
248
|
|
|
249
249
|
<span class="nav-tree__text">
|
|
250
|
-
Card
|
|
250
|
+
Card
|
|
251
251
|
</span>
|
|
252
252
|
|
|
253
253
|
</a>
|
|
@@ -258,11 +258,11 @@
|
|
|
258
258
|
|
|
259
259
|
<li class="nav-tree__item ">
|
|
260
260
|
|
|
261
|
-
<a class="nav-tree__link " href="/frontend/demos/card/">
|
|
261
|
+
<a class="nav-tree__link " href="/frontend/demos/card-grid/">
|
|
262
262
|
|
|
263
263
|
|
|
264
264
|
<span class="nav-tree__text">
|
|
265
|
-
Card
|
|
265
|
+
Card Grid
|
|
266
266
|
</span>
|
|
267
267
|
|
|
268
268
|
</a>
|
|
@@ -2527,6 +2527,21 @@
|
|
|
2527
2527
|
|
|
2528
2528
|
</li>
|
|
2529
2529
|
|
|
2530
|
+
|
|
2531
|
+
<li class="nav-tree__item ">
|
|
2532
|
+
|
|
2533
|
+
<a class="nav-tree__link " href="/frontend/javascript/utils-system/">
|
|
2534
|
+
|
|
2535
|
+
|
|
2536
|
+
<span class="nav-tree__text">
|
|
2537
|
+
utils/system
|
|
2538
|
+
</span>
|
|
2539
|
+
|
|
2540
|
+
</a>
|
|
2541
|
+
|
|
2542
|
+
|
|
2543
|
+
</li>
|
|
2544
|
+
|
|
2530
2545
|
</ul>
|
|
2531
2546
|
|
|
2532
2547
|
</details>
|
|
@@ -2729,11 +2744,11 @@
|
|
|
2729
2744
|
|
|
2730
2745
|
<li class="nav-tree__item ">
|
|
2731
2746
|
|
|
2732
|
-
<a class="nav-tree__link " href="/frontend/demos/card
|
|
2747
|
+
<a class="nav-tree__link " href="/frontend/demos/card/">
|
|
2733
2748
|
|
|
2734
2749
|
|
|
2735
2750
|
<span class="nav-tree__text">
|
|
2736
|
-
Card
|
|
2751
|
+
Card
|
|
2737
2752
|
</span>
|
|
2738
2753
|
|
|
2739
2754
|
</a>
|
|
@@ -2744,11 +2759,11 @@
|
|
|
2744
2759
|
|
|
2745
2760
|
<li class="nav-tree__item ">
|
|
2746
2761
|
|
|
2747
|
-
<a class="nav-tree__link " href="/frontend/demos/card/">
|
|
2762
|
+
<a class="nav-tree__link " href="/frontend/demos/card-grid/">
|
|
2748
2763
|
|
|
2749
2764
|
|
|
2750
2765
|
<span class="nav-tree__text">
|
|
2751
|
-
Card
|
|
2766
|
+
Card Grid
|
|
2752
2767
|
</span>
|
|
2753
2768
|
|
|
2754
2769
|
</a>
|
|
@@ -5013,6 +5028,21 @@
|
|
|
5013
5028
|
|
|
5014
5029
|
</li>
|
|
5015
5030
|
|
|
5031
|
+
|
|
5032
|
+
<li class="nav-tree__item ">
|
|
5033
|
+
|
|
5034
|
+
<a class="nav-tree__link " href="/frontend/javascript/utils-system/">
|
|
5035
|
+
|
|
5036
|
+
|
|
5037
|
+
<span class="nav-tree__text">
|
|
5038
|
+
utils/system
|
|
5039
|
+
</span>
|
|
5040
|
+
|
|
5041
|
+
</a>
|
|
5042
|
+
|
|
5043
|
+
|
|
5044
|
+
</li>
|
|
5045
|
+
|
|
5016
5046
|
</ul>
|
|
5017
5047
|
|
|
5018
5048
|
</details>
|
package/docs-dev/sass/index.html
CHANGED
|
@@ -243,11 +243,11 @@
|
|
|
243
243
|
|
|
244
244
|
<li class="nav-tree__item ">
|
|
245
245
|
|
|
246
|
-
<a class="nav-tree__link " href="/frontend/demos/card
|
|
246
|
+
<a class="nav-tree__link " href="/frontend/demos/card/">
|
|
247
247
|
|
|
248
248
|
|
|
249
249
|
<span class="nav-tree__text">
|
|
250
|
-
Card
|
|
250
|
+
Card
|
|
251
251
|
</span>
|
|
252
252
|
|
|
253
253
|
</a>
|
|
@@ -258,11 +258,11 @@
|
|
|
258
258
|
|
|
259
259
|
<li class="nav-tree__item ">
|
|
260
260
|
|
|
261
|
-
<a class="nav-tree__link " href="/frontend/demos/card/">
|
|
261
|
+
<a class="nav-tree__link " href="/frontend/demos/card-grid/">
|
|
262
262
|
|
|
263
263
|
|
|
264
264
|
<span class="nav-tree__text">
|
|
265
|
-
Card
|
|
265
|
+
Card Grid
|
|
266
266
|
</span>
|
|
267
267
|
|
|
268
268
|
</a>
|
|
@@ -2527,6 +2527,21 @@
|
|
|
2527
2527
|
|
|
2528
2528
|
</li>
|
|
2529
2529
|
|
|
2530
|
+
|
|
2531
|
+
<li class="nav-tree__item ">
|
|
2532
|
+
|
|
2533
|
+
<a class="nav-tree__link " href="/frontend/javascript/utils-system/">
|
|
2534
|
+
|
|
2535
|
+
|
|
2536
|
+
<span class="nav-tree__text">
|
|
2537
|
+
utils/system
|
|
2538
|
+
</span>
|
|
2539
|
+
|
|
2540
|
+
</a>
|
|
2541
|
+
|
|
2542
|
+
|
|
2543
|
+
</li>
|
|
2544
|
+
|
|
2530
2545
|
</ul>
|
|
2531
2546
|
|
|
2532
2547
|
</details>
|
|
@@ -2729,11 +2744,11 @@
|
|
|
2729
2744
|
|
|
2730
2745
|
<li class="nav-tree__item ">
|
|
2731
2746
|
|
|
2732
|
-
<a class="nav-tree__link " href="/frontend/demos/card
|
|
2747
|
+
<a class="nav-tree__link " href="/frontend/demos/card/">
|
|
2733
2748
|
|
|
2734
2749
|
|
|
2735
2750
|
<span class="nav-tree__text">
|
|
2736
|
-
Card
|
|
2751
|
+
Card
|
|
2737
2752
|
</span>
|
|
2738
2753
|
|
|
2739
2754
|
</a>
|
|
@@ -2744,11 +2759,11 @@
|
|
|
2744
2759
|
|
|
2745
2760
|
<li class="nav-tree__item ">
|
|
2746
2761
|
|
|
2747
|
-
<a class="nav-tree__link " href="/frontend/demos/card/">
|
|
2762
|
+
<a class="nav-tree__link " href="/frontend/demos/card-grid/">
|
|
2748
2763
|
|
|
2749
2764
|
|
|
2750
2765
|
<span class="nav-tree__text">
|
|
2751
|
-
Card
|
|
2766
|
+
Card Grid
|
|
2752
2767
|
</span>
|
|
2753
2768
|
|
|
2754
2769
|
</a>
|
|
@@ -5013,6 +5028,21 @@
|
|
|
5013
5028
|
|
|
5014
5029
|
</li>
|
|
5015
5030
|
|
|
5031
|
+
|
|
5032
|
+
<li class="nav-tree__item ">
|
|
5033
|
+
|
|
5034
|
+
<a class="nav-tree__link " href="/frontend/javascript/utils-system/">
|
|
5035
|
+
|
|
5036
|
+
|
|
5037
|
+
<span class="nav-tree__text">
|
|
5038
|
+
utils/system
|
|
5039
|
+
</span>
|
|
5040
|
+
|
|
5041
|
+
</a>
|
|
5042
|
+
|
|
5043
|
+
|
|
5044
|
+
</li>
|
|
5045
|
+
|
|
5016
5046
|
</ul>
|
|
5017
5047
|
|
|
5018
5048
|
</details>
|
package/js/ui/breakpoints.js
CHANGED
|
@@ -97,9 +97,8 @@ export class BreakpointManager {
|
|
|
97
97
|
logError(this, 'Unable to get current breakpoint, maybe order is incorrect? Breakpoint check skipped!');
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
|
-
// console.log('name:\n', name);
|
|
101
100
|
if (name === this.active) return;
|
|
102
|
-
|
|
101
|
+
|
|
103
102
|
// Update active and cache last
|
|
104
103
|
this.previous = this.active;
|
|
105
104
|
this.previousIndex = this.activeIndex;
|
package/js/ui/details-group.js
CHANGED
|
@@ -3,20 +3,18 @@
|
|
|
3
3
|
* @description Manages groups of details (ie. onlyOneOpen at a time)
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import { getDatasetOptionalJson } from "../utils/dom.js";
|
|
6
|
+
import { ComponentInitializer } from "../utils/system.js";
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const attrSelector = key => `[${ attrs[key] }]`;
|
|
17
|
-
const attrSelectorInitial = key => `${ attrSelector(key) }:not([${ attrs.init }])`;
|
|
8
|
+
/**
|
|
9
|
+
* Dialog Component Initializer
|
|
10
|
+
*/
|
|
11
|
+
export const initializer = new ComponentInitializer({
|
|
12
|
+
type: "details-group",
|
|
13
|
+
baseAttribute: "data-ulu-details-group"
|
|
14
|
+
});
|
|
18
15
|
|
|
19
|
-
const
|
|
16
|
+
const childInitAttr = initializer.getAttribute("child-init");
|
|
17
|
+
const defaults = {
|
|
20
18
|
onlyOneOpen: true,
|
|
21
19
|
childSelector: ":scope > details"
|
|
22
20
|
};
|
|
@@ -26,24 +24,14 @@ const defaults = {
|
|
|
26
24
|
* - This will only initialize elements once, it is safe to call on page changes
|
|
27
25
|
*/
|
|
28
26
|
export function init() {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
*/
|
|
38
|
-
export function setup(context = document) {
|
|
39
|
-
// Added try because we are using querySelectorAll with :scope by default
|
|
40
|
-
// which will not work in Internet Explorer or early edge (some alt. browsers too)
|
|
41
|
-
try {
|
|
42
|
-
const elements = context.querySelectorAll(attrSelectorInitial("group"));
|
|
43
|
-
return [...elements].map(setupGroup);
|
|
44
|
-
} catch(error) {
|
|
45
|
-
console.error(error);
|
|
46
|
-
}
|
|
27
|
+
initializer.init({
|
|
28
|
+
withData: true,
|
|
29
|
+
events: ["pageModified"],
|
|
30
|
+
setup({ element, data, initialize }) {
|
|
31
|
+
setupGroup(element, data);
|
|
32
|
+
initialize();
|
|
33
|
+
}
|
|
34
|
+
});
|
|
47
35
|
}
|
|
48
36
|
|
|
49
37
|
/**
|
|
@@ -56,14 +44,19 @@ export function setup(context = document) {
|
|
|
56
44
|
/**
|
|
57
45
|
* Sets up a single group of details elements to manage their behavior.
|
|
58
46
|
* @param {HTMLElement} element - The parent element containing the details elements.
|
|
47
|
+
* @param {Object} options - The options for this group
|
|
59
48
|
* @returns {DetailsGroupInstance}
|
|
60
49
|
*/
|
|
61
|
-
export function setupGroup(element) {
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
50
|
+
export function setupGroup(element, userOptions) {
|
|
51
|
+
const options = Object.assign({}, defaults, userOptions);
|
|
52
|
+
|
|
53
|
+
// Added try because we are using querySelectorAll with :scope by default
|
|
54
|
+
// which will not work in Internet Explorer or early edge (some alt. browsers too)
|
|
55
|
+
try {
|
|
56
|
+
setupChildren();
|
|
57
|
+
} catch(error) {
|
|
58
|
+
console.error(error);
|
|
59
|
+
}
|
|
67
60
|
|
|
68
61
|
/**
|
|
69
62
|
* Queries all current children in element
|
|
@@ -78,13 +71,11 @@ export function setupGroup(element) {
|
|
|
78
71
|
*/
|
|
79
72
|
function setupChildren() {
|
|
80
73
|
queryChildren().forEach(child => {
|
|
81
|
-
if (child.hasAttribute(
|
|
74
|
+
if (child.hasAttribute(childInitAttr)) {
|
|
82
75
|
return;
|
|
83
76
|
} else {
|
|
84
|
-
child.setAttribute(
|
|
77
|
+
child.setAttribute(childInitAttr, "");
|
|
85
78
|
}
|
|
86
|
-
console.log(child);
|
|
87
|
-
|
|
88
79
|
child.addEventListener("toggle", toggleHandler);
|
|
89
80
|
});
|
|
90
81
|
}
|
|
@@ -112,9 +103,9 @@ export function setupGroup(element) {
|
|
|
112
103
|
function destroy() {
|
|
113
104
|
queryChildren().forEach(child => {
|
|
114
105
|
child.removeEventListener("toggle", toggleHandler);
|
|
115
|
-
child.removeAttribute(
|
|
106
|
+
child.removeAttribute(childInitAttr);
|
|
116
107
|
});
|
|
117
|
-
element.removeAttribute(
|
|
108
|
+
element.removeAttribute(initializer.getAttribute("init"));
|
|
118
109
|
}
|
|
119
110
|
|
|
120
111
|
return { destroy, element, setupChildren };
|
package/js/ui/dialog.js
CHANGED
|
@@ -2,23 +2,24 @@
|
|
|
2
2
|
* @module ui/dialog
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { ComponentInitializer } from "../utils/system.js";
|
|
6
|
+
import { wasClickOutside } from "../utils/dom.js";
|
|
7
7
|
import { pauseVideos as pauseYoutubeVideos, prepVideos as prepYoutubeVideos } from "../utils/pause-youtube-video.js";
|
|
8
|
+
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
+
* Base attribute for a dialog
|
|
10
11
|
*/
|
|
11
|
-
export const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
12
|
+
export const baseAttribute = "data-ulu-dialog"; // Exposed for modal builder
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Dialog Component Initializer
|
|
16
|
+
*/
|
|
17
|
+
export const initializer = new ComponentInitializer({ type: "dialog", baseAttribute });
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const
|
|
19
|
+
/**
|
|
20
|
+
* Attribute for close buttons within a dialog
|
|
21
|
+
*/
|
|
22
|
+
export const closeAttribute = initializer.getAttribute("close"); // Exposed for modal builder
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* Dialog Defaults
|
|
@@ -42,6 +43,10 @@ export const defaults = {
|
|
|
42
43
|
* Whether or not to pause videos when dialog closes (currently just youtube and native)
|
|
43
44
|
*/
|
|
44
45
|
pauseVideos: true,
|
|
46
|
+
/**
|
|
47
|
+
* When open and not non-modal, the body is prevented from scrolling (defaults to true).
|
|
48
|
+
*/
|
|
49
|
+
preventScroll: true,
|
|
45
50
|
};
|
|
46
51
|
|
|
47
52
|
|
|
@@ -49,7 +54,7 @@ export const defaults = {
|
|
|
49
54
|
let currentDefaults = { ...defaults };
|
|
50
55
|
|
|
51
56
|
/**
|
|
52
|
-
* @param {Object} options Change options used as default for dialogs, can then be
|
|
57
|
+
* @param {Object} options Change options used as default for dialogs, can then be overridden by data attribute settings on element
|
|
53
58
|
*/
|
|
54
59
|
export function setDefaults(options) {
|
|
55
60
|
currentDefaults = Object.assign({}, currentDefaults, options);
|
|
@@ -60,35 +65,40 @@ export function setDefaults(options) {
|
|
|
60
65
|
* - This will only initialize elements once, it is safe to call on page changes
|
|
61
66
|
*/
|
|
62
67
|
export function init() {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
68
|
+
// Initialize all the dialogs
|
|
69
|
+
initializer.init({
|
|
70
|
+
events: ["pageModified"],
|
|
71
|
+
withData: true,
|
|
72
|
+
setup({ element, initialize, data }) {
|
|
73
|
+
setupDialog(element, data);
|
|
74
|
+
initialize();
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// Initialize all triggers (things that trigger opening a dialog)
|
|
79
|
+
initializer.init({
|
|
80
|
+
key: "trigger",
|
|
81
|
+
events: ["pageModified"],
|
|
82
|
+
withData: true,
|
|
83
|
+
setup({ element, initialize, data: dialogId }) {
|
|
84
|
+
setupTrigger(element, dialogId);
|
|
85
|
+
initialize();
|
|
86
|
+
}
|
|
87
|
+
});
|
|
77
88
|
}
|
|
78
89
|
|
|
79
90
|
/**
|
|
80
91
|
* Setup click handlers on a trigger
|
|
81
|
-
* @param {Node} trigger
|
|
92
|
+
* @param {Node} trigger Trigger button element
|
|
93
|
+
* @param {String} dialogId The dialog's id to open
|
|
82
94
|
*/
|
|
83
|
-
export function setupTrigger(trigger) {
|
|
95
|
+
export function setupTrigger(trigger, dialogId) {
|
|
84
96
|
trigger.addEventListener("click", handleTrigger);
|
|
85
|
-
trigger.setAttribute(attrs.init, "");
|
|
86
97
|
|
|
87
98
|
function handleTrigger() {
|
|
88
|
-
const
|
|
89
|
-
const dialog = document.getElementById(id);
|
|
99
|
+
const dialog = document.getElementById(dialogId);
|
|
90
100
|
if (!dialog) {
|
|
91
|
-
console.error("Could not locate dialog (id)",
|
|
101
|
+
console.error("Could not locate dialog (id)", dialogId);
|
|
92
102
|
return;
|
|
93
103
|
}
|
|
94
104
|
if (dialog?.tagName?.toLowerCase() !== "dialog") {
|
|
@@ -104,20 +114,33 @@ export function setupTrigger(trigger) {
|
|
|
104
114
|
* Setup click handlers for a dialog
|
|
105
115
|
* @param {Node} dialog
|
|
106
116
|
*/
|
|
107
|
-
export function setupDialog(dialog) {
|
|
108
|
-
const options =
|
|
117
|
+
export function setupDialog(dialog, userOptions) {
|
|
118
|
+
const options = Object.assign({}, currentDefaults, userOptions);
|
|
119
|
+
const body = document.body;
|
|
120
|
+
|
|
109
121
|
dialog.addEventListener("click", handleClicks);
|
|
110
|
-
|
|
122
|
+
|
|
111
123
|
if (options.documentEnd) {
|
|
112
|
-
|
|
124
|
+
body.appendChild(dialog);
|
|
113
125
|
}
|
|
114
126
|
if (options.pauseVideos) {
|
|
115
127
|
prepVideos(dialog);
|
|
116
128
|
}
|
|
117
129
|
|
|
130
|
+
// Allow preventScroll if it is a modal dialog
|
|
131
|
+
// Caching value of overflow before setting so we don't assume what it's initial value is
|
|
132
|
+
if (!options.nonModal && options.preventScroll) {
|
|
133
|
+
let overflowValue = body.style.overflow;
|
|
134
|
+
dialog.addEventListener("toggle", (event) => {
|
|
135
|
+
const isOpen = event.newState === "open";
|
|
136
|
+
if (isOpen) overflowValue = body.style.overflow;
|
|
137
|
+
body.style.overflow = isOpen ? "hidden" : overflowValue;
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
118
141
|
function handleClicks(event) {
|
|
119
142
|
const { target } = event;
|
|
120
|
-
const closeFromButton = target.closest("
|
|
143
|
+
const closeFromButton = target.closest(initializer.attributeSelector("close"));
|
|
121
144
|
let closeFromOutside = options.clickOutsideCloses &&
|
|
122
145
|
target === dialog &&
|
|
123
146
|
wasClickOutside(dialog, event);
|
|
@@ -136,8 +159,7 @@ export function setupDialog(dialog) {
|
|
|
136
159
|
* @returns {Object}
|
|
137
160
|
*/
|
|
138
161
|
export function getDialogOptions(dialog) {
|
|
139
|
-
|
|
140
|
-
return Object.assign({}, currentDefaults, options);
|
|
162
|
+
return Object.assign({}, currentDefaults, initializer.getData(dialog));
|
|
141
163
|
}
|
|
142
164
|
|
|
143
165
|
/**
|
|
@@ -146,6 +168,7 @@ export function getDialogOptions(dialog) {
|
|
|
146
168
|
function prepVideos(dialog) {
|
|
147
169
|
prepYoutubeVideos(dialog);
|
|
148
170
|
}
|
|
171
|
+
|
|
149
172
|
/**
|
|
150
173
|
* Prep videos to be paused for a given dialog
|
|
151
174
|
*/
|
package/js/ui/dialog.todo
CHANGED
|
@@ -1,37 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
✔ Animations? @done
|
|
3
|
-
☐ Check styling on left right
|
|
1
|
+
Dialog Todos:
|
|
4
2
|
☐ Setup fullscreen option / modifier
|
|
5
|
-
☐
|
|
6
|
-
☐ Resizing
|
|
7
|
-
✔ Work out how this can work with native and click outside @done
|
|
8
|
-
✔ Figure out how to setup icon for the resizer for all sites @done
|
|
9
|
-
* Fontawesome, or should this just be CSS so we don't need any icons for it
|
|
10
|
-
* Same for close button should we just use CSS and omit any FA requirements
|
|
11
|
-
* Or make it super easy to implement the icon only in the template (like default icon classses)
|
|
12
|
-
* Then user can choose to implement their own (via class) or use the styles that come with it
|
|
13
|
-
☐ Prevent Browser Scroll
|
|
14
|
-
✔ How should height work? Should a centered modal expand to it's content's height (up to the viewport height) or always be cropped and scroll (static height)? @done
|
|
15
|
-
Todos:
|
|
16
|
-
✔ How should the relationship between a dialog and it's trigger work @done
|
|
17
|
-
* Think there should be no relationship? Just triggers are triggers just attach a handler to open DOM centric way (add errors when the dialog doesn't exist)
|
|
18
|
-
* For the dialogs they should just have handlers attached for close
|
|
19
|
-
* Init should find all one's that need to be built and build them, then it should initialize them the same way as non-built dialogs
|
|
20
|
-
✔ Support both modal and non-modal dialogs (rename)? @done
|
|
21
|
-
✘ Divide into 4 modules @cancelled
|
|
22
|
-
1. Initializer (data-attributes)
|
|
23
|
-
2. Templater (for Drupal projects and standard modals)
|
|
24
|
-
3. Open/Close Behaviors
|
|
25
|
-
4. Programmatic Modal
|
|
26
|
-
* This is tough because its opionated towards our system in Drupal (jQuery)
|
|
27
|
-
✔ How should this all be structured @done
|
|
28
|
-
* JS template dialogs?
|
|
29
|
-
* Pros
|
|
30
|
-
* Many users create the modals in content in CMS we don't want to make that difficult or get stuck with structure
|
|
31
|
-
* Cons
|
|
32
|
-
* Templating is in JS so dialogs don't make much sense on their own
|
|
33
|
-
* Could continue the div to dialog conversion (so modal content is inline unless JS running). Don't want to optimize too much for no js anymore anyways
|
|
34
|
-
* writing the dialog by hand makes sense for non defualt modal styles or users that have another structure but need the scripting part
|
|
35
|
-
* Solution
|
|
36
|
-
* Breakup module into two parts the underlying modal scripting (open close trigger) and (conversion modal templating [w. resizer] and as <div>)
|
|
37
|
-
* Then we can have both without any extra code and seperation
|
|
3
|
+
☐ Prevent Browser Scroll
|
package/js/ui/flipcard.js
CHANGED
|
@@ -2,14 +2,43 @@
|
|
|
2
2
|
* @module ui/flipcard
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import { ComponentInitializer } from "../utils/system.js";
|
|
5
6
|
import { trimWhitespace } from "@ulu/utils/string.js";
|
|
6
7
|
import { log, logError } from "../utils/class-logger.js";
|
|
7
|
-
import { getName } from "../events/index.js";
|
|
8
|
-
import { getDatasetOptionalJson } from "../utils/dom.js";
|
|
9
|
-
const debugMode = false; // Global dev debug
|
|
10
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Flipcard Component Initializer
|
|
11
|
+
*/
|
|
12
|
+
export const initializer = new ComponentInitializer({
|
|
13
|
+
type: "flipcard",
|
|
14
|
+
baseAttribute: "data-ulu-flipcard"
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Initialize flipcards using data-ulu-flipcard attribute
|
|
19
|
+
*/
|
|
20
|
+
export function init() {
|
|
21
|
+
initializer.init({
|
|
22
|
+
withData: true,
|
|
23
|
+
events: ["pageModified"],
|
|
24
|
+
setup({ element, data, initialize }) {
|
|
25
|
+
const options = Object.assign({}, data);
|
|
26
|
+
const front = element.querySelector(initializer.attributeSelector("front"));
|
|
27
|
+
const back = element.querySelector(initializer.attributeSelector("back"));
|
|
28
|
+
(new Flipcard(element, front, back, options));
|
|
29
|
+
initialize();
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Flipcard class (creates flipcard instance and behaviors)
|
|
36
|
+
*/
|
|
11
37
|
export class Flipcard {
|
|
12
38
|
static instances = [];
|
|
39
|
+
/**
|
|
40
|
+
* Default options for Flipcard
|
|
41
|
+
*/
|
|
13
42
|
static defaults = {
|
|
14
43
|
namespace: "Flipcard",
|
|
15
44
|
proxyClick: {
|
|
@@ -18,25 +47,25 @@ export class Flipcard {
|
|
|
18
47
|
exclude: "a, input, textarea, button" // Selectors to avoid closing a flipcard onProxyclick
|
|
19
48
|
},
|
|
20
49
|
};
|
|
21
|
-
constructor(container, front, back, config
|
|
50
|
+
constructor(container, front, back, config) {
|
|
22
51
|
if (!container, !front, !back) {
|
|
23
52
|
logError(this, 'Missing an element (container, front, back)');
|
|
24
53
|
}
|
|
25
54
|
this.options = Object.assign({}, Flipcard.defaults, config);
|
|
26
55
|
const { namespace } = this.options;
|
|
56
|
+
|
|
27
57
|
Flipcard.instances.push(this);
|
|
28
58
|
|
|
29
|
-
this.debug = debugMode || debug;
|
|
30
59
|
this.elements = { container, front, back };
|
|
31
60
|
this.isOpen = false;
|
|
32
61
|
this.uid = `${ namespace }-id-${ Flipcard.instances.length }`;
|
|
33
62
|
this.stateAttr = `data-${ namespace }-state`.toLowerCase();
|
|
34
63
|
this.setup();
|
|
35
|
-
this.
|
|
64
|
+
this.setVisibility(false);
|
|
36
65
|
log(this, this);
|
|
37
66
|
}
|
|
38
67
|
toggle() {
|
|
39
|
-
this.
|
|
68
|
+
this.setVisibility(!this.isOpen);
|
|
40
69
|
}
|
|
41
70
|
setup() {
|
|
42
71
|
const { uid } = this;
|
|
@@ -98,7 +127,7 @@ export class Flipcard {
|
|
|
98
127
|
<span class="hidden-visually">Show More Information</span>
|
|
99
128
|
`;
|
|
100
129
|
}
|
|
101
|
-
|
|
130
|
+
setVisibility(visible) {
|
|
102
131
|
const { back, container, control } = this.elements;
|
|
103
132
|
const state = visible ? "open" : "closed";
|
|
104
133
|
back.style.zIndex = visible ? "10" : "1";
|
|
@@ -128,56 +157,7 @@ export class Flipcard {
|
|
|
128
157
|
}
|
|
129
158
|
}
|
|
130
159
|
|
|
131
|
-
/**
|
|
132
|
-
* Default data attributes
|
|
133
|
-
*/
|
|
134
|
-
export const attrs = {
|
|
135
|
-
init: "data-ulu-flipcard-init",
|
|
136
|
-
flipcard: "data-ulu-flipcard",
|
|
137
|
-
front: "data-ulu-flipcard-front",
|
|
138
|
-
back: "data-ulu-flipcard-back",
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
// Utils for selecting things based on attributes
|
|
142
|
-
const attrSelector = key => `[${ attrs[key] }]`;
|
|
143
|
-
const attrSelectorInitial = key => `${ attrSelector(key) }:not([${ attrs.init }])`;
|
|
144
|
-
|
|
145
|
-
// const containers = document.querySelectorAll('[data-ulu-flipcard]');
|
|
146
|
-
const instances = [];
|
|
147
|
-
|
|
148
|
-
export function init() {
|
|
149
|
-
document.addEventListener(getName("pageModified"), setup);
|
|
150
|
-
setup();
|
|
151
|
-
}
|
|
152
160
|
|
|
153
|
-
export function setup() {
|
|
154
|
-
const builders = document.querySelectorAll(attrSelectorInitial("flipcard"));
|
|
155
|
-
builders.forEach(setupFlipcard);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
// containers.forEach(init);
|
|
159
|
-
|
|
160
|
-
function setupFlipcard(container) {
|
|
161
|
-
container.setAttribute(attrs.init, "");
|
|
162
|
-
const options = getDatasetOptionalJson(container, "uluFlipcard");
|
|
163
|
-
const config = Object.assign({}, options);
|
|
164
|
-
const front = container.querySelector(attrSelectorInitial("front"));
|
|
165
|
-
const back = container.querySelector(attrSelectorInitial("back"));
|
|
166
|
-
instances.push(new Flipcard(container, front, back, config));
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// getDatasetOptionalJson
|
|
170
|
-
function setupSlider(container) {
|
|
171
|
-
container.setAttribute(attrs.init, "");
|
|
172
|
-
const options = getDatasetOptionalJson(container, "uluFlipcard");
|
|
173
|
-
const config = Object.assign({}, options);
|
|
174
|
-
const elements = {
|
|
175
|
-
track: container.querySelector(attrSelector("track")),
|
|
176
|
-
controls: container.querySelector(attrSelector("controls"))
|
|
177
|
-
};
|
|
178
|
-
// replace with OverflowScroller when finished removing sitescrollslider
|
|
179
|
-
instances.push(new SiteScrollSlider(elements, config));
|
|
180
|
-
}
|
|
181
161
|
|
|
182
162
|
/**
|
|
183
163
|
* Preliminary Notes:
|