@graupl/core 1.0.0-beta.21 → 1.0.0-beta.23
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/dist/css/component/card.css +1 -1
- package/dist/css/component/card.css.map +1 -1
- package/dist/css/component/input-group.css +1 -1
- package/dist/css/component/input-group.css.map +1 -1
- package/dist/css/component/navigation.css +1 -1
- package/dist/css/component/navigation.css.map +1 -1
- package/dist/css/component.css +1 -1
- package/dist/css/component.css.map +1 -1
- package/dist/css/graupl.css +2 -2
- package/dist/css/graupl.css.map +1 -1
- package/dist/css/layout/columns.css +1 -1
- package/dist/css/layout/columns.css.map +1 -1
- package/dist/css/layout/container.css +1 -1
- package/dist/css/layout/container.css.map +1 -1
- package/dist/css/layout/flex-columns.css +1 -1
- package/dist/css/layout/flex-columns.css.map +1 -1
- package/dist/css/layout.css +2 -2
- package/dist/css/layout.css.map +1 -1
- package/dist/css/utilities/display.css +1 -1
- package/dist/css/utilities/display.css.map +1 -1
- package/dist/css/utilities/inset.css +1 -1
- package/dist/css/utilities/inset.css.map +1 -1
- package/dist/css/utilities/order.css +1 -1
- package/dist/css/utilities/order.css.map +1 -1
- package/dist/css/utilities/position.css +1 -1
- package/dist/css/utilities/position.css.map +1 -1
- package/dist/css/utilities/ratio.css +1 -1
- package/dist/css/utilities/ratio.css.map +1 -1
- package/dist/css/utilities/spacing.css +1 -1
- package/dist/css/utilities/spacing.css.map +1 -1
- package/dist/css/utilities/visibility.css +1 -1
- package/dist/css/utilities/visibility.css.map +1 -1
- package/dist/css/utilities.css +1 -1
- package/dist/css/utilities.css.map +1 -1
- package/dist/js/component/disclosure.cjs.js +2 -2
- package/dist/js/component/disclosure.cjs.js.map +1 -1
- package/dist/js/component/disclosure.es.js +2 -2
- package/dist/js/component/disclosure.es.js.map +1 -1
- package/dist/js/component/disclosure.iife.js +2 -2
- package/dist/js/component/disclosure.iife.js.map +1 -1
- package/dist/js/disclosure.js +5 -0
- package/dist/js/disclosure.js.map +1 -0
- package/dist/js/generator/disclosure.cjs.js +2 -2
- package/dist/js/generator/disclosure.cjs.js.map +1 -1
- package/dist/js/generator/disclosure.es.js +2 -2
- package/dist/js/generator/disclosure.es.js.map +1 -1
- package/dist/js/generator/disclosure.iife.js +2 -2
- package/dist/js/generator/disclosure.iife.js.map +1 -1
- package/dist/js/graupl.js +5 -5
- package/dist/js/graupl.js.map +1 -1
- package/package.json +1 -1
- package/src/js/disclosure/Disclosure.js +45 -41
- package/src/scss/_defaults.scss +7 -4
package/package.json
CHANGED
|
@@ -199,6 +199,15 @@ class Disclosure {
|
|
|
199
199
|
*/
|
|
200
200
|
_prefix = "graupl-";
|
|
201
201
|
|
|
202
|
+
/**
|
|
203
|
+
* The key used to generate IDs throughout the disclosure.
|
|
204
|
+
*
|
|
205
|
+
* @protected
|
|
206
|
+
*
|
|
207
|
+
* @type {string}
|
|
208
|
+
*/
|
|
209
|
+
_key = "";
|
|
210
|
+
|
|
202
211
|
/**
|
|
203
212
|
* An array of error messages generated by the disclosure.
|
|
204
213
|
*
|
|
@@ -311,16 +320,15 @@ class Disclosure {
|
|
|
311
320
|
|
|
312
321
|
// Set up the storage.
|
|
313
322
|
storage.initializeStorage("disclosures");
|
|
314
|
-
storage.initializeStorage("disclosures");
|
|
315
323
|
storage.pushToStorage("disclosures", this.dom.disclosure.id, this);
|
|
316
324
|
|
|
317
325
|
if (
|
|
318
326
|
this.dom.controller.getAttribute("aria-expanded") === "true" ||
|
|
319
327
|
(this.shouldOpen && window.matchMedia(this.openQuery).matches)
|
|
320
328
|
) {
|
|
321
|
-
this._expand(false, false);
|
|
329
|
+
this._expand({ emit: false, transition: false });
|
|
322
330
|
} else {
|
|
323
|
-
this._collapse(false, false);
|
|
331
|
+
this._collapse({ emit: false, transition: false });
|
|
324
332
|
}
|
|
325
333
|
|
|
326
334
|
requestAnimationFrame(() => {
|
|
@@ -702,6 +710,17 @@ class Disclosure {
|
|
|
702
710
|
return check;
|
|
703
711
|
}
|
|
704
712
|
|
|
713
|
+
/**
|
|
714
|
+
* The key used to generate IDs throughout the disclosure.
|
|
715
|
+
*
|
|
716
|
+
* @type {string}
|
|
717
|
+
*
|
|
718
|
+
* @see _key
|
|
719
|
+
*/
|
|
720
|
+
get key() {
|
|
721
|
+
return this._key;
|
|
722
|
+
}
|
|
723
|
+
|
|
705
724
|
/**
|
|
706
725
|
* An array of error messages generated by the disclosure.
|
|
707
726
|
*
|
|
@@ -737,12 +756,17 @@ class Disclosure {
|
|
|
737
756
|
}
|
|
738
757
|
|
|
739
758
|
// Query selector checks.
|
|
740
|
-
const
|
|
741
|
-
disclosureContentSelector: this._selectors.content,
|
|
742
|
-
});
|
|
759
|
+
const querySelectors = {};
|
|
743
760
|
|
|
744
|
-
|
|
745
|
-
|
|
761
|
+
for (const querySelector of Object.keys(this._selectors)) {
|
|
762
|
+
querySelectors[`${querySelector}Selector`] =
|
|
763
|
+
this._selectors[querySelector];
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
const querySelectorChecks = isQuerySelector(querySelectors);
|
|
767
|
+
|
|
768
|
+
if (!querySelectorChecks) {
|
|
769
|
+
this._errors.push(querySelectorChecks.message);
|
|
746
770
|
check = false;
|
|
747
771
|
}
|
|
748
772
|
|
|
@@ -790,13 +814,14 @@ class Disclosure {
|
|
|
790
814
|
}
|
|
791
815
|
|
|
792
816
|
/**
|
|
793
|
-
* Generates a key for the
|
|
817
|
+
* Generates a key for the tabs.
|
|
794
818
|
*
|
|
795
|
-
* @param {boolean} [
|
|
819
|
+
* @param {Object<boolean>} [options = {}] - Options for generating the key.
|
|
820
|
+
* @param {boolean} [options.regenerate = false] - A flag to determine if the key should be regenerated.
|
|
796
821
|
*/
|
|
797
|
-
_generateKey(regenerate = false) {
|
|
822
|
+
_generateKey({ regenerate = false } = {}) {
|
|
798
823
|
if (this.key === "" || regenerate) {
|
|
799
|
-
this.
|
|
824
|
+
this._key = Math.random()
|
|
800
825
|
.toString(36)
|
|
801
826
|
.replace(/[^a-z]+/g, "")
|
|
802
827
|
.substring(0, 10);
|
|
@@ -985,38 +1010,28 @@ class Disclosure {
|
|
|
985
1010
|
*
|
|
986
1011
|
* @fires grauplDisclosureExpand
|
|
987
1012
|
*
|
|
988
|
-
* @param {boolean} [
|
|
989
|
-
* @param {boolean}
|
|
1013
|
+
* @param {Object<boolean>} [options = {}] - Options for expanding the disclosure.
|
|
1014
|
+
* @param {boolean} [options.emit = true] - Emit the expand event once expanded.
|
|
1015
|
+
* @param {boolean} [options.transition = true] - Respect the transition class.
|
|
990
1016
|
*/
|
|
991
|
-
_expand(emit = true, transition = true) {
|
|
1017
|
+
_expand({ emit = true, transition = true } = {}) {
|
|
992
1018
|
this.dom.controller.setAttribute("aria-expanded", "true");
|
|
993
1019
|
|
|
994
1020
|
// If we're dealing with transition classes, then we need to utilize
|
|
995
1021
|
// requestAnimationFrame to add the transition class, remove the close class,
|
|
996
1022
|
// add the open class, and finally remove the transition class.
|
|
997
1023
|
if (transition && this.transitionlass !== "") {
|
|
998
|
-
// this.dom.disclosure.style.height = `${this.dom.disclosure.getBoundingClientRect().height}px`;
|
|
999
|
-
// console.log(this.dom.disclosure.style.height);
|
|
1000
1024
|
addClass(this.transitionClass, this.dom.disclosure);
|
|
1001
1025
|
|
|
1002
1026
|
requestAnimationFrame(() => {
|
|
1003
1027
|
removeClass(this.closeClass, this.dom.disclosure);
|
|
1004
1028
|
|
|
1005
|
-
// this.dom.disclosure.style.height = `${this.dom.disclosure.getBoundingClientRect().height}px`;
|
|
1006
|
-
// console.log(this.dom.disclosure.style.height);
|
|
1007
|
-
|
|
1008
1029
|
requestAnimationFrame(() => {
|
|
1009
1030
|
addClass(this.openClass, this.dom.disclosure);
|
|
1010
1031
|
|
|
1011
|
-
// this.dom.disclosure.style.height = `${this.dom.content.getBoundingClientRect().height}px`;
|
|
1012
|
-
// console.log(this.dom.disclosure.style.height);
|
|
1013
|
-
|
|
1014
1032
|
requestAnimationFrame(() => {
|
|
1015
1033
|
setTimeout(() => {
|
|
1016
1034
|
removeClass(this.transitionClass, this.dom.disclosure);
|
|
1017
|
-
|
|
1018
|
-
// this.dom.disclosure.style.height = "";
|
|
1019
|
-
// console.log(this.dom.disclosure.style.height);
|
|
1020
1035
|
}, this.openDuration);
|
|
1021
1036
|
});
|
|
1022
1037
|
});
|
|
@@ -1046,41 +1061,30 @@ class Disclosure {
|
|
|
1046
1061
|
*
|
|
1047
1062
|
* @fires grauplDisclosureCollapse
|
|
1048
1063
|
*
|
|
1049
|
-
* @param {boolean} [
|
|
1050
|
-
* @param {boolean}
|
|
1064
|
+
* @param {Object<boolean>} [options = {}] - Options for collapsing the disclosure.
|
|
1065
|
+
* @param {boolean} [options.emit = true] - Emit the collapse event once collapsed.
|
|
1066
|
+
* @param {boolean} [options.transition = true] - Respect the transition class.
|
|
1051
1067
|
*/
|
|
1052
|
-
_collapse(emit = true, transition = true) {
|
|
1068
|
+
_collapse({ emit = true, transition = true } = {}) {
|
|
1053
1069
|
this.dom.controller.setAttribute("aria-expanded", "false");
|
|
1054
1070
|
|
|
1055
1071
|
// If we're dealing with transition classes, then we need to utilize
|
|
1056
1072
|
// requestAnimationFrame to add the transition class, remove the open class,
|
|
1057
1073
|
// add the close class, and finally remove the transition class.
|
|
1058
1074
|
if (transition && this.transitionClass !== "") {
|
|
1059
|
-
// this.dom.disclosure.style.height = `${this.dom.content.getBoundingClientRect().height}px`;
|
|
1060
|
-
// console.log(this.dom.disclosure.style.height);
|
|
1061
|
-
|
|
1062
1075
|
addClass(this.transitionClass, this.dom.disclosure);
|
|
1063
1076
|
|
|
1064
1077
|
requestAnimationFrame(() => {
|
|
1065
1078
|
removeClass(this.openClass, this.dom.disclosure);
|
|
1066
1079
|
|
|
1067
|
-
// this.dom.disclosure.style.height = `${this.dom.content.getBoundingClientRect().height}px`;
|
|
1068
|
-
// console.log(this.dom.disclosure.style.height);
|
|
1069
|
-
|
|
1070
1080
|
requestAnimationFrame(() => {
|
|
1071
1081
|
addClass(this.closeClass, this.dom.disclosure);
|
|
1072
1082
|
|
|
1073
|
-
// this.dom.disclosure.style.height = `${this.dom.disclosure.getBoundingClientRect().height}px`;
|
|
1074
|
-
// console.log(this.dom.disclosure.style.height);
|
|
1075
|
-
|
|
1076
1083
|
requestAnimationFrame(() => {
|
|
1077
1084
|
setTimeout(() => {
|
|
1078
1085
|
removeClass(this.transitionClass, this.dom.disclosure);
|
|
1079
1086
|
|
|
1080
1087
|
this.dom.content.innert = true;
|
|
1081
|
-
|
|
1082
|
-
// this.dom.disclosure.style.height = "";
|
|
1083
|
-
// console.log(this.dom.disclosure.style.height);
|
|
1084
1088
|
}, this.closeDuration);
|
|
1085
1089
|
});
|
|
1086
1090
|
});
|
package/src/scss/_defaults.scss
CHANGED
|
@@ -34,10 +34,13 @@ $content-max-width: 96ch !default;
|
|
|
34
34
|
// Screen sizes.
|
|
35
35
|
$-screen-sizes: (
|
|
36
36
|
xs: 0,
|
|
37
|
-
sm:
|
|
38
|
-
md:
|
|
39
|
-
lg:
|
|
40
|
-
xl:
|
|
37
|
+
sm: 576px,
|
|
38
|
+
md: 768px,
|
|
39
|
+
lg: 1024px,
|
|
40
|
+
xl: 1280px,
|
|
41
|
+
hd: 1500px,
|
|
42
|
+
qhd: 1921px,
|
|
43
|
+
uhd: 2561px,
|
|
41
44
|
);
|
|
42
45
|
$custom-screen-sizes: () !default;
|
|
43
46
|
$screen-sizes: () !default;
|