barbican-reset 2.53.0 → 2.54.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.
@@ -2,16 +2,16 @@
2
2
  <div class="br-checkbox">
3
3
  <!-- @TODO: remove success prop and style scss from br-checkbox inheritence? -->
4
4
  <input
5
- @change="(event) => emitInputData(event, 'checkbox')"
6
- :data-test="dataTest"
5
+ v-bind="$attrs"
7
6
  :disabled="disabled"
8
7
  :success="success"
9
8
  :checked="checked"
10
9
  :id="generateID"
11
10
  type="checkbox"
12
11
  :table="table"
13
- :value="value"
14
12
  :name="name"
13
+ v-model="model"
14
+ :value="value"
15
15
  />
16
16
  <label v-if="$slots.default" :for="generateID" ref="label"><slot /></label>
17
17
  </div>
@@ -21,17 +21,34 @@
21
21
  import mixins from "../../mixins/inputs";
22
22
 
23
23
  export default {
24
+ compatConfig: { COMPONENT_V_MODEL: false }, // THIS LINE IS IMPORTANT, WILL NOT WORK WITHOUT.
25
+ inheritAttrs: false, // Allow us to put attributes on the input.
24
26
  mixins: [mixins],
27
+ emits: ["update:modelValue", "change"],
25
28
  props: [
26
- "dataTest",
29
+ "modelValue",
27
30
  "disabled",
28
31
  "success",
29
32
  "checked",
30
33
  "toggle",
31
34
  "table",
32
- "value",
33
35
  "name",
34
36
  "id",
37
+ "value",
35
38
  ],
39
+ computed: {
40
+ // You cannot use a prop with v-model, it results in the below error. The suggested option is to have a local
41
+ // property that wraps around the modelValue prop.
42
+ // Error: VueCompilerError: v-model cannot be used on a prop, because local prop bindings are not writable.
43
+ model: {
44
+ get() {
45
+ return this.modelValue;
46
+ },
47
+ set(value) {
48
+ this.$emit("update:modelValue", value);
49
+ this.$emit("change", { value }); // Support @change.
50
+ },
51
+ },
52
+ },
36
53
  };
37
54
  </script>
@@ -3,10 +3,10 @@
3
3
  <template v-if="options">
4
4
  <br-form-checkbox
5
5
  v-for="({ value, checked, text, dataTest }, index) in options"
6
- @change="emitCheckboxGroupData"
6
+ v-model="model"
7
+ :value="value"
7
8
  :dataTest="dataTest"
8
9
  :checked="checked"
9
- :value="value"
10
10
  :name="name"
11
11
  :key="index"
12
12
  >
@@ -18,19 +18,23 @@
18
18
  </template>
19
19
 
20
20
  <script>
21
- import mixins from "../../mixins/inputs";
22
21
  import BrFormCheckbox from "../BrFormCheckbox/Component";
23
22
 
