@policystudio/policy-studio-ui-vue 1.1.29 → 1.1.30

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@policystudio/policy-studio-ui-vue",
3
- "version": "1.1.29",
3
+ "version": "1.1.30",
4
4
  "description": "Policy Studio UI",
5
5
  "main": "src/index.js",
6
6
  "author": "Policy Studio Team",
@@ -1,14 +1,14 @@
1
1
  <template>
2
2
  <div class='psui-el-checkbox' :class="[getComponentClass, {'disabled':disabled}]" >
3
3
  <input
4
- :id="label"
4
+ :id="getInputId"
5
5
  type="checkbox"
6
6
  :value="inputValue"
7
7
  v-model="model"
8
8
  :disabled="disabled"
9
9
  />
10
10
  <label
11
- :for="label"
11
+ :for="getInputId"
12
12
  class="psui-el-checkmark"
13
13
  :class="[labelClasses, 'psui-el-checkmark']"
14
14
  >
@@ -19,6 +19,7 @@
19
19
 
20
20
  <script>
21
21
  //FIGMA CONTROLS & SELECTORS https://www.figma.com/file/Tto8hrNlSfuPcwd1pfqogF/%E2%9A%A1%EF%B8%8F-Design-System?node-id=1768%3A64852
22
+ import { randomString } from '../../util/GeneralFunctions'
22
23
 
23
24
  export default {
24
25
  name: 'PsCheckbox',
@@ -74,6 +75,15 @@ export default {
74
75
  getComponentClass(){
75
76
  return `size-${this.size} layout-${this.layout}`
76
77
  },
78
+ getInputId() {
79
+ if (this?.inputAttrs?.id) {
80
+ return this.inputAttrs.id
81
+ } else if (this?.$attrs?.id) {
82
+ return this.$attrs.id
83
+ } else {
84
+ return randomString(16)
85
+ }
86
+ },
77
87
  model: {
78
88
  get(){
79
89
  return this.value
@@ -1,9 +1,35 @@
1
1
  <template>
2
2
  <div
3
+ v-if="withPrevent"
3
4
  class='psui-el-checkbox'
4
5
  :class="[getComponentClass, {'disabled':disabled}]"
5
6
  v-bind="getComponentAttrs"
7
+ @click.prevent="$emit('click', $event)"
8
+ >
9
+ <input
10
+ type="checkbox"
11
+ :checked="checked"
12
+ :disabled="disabled"
13
+ :name="label"
14
+ :id="getInputId"
15
+ v-bind="inputAttrs"
16
+ @change="$emit('change', $event)"
17
+ />
18
+ <label
19
+ :for="getInputId"
20
+ class="psui-el-checkmark"
6
21
  >
22
+ <slot name="content">
23
+ <span>{{ label }}</span>
24
+ </slot>
25
+ </label>
26
+ </div>
27
+ <div
28
+ v-else
29
+ class='psui-el-checkbox'
30
+ :class="[getComponentClass, {'disabled':disabled}]"
31
+ v-bind="getComponentAttrs"
32
+ >
7
33
  <input
8
34
  type="checkbox"
9
35
  :checked="checked"
@@ -11,7 +37,7 @@
11
37
  :name="label"
12
38
  :id="getInputId"
13
39
  v-bind="inputAttrs"
14
- @change="$emit('change')"
40
+ @change="$emit('change', $event)"
15
41
  />
16
42
  <label
17
43
  :for="getInputId"
@@ -40,6 +66,11 @@ export default {
40
66
  /**
41
67
  * It disables the checkbox input.
42
68
  */
69
+ withPrevent: {
70
+ type: Boolean,
71
+ default: false,
72
+ },
73
+
43
74
  disabled: {
44
75
  type: Boolean,
45
76
  default: false,