barbican-reset 2.44.0 → 2.45.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.
@@ -5,12 +5,13 @@
5
5
  @change="(event) => emitInputData(event, 'checkbox')"
6
6
  :data-test="dataTest"
7
7
  :disabled="disabled"
8
- :checked="checked"
9
8
  :success="success"
9
+ :checked="checked"
10
10
  :id="generateID"
11
11
  type="checkbox"
12
12
  :table="table"
13
13
  :value="value"
14
+ :name="name"
14
15
  />
15
16
  <label v-if="$slots.default" :for="generateID" ref="label"><slot /></label>
16
17
  </div>
@@ -29,6 +30,7 @@ export default {
29
30
  "toggle",
30
31
  "table",
31
32
  "value",
33
+ "name",
32
34
  "id",
33
35
  ],
34
36
  };
@@ -1,12 +1,14 @@
1
1
  <template>
2
2
  <div role="group" :id="id">
3
3
  <br-form-checkbox
4
- v-for="({ value, checked, text }, index) in options"
4
+ v-for="({ value, checked, text, name, dataTest }, index) in options"
5
5
  @change="emitCheckboxGroupData"
6
+ :dataTest="dataTest"
6
7
  :checked="checked"
7
8
  :value="value"
8
9
  :name="name"
9
- :key="index">
10
+ :key="index"
11
+ >
10
12
  {{ text }}
11
13
  </br-form-checkbox>
12
14
  </div>
@@ -14,18 +16,18 @@
14
16
 
15
17
  <script>
16
18
  import mixins from "../../mixins/inputs";
17
- import BrFormCheckbox from "../BrFormCheckbox/Component"
19
+ import BrFormCheckbox from "../BrFormCheckbox/Component";
18
20
 
19
21
  export default {
20
22
  mixins: [mixins],
21
- props: ['options', 'name', 'id', 'model'],
23
+ props: ["options", "name", "id", "model"],
22
24
  components: {
23
25
  BrFormCheckbox,
24
26
  },
25
27
  data() {
26
28
  return {
27
29
  store: this.model,
28
- }
30
+ };
29
31
  },
30
- }
32
+ };
31
33
  </script>
@@ -2,7 +2,7 @@
2
2
  <div class="br-form-password">
3
3
  <input
4
4
  :autocomplete="autocomplete"
5
- data-test="password-field"
5
+ :data-test="dataTest"
6
6
  @input="inputChange"
7
7
  :value="password"
8
8
  name="password"
@@ -46,6 +46,10 @@ export default {
46
46
  type: String,
47
47
  default: "password",
48
48
  },
49
+ dataTest: {
50
+ type: String,
51
+ default: "password-field",
52
+ }
49
53
  },
50
54
  methods: {
51
55
  inputChange({ target }) {
@@ -2,8 +2,8 @@
2
2
  <div class="br-form-row">
3
3
  <label v-if="label" :for="id">
4
4
  <strong>{{ label }}</strong>
5
- <span v-if="label && required">(required)</span
6
- ><span v-if="label && optional">(optional)</span>
5
+ <span v-if="label && required">&nbsp;(required)</span
6
+ ><span v-if="label && optional">&nbsp;(optional)</span>
7
7
  </label>
8
8
  <div :class="[`content`, { editable }, { label }, { submit }, { radios }]">
9
9
  <br-button v-if="editable" variant="input-edit" @click="$emit('edit')">
@@ -4,20 +4,24 @@
4
4
  class="br-textarea form-control"
5
5
  :placeholder="placeholder"
6
6
  wrap="soft"
7
- :id="id"></textarea>
7
+ :id="id"
8
+ ></textarea>
8
9
  </template>
9
10
 
10
11
  <script>
11
- import mixins from '../../mixins/inputs'
12
+ import mixins from "../../mixins/inputs";
12
13
 
13
14
  export default {
14
15
  mixins: [mixins],
15
- props: ['id', 'value', 'disabled', 'placeholder'],
16
- }
16
+ props: ["id", "value", "disabled", "placeholder"],
17
+ };
17
18
  </script>
18
19
 
19
20
  <style lang="scss" scoped>
20
21
  .br-textarea {
22
+ font-family: inherit;
23
+ display: block;
21
24
  resize: none;
25
+ width: 100%;
22
26
  }
23
27
  </style>
package/mixins/inputs.js CHANGED
@@ -9,20 +9,45 @@ export default {
9
9
  methods: {
10
10
  emitInputData({ target }, name) {
11
11
  let { value, checked } = target;
12
-
12
+
13
13
  if (this.name) name = this.name;
14
14
 
15
15
  if (this.toggle) value = checked;
16
16
 
17
+ if (value === "true") value = true;
18
+
19
+ if (value === "false") value = false;
20
+
17
21
  console.log({ name, value });
18
22
 
19
23
  this.$emit("change", { name, value, checked });
20
24
  },
25
+ findItemInStore(store, option) {
26
+ let alreadyExists = false;
27
+
28
+ store.forEach(function (item) {
29
+ if (item.name == option.name) {
30
+ if (item.value == option.value) alreadyExists = true;
31
+ }
32
+ });
33
+
34
+ return alreadyExists;
35
+ },
36
+ removeItemFromStore(store, option) {
37
+ return store.filter(function (item) {
38
+ if (item.name == option.name) {
39
+ if (item.value == option.value) return false;
40
+ }
41
+ return true;
42
+ });
43
+ },
21
44
  emitCheckboxGroupData(option) {
45
+ let alreadyExists = this.findItemInStore(this.store, option);
46
+
22
47
  if (option.checked) {
23
48
  delete option.checked;
24
- this.store.push(option);
25
- } else this.store = this.store.filter((item) => item.name != option.name);
49
+ if (!alreadyExists) this.store.push(option);
50
+ } else this.store = this.removeItemFromStore(this.store, option);
26
51
 
27
52
  console.log("store: ", this.store);
28
53
 
package/package.json CHANGED
@@ -100,5 +100,5 @@
100
100
  "build:patterns": "cd patterns && rm -rf html && pug views --out html"
101
101
  },
102
102
  "style": "dist/css/barbican-reset.css",
103
- "version": "2.44.0"
103
+ "version": "2.45.0"
104
104
  }
@@ -26,6 +26,7 @@
26
26
  border-radius: $br-border-radius-lg;
27
27
  background-color: $c-grey-l96;
28
28
  line-height: 1.375rem;
29
+ font-family: inherit;
29
30
  font-size: inherit;
30
31
  color: $c-grey-l21;
31
32