@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.
@@ -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') {
@@ -14,7 +14,7 @@ function validationMessage(message) {
14
14
  data = _message$split2[1];
15
15
 
16
16
  if (!('Iis_Lang' in window)) {
17
- return rule;
17
+ return message;
18
18
  }
19
19
 
20
20
  var validation = window.Iis_Lang.validation;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetstiftelsen/styleguide",
3
- "version": "2.21.31",
3
+ "version": "2.22.0",
4
4
  "main": "dist/components.js",
5
5
  "ports": {
6
6
  "fractal": "3000"
@@ -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
Binary file
Binary file
Binary file
Binary file