barbican-reset 3.11.0 → 3.13.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.
@@ -3,15 +3,16 @@
3
3
  @input="$emit('update:modelValue', $event.target.value)"
4
4
  v-bind="$attrs"
5
5
  :autocomplete="autocomplete"
6
+ :placeholder="placeholder"
6
7
  :required="required"
7
8
  :disabled="disabled"
8
- :id="generateID"
9
9
  :value="modelValue"
10
+ :id="generateID"
10
11
  :type="type"
11
12
  :name="name"
12
13
  :min="min"
13
14
  :max="max" />
14
- <label v-if="$slots.default" :for="generateID" ref="label"><slot /></label>
15
+ <label v-if="$slots.default" v-bind="label"><slot /></label>
15
16
  </template>
16
17
 
17
18
  <script>
@@ -24,6 +25,7 @@ export default {
24
25
  props: [
25
26
  'modelValue',
26
27
  'autocomplete',
28
+ 'placeholder',
27
29
  'required',
28
30
  'disabled',
29
31
  'value',
@@ -33,5 +35,13 @@ export default {
33
35
  'max',
34
36
  'id',
35
37
  ],
38
+ data() {
39
+ return {
40
+ label: {
41
+ for: this.generateID,
42
+ ref: 'label',
43
+ },
44
+ }
45
+ },
36
46
  }
37
47
  </script>
@@ -0,0 +1,16 @@
1
+ <template>
2
+ <input
3
+ @input="$emit('input', $event.target.value)"
4
+ :value="value"
5
+ :type="type"
6
+ :min="min"
7
+ :max="max"
8
+ :id="id" />
9
+ </template>
10
+
11
+ <script>
12
+ export default {
13
+ props: ['value', 'type', 'id', 'min', 'max'],
14
+ emits: ['input'],
15
+ }
16
+ </script>
@@ -4,38 +4,37 @@
4
4
  v-bind="$attrs"
5
5
  v-model="model"
6
6
  :disabled="disabled"
7
- :id="randomId"
7
+ :id="generateID"
8
8
  :value="value"
9
9
  type="radio"
10
- :name="name"
11
- />
12
- <label v-if="$slots.default" :for="randomId" ref="label"><slot /></label>
10
+ :name="name" />
11
+ <label v-if="$slots.default" :for="generateID" ref="label"><slot /></label>
13
12
  </div>
14
13
  </template>
15
14
 
16
15
  <script>
16
+ import inputs from '#mixins/inputs'
17
+
17
18
  export default {
19
+ mixins: [inputs],
18
20
  inheritAttrs: false, // Allow us to put attributes on the input.
19
21
  // @TODO:
20
22
  // We may be able to get rid of name, value & disabled if we are using v-bind="$attrs"
21
- props: ["id", "name", "value", "disabled", "modelValue"],
22
- emits: ["update:modelValue", "change"],
23
+ props: ['id', 'name', 'value', 'disabled', 'modelValue'],
24
+ emits: ['update:modelValue', 'change'],
23
25
  computed: {
24
26
  // You cannot use a prop with v-model, it results in the below error. The suggested option is to have a local
25
27
  // property that wraps around the modelValue prop.
26
28
  // Error: VueCompilerError: v-model cannot be used on a prop, because local prop bindings are not writable.
27
29
  model: {
28
30
  get() {
29
- return this.modelValue;
31
+ return this.modelValue
30
32
  },
31
33
  set(value) {
32
- this.$emit("update:modelValue", value);
33
- this.$emit("change", { value }); // Support @change.
34
+ this.$emit('update:modelValue', value)
35
+ this.$emit('change', { value }) // Support @change.
34
36
  },
35
37
  },
36
- randomId() {
37
- return (Math.random() + 1).toString(36).substring(7);
38
- },
39
38
  },
40
- };
39
+ }
41
40
  </script>
@@ -24,8 +24,10 @@
24
24
  <script>
25
25
  import BrButton from '#components/BrButton.vue'
26
26
  import EditIcon from '#icons/account/edit.vue'
27
+ import mixins from '#mixins/inputs'
27
28
 
28
29
  export default {
30
+ mixins: [mixins],
29
31
  components: {
30
32
  BrButton,
31
33
  EditIcon,
@@ -60,19 +62,7 @@ export default {
60
62
  type: String,
61
63
  },
62
64
  },
63
- methods: {
64
- createKebabCase(value = '') {
65
- return value.toLowerCase().split(' ').join('-')
66
- },
67
- },
68
65
  computed: {
69
- generateInputID() {
70
- if (!this.label) {
71
- return 'undefined'
72
- }
73
-
74
- return this.input_id ? this.input_id : this.createKebabCase(this.label)
75
- },
76
66
  styleRow() {
77
67
  let styles = ['br-form-row']
78
68
 
@@ -0,0 +1,102 @@
1
+ <template>
2
+ <div v-bind="container">
3
+ <div v-for="item in total" :key="'bar-' + item" v-bind="status">
4
+ <div v-bind="progress(item)" />
5
+ </div>
6
+ </div>
7
+ </template>
8
+
9
+ <script>
10
+ export default {
11
+ props: {
12
+ total: {
13
+ type: Number,
14
+ default: 1,
15
+ },
16
+ foreground: {
17
+ type: String,
18
+ default: 'white',
19
+ },
20
+ background: {
21
+ type: String,
22
+ default: 'grey',
23
+ },
24
+ complete: {
25
+ type: Number,
26
+ default: 0,
27
+ },
28
+ gap: {
29
+ type: Number,
30
+ default: 1,
31
+ },
32
+ height: {
33
+ type: Number,
34
+ default: 0.75,
35
+ },
36
+ radius: {
37
+ type: Number,
38
+ default: 0,
39
+ },
40
+ },
41
+ methods: {
42
+ progress(index) {
43
+ let isComplete = index <= this.complete
44
+
45
+ let style = []
46
+
47
+ style.push('background-color: ' + this.foreground + ';')
48
+
49
+ style.push('height: ' + this.height + 'rem;')
50
+
51
+ if (isComplete) {
52
+ style.push('width: 100%;')
53
+ }
54
+
55
+ return {
56
+ class: 'progress-bar',
57
+ style: style.join(' '),
58
+ }
59
+ },
60
+ },
61
+ computed: {
62
+ container() {
63
+ let style = []
64
+
65
+ style.push('grid-template-columns: repeat(' + this.total + ', 1fr);')
66
+
67
+ style.push('grid-gap: ' + this.gap + 'rem;')
68
+
69
+ style.push('gap: ' + this.gap + 'rem;')
70
+
71
+ style.push('border-radius: ' + this.radius + 'rem;')
72
+
73
+ return {
74
+ 'data-cy': 'status--bars',
75
+ class: 'status--bars',
76
+ style: style.join(' '),
77
+ }
78
+ },
79
+ status() {
80
+ let style = []
81
+
82
+ style.push('background-color: ' + this.background + ';')
83
+
84
+ return {
85
+ class: 'status--bar',
86
+ style: style.join(' '),
87
+ }
88
+ },
89
+ },
90
+ }
91
+ </script>
92
+
93
+ <style>
94
+ .status--bars {
95
+ overflow: hidden;
96
+ display: grid;
97
+ }
98
+
99
+ .progress-bar {
100
+ width: 0;
101
+ }
102
+ </style>