24
23
  export default {
25
- mixins: [mixins],
26
- props: ["options", "name", "id", "model"],
24
+ compatConfig: { COMPONENT_V_MODEL: false }, // THIS LINE IS IMPORTANT, WILL NOT WORK WITHOUT.
25
+ props: ["modelValue", "options", "name", "id"],
27
26
  components: {
28
27
  BrFormCheckbox,
29
28
  },
30
- data() {
31
- return {
32
- store: this.model,
33
- };
29
+ computed: {
30
+ model: {
31
+ get() {
32
+ return this.modelValue;
33
+ },
34
+ set(value) {
35
+ this.$emit("update:modelValue", value);
36
+ },
37
+ },
34
38
  },
35
39
  };
36
40
  </script>
@@ -1,12 +1,12 @@
1
1
  <template>
2
2
  <input
3
- @input="(event) => emitInputData(event, 'input')"
3
+ @input="$emit('update:modelValue', $event.target.value)"
4
+ v-bind="$attrs"
4
5
  :autocomplete="autocomplete"
5
- :data-test="dataTest"
6
6
  :required="required"
7
7
  :disabled="disabled"
8
8
  :id="generateID"
9
- :value="value"
9
+ :value="modelValue"
10
10
  :type="type"
11
11
  :name="name"
12
12
  :min="min"
@@ -19,10 +19,13 @@
19
19
  import mixins from "../../mixins/inputs";
20
20
 
21
21
  export default {
22
+ compatConfig: { COMPONENT_V_MODEL: false }, // THIS LINE IS IMPORTANT, WILL NOT WORK WITHOUT.
23
+ inheritAttrs: false, // Allow us to put attributes on the input.
22
24
  mixins: [mixins],
25
+ emits: ["update:modelValue"],
23
26
  props: [
27
+ "modelValue",
24
28
  "autocomplete",
25
- "dataTest",
26
29
  "required",
27
30
  "disabled",
28
31
  "value",
@@ -1,14 +1,15 @@
1
1
  <template>
2
2
  <div class="br-form-password">
3
3
  <input
4
+ v-bind="$attrs"
4
5
  :autocomplete="autocomplete"
5
- :data-test="dataTest"
6
- @input="inputChange"
7
- :value="password"
6
+ @input="$emit('update:modelValue', $event.target.value)"
7
+ :value="modelValue"
8
8
  name="password"
9
9
  :type="type"
10
10
  required
11
11
  :id="id"
12
+ :data-test="dataTest"
12
13
  />
13
14
  <br-button
14
15
  @click="showPassword = !showPassword"
@@ -30,6 +31,9 @@ import HidePasswordIcon from "../icons/password/hide";
30
31
  import ShowPasswordIcon from "../icons/password/show";
31
32
 
32
33
  export default {
34
+ compatConfig: { COMPONENT_V_MODEL: false }, // THIS LINE IS IMPORTANT, WILL NOT WORK WITHOUT.
35
+ inheritAttrs: false, // Allow us to put attributes on the input.
36
+ emits: ["update:modelValue"],
33
37
  data() {
34
38
  return {
35
39
  password: "",
@@ -42,6 +46,7 @@ export default {
42
46
  BrButton,
43
47
  },
44
48
  props: {
49
+ modelValue: {},
45
50
  id: {
46
51
  type: String,
47
52
  default: "password",
@@ -49,15 +54,6 @@ export default {
49
54
  dataTest: {
50
55
  type: String,
51
56
  default: "password-field",
52
- }
53
- },
54
- methods: {
55
- inputChange({ target }) {
56
- let { value } = target;
57
-
58
- this.password = value;
59
-
60
- this.$emit("change", value);
61
57
  },
62
58
  },
63
59
  computed: {
@@ -1,23 +1,42 @@
1
1
  <template>
2
2
  <div class="custom-radio">
3
3
  <input
4
- @input="(event) => emitInputData(event, 'radio')"
5
- :data-test="dataTest"
4
+ v-bind="$attrs"
5
+ v-model="model"
6
6
  :disabled="disabled"
7
- :checked="checked"
8
- :id="generateID"
7
+ :id="randomId"
9
8
  :value="value"
10
9
  type="radio"
11
- :name="name" />
12
- <label v-if="$slots.default" :for="generateID" ref="label"><slot /></label>
10
+ :name="name"
11
+ />
12
+ <label v-if="$slots.default" :for="randomId" ref="label"><slot /></label>
13
13
  </div>
14
14
  </template>
15
15
 
16
16
  <script>
17
- import mixins from '../../mixins/inputs'
18
-
19
17
  export default {
20
- mixins: [mixins],
21
- props: ['id', 'name', 'value', 'disabled', 'dataTest', 'checked'],
22
- }
18
+ compatConfig: { COMPONENT_V_MODEL: false }, // THIS LINE IS IMPORTANT, WILL NOT WORK WITHOUT.
19
+ inheritAttrs: false, // Allow us to put attributes on the input.
20
+ // @TODO:
21
+ // We may be able to get rid of name, value & disabled if we are using v-bind="$attrs"
22
+ props: ["id", "name", "value", "disabled", "modelValue"],
23
+ emits: ["update:modelValue", "change"],
24
+ computed: {
25
+ // You cannot use a prop with v-model, it results in the below error. The suggested option is to have a local
26
+ // property that wraps around the modelValue prop.
27
+ // Error: VueCompilerError: v-model cannot be used on a prop, because local prop bindings are not writable.
28
+ model: {
29
+ get() {
30
+ return this.modelValue;
31
+ },
32
+ set(value) {
33
+ this.$emit("update:modelValue", value);
34
+ this.$emit("change", { value }); // Support @change.
35
+ },
36
+ },
37
+ randomId() {
38
+ return (Math.random() + 1).toString(36).substring(7);
39
+ },
40
+ },
41
+ };
23
42
  </script>
@@ -2,13 +2,13 @@
2
2
  <div role="radiogroup" :id="id">
3
3
  <template v-if="options">
4
4
  <br-form-radio
5
- v-for="({ value, checked, text }, index) in options"
6
- @change="(event) => $emit('change', event)"
7
- :checked="checked"
8
- :value="value"
5
+ v-for="(option, index) in options"
6
+ v-model="model"
7
+ :value="option.value"
9
8
  :key="index"
10
- :name="name">
11
- {{ text }}
9
+ :name="name"
10
+ >
11
+ {{ option.text }}
12
12
  </br-form-radio>
13
13
  </template>
14
14
  <slot v-else></slot>
@@ -17,6 +17,23 @@
17
17
 
18
18
  <script>
19
19
  export default {
20
- props: ['options', 'name', 'id'],
21
- }
20
+ compatConfig: { COMPONENT_V_MODEL: false }, // THIS LINE IS IMPORTANT, WILL NOT WORK WITHOUT.
21
+ props: {
22
+ modelValue: { type: [Array, Boolean] },
23
+ options: { type: Object },
24
+ name: { type: String },
25
+ id: { type: String },
26
+ },
27
+ computed: {
28
+ model: {
29
+ get() {
30
+ return this.modelValue;
31
+ },
32
+ set(value) {
33
+ this.$emit("update:modelValue", value);
34
+ },
35
+ },
36
+ },
37
+ emits: ["update:modelValue"],
38
+ };
22
39
  </script>
@@ -1,19 +1,19 @@
1
1
  <template>
2
2
  <textarea
3
- @input="(event) => emitInputData(event, 'textarea')"
3
+ @input="$emit('update:modelValue', $event.target.value)"
4
4
  class="br-textarea form-control"
5
5
  :placeholder="placeholder"
6
6
  wrap="soft"
7
7
  :id="id"
8
+ :value="modelValue"
8
9
  ></textarea>
9
10
  </template>
10
11
 
11
12
  <script>
12
- import mixins from "../../mixins/inputs";
13
-
14
13
  export default {
15
- mixins: [mixins],
16
- props: ["id", "value", "disabled", "placeholder"],
14
+ compatConfig: { COMPONENT_V_MODEL: false }, // THIS LINE IS IMPORTANT, WILL NOT WORK WITHOUT.
15
+ emits: ["update:modelValue"],
16
+ props: ["modelValue", "id", "value", "disabled", "placeholder"],
17
17
  };
18
18
  </script>
19
19
 
package/package.json CHANGED
@@ -112,5 +112,5 @@
112
112
  "style:patterns": "cd patterns && gulp build:css",
113
113
  "build:patterns": "cd patterns && rm -rf html && pug views --out html"
114
114
  },
115
- "version": "2.53.0"
115
+ "version": "2.54.0"
116
116
  }
@@ -1,27 +0,0 @@
1
- <template>
2
- <div>
3
- <br-form-checkbox
4
- @change="({ value }) => (newsletterOptIn = value)"
5
- data-test="requires-companion-option"
6
- :default="newsletterOptIn"
7
- id="newsletter-signup"
8
- :disabled="false"
9
- :toggle="true"
10
- :table="false"
11
- :value="true"
12
- success>
13
- Keep me up to date with news, events and offers from the Barbican
14
- </br-form-checkbox>
15
- {{ newsletterOptIn }}
16
- </div>
17
- </template>
18
-
19
- <script>
20
- export default {
21
- data() {
22
- return {
23
- newsletterOptIn: false,
24
- }
25
- },
26
- }
27
- </script>
@@ -1,42 +0,0 @@
1
- <template>
2
- <div style="padding: 100px">
3
- <br-form-checkbox
4
- @change="({ value }) => (boolean = value)"
5
- data-test="checkbox-test-data"
6
- id="checkbox-id"
7
- :disabled="false"
8
- :toggle="true"
9
- :table="false"
10
- :value="true"
11
- success
12
- >
13
- Lorem ipsum dolor sit amet.
14
- </br-form-checkbox>
15
- <br-form-checkbox-group
16
- @change="(value) => (model = value)"
17
- data-test="checkbox-test-data"
18
- class="checkbox-class"
19
- name="checkbox-name"
20
- id="checkbox-id"
21
- :options="options"
22
- :model="model"
23
- />
24
- {{ boolean }}
25
- {{ model.length ? model : "nothing" }}
26
- </div>
27
- </template>
28
-
29
- <script>
30
- export default {
31
- data() {
32
- return {
33
- boolean: false,
34
- model: [],
35
- options: [
36
- { text: "Orange text", value: "orange", checked: true },
37
- { text: "Apple text", value: "apple", checked: false },
38
- ],
39
- };
40
- },
41
- };
42
- </script>
@@ -1,64 +0,0 @@
1
- <template>
2
- <div>
3
- <br-form-row>
4
- <br-form-radio
5
- @change="({ value }) => (radio = value)"
6
- name="radio"
7
- value="true">
8
- true
9
- </br-form-radio>
10
- <br-form-radio
11
- @change="({ value }) => (radio = value)"
12
- name="radio"
13
- value="false">
14
- false
15
- </br-form-radio>
16
- </br-form-row>
17
- <br-form-row>
18
- <br-form-input
19
- @change="({ value }) => (gift.sendDate = value)"
20
- :min="minimumSendDate"
21
- :max="maximumSendDate"
22
- data-test="send-date"
23
- type="date" />
24
- <br-form-input
25
- @change="({ value }) => (email = value)"
26
- data-test="login-form-email"
27
- autocomplete="username"
28
- value="disabled"
29
- class="custom"
30
- type="email"
31
- name="email"
32
- :disabled="false"
33
- :required="true" />
34
- </br-form-row>
35
- <br-form-row>
36
- {{ email }}
37
- {{ radio }}
38
- </br-form-row>
39
- </div>
40
- </template>
41
-
42
- <script>
43
- import { DateTime } from 'luxon'
44
-
45
- export default {
46
- computed: {
47
- minimumSendDate() {
48
- return DateTime.now().toISODate()
49
- },
50
- maximumSendDate() {
51
- return DateTime.now().plus({ years: 1 }).toISODate()
52
- },
53
- },
54
- data() {
55
- return {
56
- radio: 'radio',
57
- email: 'email',
58
- gift: {
59
- sendDate: '',
60
- },
61
- }
62
- },
63
- }
64
- </script>
@@ -1,33 +0,0 @@
1
- <template>
2
- <div v-for="(group, index) in radios" :key="index">
3
- <div>{{ group.default }}</div>
4
- <br-form-radio
5
- v-for="(option, index) in group.options"
6
- @change="({ value }) => (group.default = value)"
7
- :default="group.default"
8
- data-test="here it is"
9
- :name="group.name"
10
- :value="option"
11
- :key="index">
12
- {{ option }}
13
- </br-form-radio>
14
- </div>
15
- </template>
16
-
17
- <script>
18
- export default {
19
- data() {
20
- return {
21
- radios: [
22
- { name: 'testA', default: true, options: [true, false] },
23
- { name: 'testB', default: 16, options: [32, 46, 75] },
24
- {
25
- name: 'testC',
26
- default: 'sentence',
27
- options: ['paul', 'gareth', 'andrew'],
28
- },
29
- ],
30
- }
31
- },
32
- }
33
- </script>
@@ -1,22 +0,0 @@
1
- <template>
2
- <br-form-radio-group
3
- @change="({ value }) => (contactMeSelection = value)"
4
- data-test="global-opt-in"
5
- name="contact-me-options"
6
- :options="yesNoOptions"
7
- id="radio-slots" />
8
- </template>
9
-
10
- <script>
11
- export default {
12
- data() {
13
- return {
14
- contactMeSelection: true,
15
- yesNoOptions: [
16
- { text: 'Yes', value: true, checked: true },
17
- { text: 'No', value: false, checked: false },
18
- ],
19
- }
20
- },
21
- }
22
- </script>
@@ -1,22 +0,0 @@
1
- <template>
2
- <div style="padding: 100px">
3
- <br-form-textarea
4
- @change="({ value }) => (gift.message = value)"
5
- placeholder="placeholder"
6
- data-test="data-test"
7
- rows="6" />
8
- {{ gift.message }}
9
- </div>
10
- </template>
11
-
12
- <script>
13
- export default {
14
- data() {
15
- return {
16
- gift: {
17
- message: '',
18
- },
19
- }
20
- },
21
- }
22
- </script>