@internetstiftelsen/styleguide 2.21.31 → 2.22.0
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/assets/js/conditional.js +3 -1
- package/dist/assets/js/validationMessage.js +1 -1
- package/package.json +1 -1
- package/src/assets/js/conditional.js +3 -1
- package/src/pages/conditional/conditional.hbs +1 -0
- package/dist/.DS_Store +0 -0
- package/src/.DS_Store +0 -0
- package/src/assets/.DS_Store +0 -0
- package/src/atoms/.DS_Store +0 -0
- package/src/atoms/icon/.DS_Store +0 -0
- package/src/molecules/.DS_Store +0 -0
|
@@ -87,10 +87,12 @@ function update(element, value) {
|
|
|
87
87
|
return v;
|
|
88
88
|
});
|
|
89
89
|
var matches = values.some(function (match) {
|
|
90
|
-
return match === value;
|
|
90
|
+
return match === value || match.indexOf('!') === 0 && match.substring(1) !== value;
|
|
91
91
|
});
|
|
92
92
|
var conditionMet = !values.length && !!value || matches;
|
|
93
93
|
|
|
94
|
+
console.log(values, value, matches);
|
|
95
|
+
|
|
94
96
|
if (effect === 'disable') {
|
|
95
97
|
effectDisable(element, !conditionMet, value);
|
|
96
98
|
} else if (effect === 'toggle') {
|
package/package.json
CHANGED
|
@@ -69,9 +69,11 @@ function effectText(element, value) {
|
|
|
69
69
|
function update(element, value) {
|
|
70
70
|
const effect = element.getAttribute('data-if-effect') || 'toggle';
|
|
71
71
|
const values = element.getAttribute('data-if').split('|').map((match) => match.split(':')[1]).filter((v) => v);
|
|
72
|
-
const matches = values.some((match) => match === value);
|
|
72
|
+
const matches = values.some((match) => match === value || (match.indexOf('!') === 0 && match.substring(1) !== value));
|
|
73
73
|
const conditionMet = (!values.length && !!value) || matches;
|
|
74
74
|
|
|
75
|
+
console.log(values, value, matches);
|
|
76
|
+
|
|
75
77
|
if (effect === 'disable') {
|
|
76
78
|
effectDisable(element, !conditionMet, value);
|
|
77
79
|
} else if (effect === 'toggle') {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<p data-if="type:podd" style="display: none">Den här texten visas bara om podd är vald.</p>
|
|
4
4
|
<p data-if="type:podd|type:workshop" style="display: none">Den här texten visas om podd eller workshop är vald.</p>
|
|
5
5
|
<p data-if="type" style="display: none">Den här texten visas ifall "Typ" har ett värde</p>
|
|
6
|
+
<p data-if="type:!podd" style="display: none">Den här texten visas ifall "Typ" <strong>inte</strong> är podd.</p>
|
|
6
7
|
|
|
7
8
|
<div class="field-group">
|
|
8
9
|
<label for="select">Typ</label>
|
package/dist/.DS_Store
DELETED
|
Binary file
|
package/src/.DS_Store
DELETED
|
Binary file
|
package/src/assets/.DS_Store
DELETED
|
Binary file
|
package/src/atoms/.DS_Store
DELETED
|
Binary file
|
package/src/atoms/icon/.DS_Store
DELETED
|
Binary file
|
package/src/molecules/.DS_Store
DELETED
|
Binary file
|