@policystudio/policy-studio-ui-vue 1.0.58 → 1.0.62

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.0.58",
3
+ "version": "1.0.62",
4
4
  "description": "Policy Studio UI",
5
5
  "main": "src/index.js",
6
6
  "author": "Policy Studio Team",
@@ -6,13 +6,18 @@
6
6
  border-bottom: 1px solid #e6ecf2;
7
7
 
8
8
  &-header {
9
- @apply psui-flex psui-cursor-pointer psui-transition-all psui-justify-between transition-default psui-text-gray-80;
9
+ @apply psui-flex psui-justify-between psui-items-center;
10
10
  padding-top: 16px;
11
11
  padding-bottom: 16px;
12
12
 
13
- &:hover {
14
- @apply psui-text-blue-60;
13
+ &-wrapper {
14
+ @apply psui-flex psui-w-full psui-cursor-pointer psui-transition-all psui-justify-between transition-default psui-text-gray-80;
15
+
16
+ &:hover {
17
+ @apply psui-text-blue-60;
18
+ }
15
19
  }
20
+
16
21
  }
17
22
 
18
23
  &-icon {
@@ -1,6 +1,6 @@
1
1
  @layer components {
2
2
  .psui-el-input-select {
3
- @apply psui-w-full psui-flex psui-flex-col psui-relative psui-text-gray-40 psui-box-border;
3
+ @apply psui-flex psui-flex-col psui-w-full psui-relative psui-text-gray-40 psui-box-border;
4
4
  transition: ease 130ms;
5
5
 
6
6
  &.disabled {
@@ -11,13 +11,17 @@
11
11
  }
12
12
 
13
13
  select {
14
- @apply psui-text-gray-40 psui-border-gray-20 psui-bg-gray-20 !important
14
+ @apply psui-text-gray-40 psui-border-gray-20 psui-bg-gray-20 !important;
15
15
  }
16
-
17
- &::after {
18
- @apply psui-z-20 psui-text-gray-50 !important;
16
+
17
+ .psui-el-input-select-wrapper {
18
+ &::after {
19
+ @apply psui-text-gray-50 !important;
20
+ z-index: 100 !important;
21
+ }
19
22
  }
20
23
  }
24
+
21
25
 
22
26
  &.layout-default {
23
27
 
@@ -26,20 +30,27 @@
26
30
  @apply psui-border-blue-50 psui-text-gray-60
27
31
  }
28
32
  }
33
+
34
+ .psui-el-input-select-wrapper {
35
+ @apply psui-relative psui-w-auto;
29
36
 
30
- &::after {
31
- @apply psui-absolute psui-inline-block psui-text-gray-50;
32
- content: 'arrow_drop_down';
33
- font-family: 'Material Icons Round';
34
- font-size: 24px;
35
- top: 38px;
36
- right: 15px;
37
- z-index: -20;
37
+ &::after {
38
+ @apply psui-absolute psui-inline-block psui-text-gray-50;
39
+ content: 'arrow_drop_down';
40
+ font-family: 'Material Icons Round';
41
+ font-size: 24px;
42
+ top: 13%;
43
+ left: calc(100% - 26px);
44
+ z-index: -20;
45
+ }
38
46
  }
47
+
39
48
 
40
49
  select {
41
- @apply psui-appearance-none psui-bg-transparent psui-text-big psui-w-full psui-border psui-border-gray-30 psui-rounded-md psui-text-gray-40;
42
- padding: 11.5px 16px;
50
+ @apply psui-appearance-none psui-bg-transparent psui-text-big psui-border psui-border-gray-30 psui-rounded-md psui-text-gray-40;
51
+ padding: 11.5px 26px 11.5px 16px;
52
+ min-width: 100%;
53
+
43
54
 
44
55
  &:hover,
45
56
  &:active {
@@ -51,6 +62,8 @@
51
62
  }
52
63
  }
53
64
 
65
+
66
+
54
67
  }
55
68
 
56
69
 
@@ -68,9 +81,22 @@
68
81
 
69
82
  &.layout-mini {
70
83
 
84
+ .psui-el-input-select-wrapper {
85
+ @apply psui-relative psui-w-full;
86
+
87
+ &::after {
88
+ @apply psui-absolute psui-inline-block psui-text-gray-50;
89
+ content: 'unfold_more';
90
+ font-family: 'Material Icons Round';
91
+ font-size: 18px;
92
+ top: 13%;
93
+ left: calc(100% - 26px);
94
+ z-index: -20;
95
+ }
96
+ }
71
97
 
72
98
  select {
73
- @apply psui-text-small psui-appearance-none psui-bg-transparent psui-w-full psui-border psui-border-gray-30;
99
+ @apply psui-text-small psui-w-full psui-appearance-none psui-bg-transparent psui-border psui-border-gray-30;
74
100
  border-radius: 4px;
75
101
  padding: 7px 8px;
76
102
 
@@ -82,26 +108,21 @@
82
108
  &:focus {
83
109
  @apply psui-border-green-70 psui-text-gray-50
84
110
  }
85
-
86
-
87
- }
88
-
89
- &::after {
90
- @apply psui-absolute psui-inline-block psui-text-gray-50 ;
91
- content: 'unfold_more';
92
- font-family: 'Material Icons Round';
93
- font-size: 18px;
94
- top: 4px;
95
- right: 4px;
96
- z-index: -20;
97
- }
111
+
112
+ }
98
113
 
99
114
  &.selected {
100
- select {
101
- @apply psui-border-green-20 psui-text-green-70
115
+
116
+ .psui-el-input-select-wrapper {
117
+ select {
118
+ @apply psui-border-green-20 !important;
119
+ }
120
+ }
121
+
122
+ &:not(option) {
123
+ @apply psui-text-green-70;
102
124
  }
103
125
  }
104
-
105
126
  }
106
127
  }
107
128
  }
@@ -1,56 +1,55 @@
1
1
  @layer components {
2
- .psui-el-mini-tag {
3
- @apply psui-flex psui-rounded-lg psui-items-center psui-justify-center psui-flex-row;
4
- width: fit-content;
5
-
6
-
7
- span {
8
- @apply psui-w-full psui-font-bold psui-uppercase;
9
- padding: 3px 8px 3px 8px;
10
- font-size: 10px;
11
- letter-spacing: 0.5px;
12
- }
13
-
14
- &-layout{
15
- &-solid-info{
16
- @apply psui-bg-blue-50 psui-text-white
17
- }
18
-
19
- &-info {
20
- @apply psui-bg-blue-20 psui-text-blue-60
21
- }
22
-
23
- &-solid-success {
24
- @apply psui-bg-green-20 psui-text-white
25
- }
26
-
27
- &-success {
28
- @apply psui-bg-green-10 psui-text-green-70
29
- }
30
-
31
- &-solid-warning {
32
- @apply psui-bg-yellow-20 psui-text-white
33
- }
34
-
35
- &-warning {
36
- @apply psui-bg-yellow-10 psui-text-yellow-70
37
- }
38
-
39
- &-solid-error {
40
- @apply psui-bg-red-20 psui-text-white
41
- }
42
-
43
- &-error {
44
- @apply psui-bg-red-10 psui-text-red-20
45
- }
46
-
47
- &-solid-default {
48
- @apply psui-bg-gray-40 psui-text-white
49
- }
50
-
51
- &-default {
52
- @apply psui-bg-gray-20 psui-text-gray-50
53
- }
54
- }
2
+ .psui-el-mini-tag {
3
+ @apply psui-flex psui-rounded-full psui-items-center psui-justify-center psui-flex-row;
4
+ width: fit-content;
5
+
6
+ span {
7
+ @apply psui-w-full psui-font-bold psui-uppercase;
8
+ padding: 3px 8px 3px 8px;
9
+ font-size: 10px;
10
+ letter-spacing: 0.5px;
55
11
  }
12
+
13
+ &-layout{
14
+ &-solid-info{
15
+ @apply psui-bg-blue-50 psui-text-white
16
+ }
17
+
18
+ &-info {
19
+ @apply psui-bg-blue-20 psui-text-blue-60
20
+ }
21
+
22
+ &-solid-success {
23
+ @apply psui-bg-green-20 psui-text-white
24
+ }
25
+
26
+ &-success {
27
+ @apply psui-bg-green-10 psui-text-green-70
28
+ }
29
+
30
+ &-solid-warning {
31
+ @apply psui-bg-yellow-20 psui-text-white
32
+ }
33
+
34
+ &-warning {
35
+ @apply psui-bg-yellow-10 psui-text-yellow-70
36
+ }
37
+
38
+ &-solid-error {
39
+ @apply psui-bg-red-20 psui-text-white
40
+ }
41
+
42
+ &-error {
43
+ @apply psui-bg-red-10 psui-text-red-20
44
+ }
45
+
46
+ &-solid-default {
47
+ @apply psui-bg-gray-40 psui-text-white
48
+ }
49
+
50
+ &-default {
51
+ @apply psui-bg-gray-20 psui-text-gray-50
52
+ }
53
+ }
54
+ }
56
55
  }
@@ -67,9 +67,7 @@
67
67
  /* Layout Underline */
68
68
  /* ----------------------------------------- */
69
69
  &.layout-underline {
70
- @apply psui-border-b psui-border-gray-20;
71
-
72
- .psui-el-tooltip{
70
+ .psui-el-tooltip {
73
71
  &:not(:last-child) {
74
72
  margin-right: 20px;
75
73
  }
@@ -1,8 +1,12 @@
1
1
  <template>
2
2
  <div class="psui-el-accordion-item" :class="`status-${isOpen ? 'opened' : 'closed'}`">
3
- <div @click="toggle" class="psui-el-accordion-item-header">
4
- <h2 v-if="title" class="psui-el-accordion-item-title">{{ title }}</h2>
5
- <i class="psui-el-accordion-item-icon">{{ getIcon }}</i>
3
+ <div class="psui-el-accordion-item-header">
4
+ <slot name='custom-header' :toggle="toggle" :isOpen="isOpen">
5
+ <div @click="toggle" class="psui-el-accordion-item-header-wrapper" v-if="!hasCustomHeader">
6
+ <h2 v-if="title" class="psui-el-accordion-item-title">{{ title }}</h2>
7
+ <i class="psui-el-accordion-item-icon">{{ getIcon }}</i>
8
+ </div>
9
+ </slot>
6
10
  </div>
7
11
  <transition
8
12
  name="accordion-fade"
@@ -20,6 +24,7 @@
20
24
 
21
25
  <script>
22
26
  import { getParentVueComponentByName } from '../../util/GeneralFunctions'
27
+
23
28
  export default {
24
29
  name: 'PsAccordionItem',
25
30
  props: {
@@ -28,7 +33,6 @@ export default {
28
33
  */
29
34
  title: {
30
35
  type: String,
31
- required: true,
32
36
  },
33
37
  /**
34
38
  * It sets the status of the accordion item when mounted.
@@ -42,6 +46,13 @@ export default {
42
46
  */
43
47
  icon: {
44
48
  type: String
49
+ },
50
+ /**
51
+ * It sets if it has a custom header
52
+ */
53
+ hasCustomHeader: {
54
+ type: Boolean,
55
+ default: false
45
56
  }
46
57
  },
47
58
  data() {
@@ -1,5 +1,9 @@
1
1
  <template>
2
- <div class="psui-el-mini-tag" :class="getComponentClass" @click="$emit('click', $event.target)" >
2
+ <div
3
+ class="psui-el-mini-tag"
4
+ :class="getComponentClass"
5
+ @click="$emit('click', $event.target)"
6
+ >
3
7
  <span>{{ message }}</span>
4
8
  </div>
5
9
  </template>
@@ -4,9 +4,16 @@
4
4
  @mouseenter="onMouseEnter"
5
5
  @mouseleave="onMouseLeave"
6
6
  class='psui-el-button'
7
- :class="[getComponentClass, {'hover': isHover}, {'disabled': disabled}]"
7
+ :class="[getComponentClass, {'hover': isHover}, {'disabled': disabled || loading }]"
8
8
  >
9
- <i v-if="icon" :class='iconClass' class='material-icons-round'>{{icon}}</i>
9
+ <svg v-if="loading"
10
+ class="psui-animate-spin psui-mr-3 psui-h-5 psui-w-5 psui-text-black"
11
+ :class="`${iconPosition == 'left' ? 'psui-mr-3' : 'psui-ml-3 psui--mr-1'}`"
12
+ xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
13
+ <circle class="psui-opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
14
+ <path class="psui-opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
15
+ </svg>
16
+ <i v-else-if="icon" :class='iconClass' class='material-icons-round'>{{icon}}</i>
10
17
  <span v-if="label">{{ label }}</span>
11
18
  </button>
12
19
  </template>
@@ -57,6 +64,13 @@ export default {
57
64
  type: Boolean,
58
65
  default: false
59
66
  },
67
+ /**
68
+ * It disable and add a spin icon to the button. All mouse event are disabled.
69
+ */
70
+ loading: {
71
+ type: Boolean,
72
+ default: false
73
+ },
60
74
  /**
61
75
  * It set any further css style that might be needed.
62
76
  */
@@ -76,7 +90,7 @@ export default {
76
90
  } else {
77
91
  return `layout-${this.layout} size-${this.size}`
78
92
  }
79
- }
93
+ },
80
94
  },
81
95
  methods: {
82
96
  onClick() {
@@ -1,23 +1,33 @@
1
1
  <template>
2
- <div class='psui-el-checkbox' @click="$emit('click')" :class="[getComponentClass, {'disabled':disabled}]" >
2
+ <div
3
+ class='psui-el-checkbox'
4
+ @click="$emit('click')"
5
+ :class="[getComponentClass, {'disabled':disabled}]"
6
+ v-bind="getComponentAttrs"
7
+ >
3
8
  <input
4
9
  type="checkbox"
5
10
  :checked="checked"
6
11
  :disabled="disabled"
7
12
  :name="label"
13
+ :id="getInputId"
14
+ v-bind="inputAttrs"
15
+ @change="$emit('change')"
8
16
  />
9
17
  <label
10
- :for="label"
18
+ :for="getInputId"
11
19
  class="psui-el-checkmark"
12
20
  >
13
- <slot v-if="!label" name="content"></slot>
14
- <span v-else>{{ label }}</span>
21
+ <slot name="content">
22
+ <span>{{ label }}</span>
23
+ </slot>
15
24
  </label>
16
25
  </div>
17
26
  </template>
18
27
 
19
28
  <script>
20
29
  //FIGMA CONTROLS & SELECTORS https://www.figma.com/file/Tto8hrNlSfuPcwd1pfqogF/%E2%9A%A1%EF%B8%8F-Design-System?node-id=1768%3A64852
30
+ import { randomString } from '../../util/GeneralFunctions'
21
31
 
22
32
  export default {
23
33
  name: 'PsCheckboxSimple',
@@ -35,10 +45,20 @@ export default {
35
45
  type: Boolean,
36
46
  default: false,
37
47
  },
48
+ /**
49
+ * Sets the input as checked
50
+ */
38
51
  checked: {
39
52
  type: Boolean,
40
53
  default: false
41
54
  },
55
+ /**
56
+ * Add html attributes to the element input
57
+ */
58
+ inputAttrs: {
59
+ type: Object,
60
+ default: () => ({})
61
+ },
42
62
  /**
43
63
  * It set the of the checkbox input. eg: big and small.
44
64
  */
@@ -56,10 +76,25 @@ export default {
56
76
  validator: (value)=> ['default','mixed'].includes(value)
57
77
  }
58
78
  },
79
+ inheritAttrs: false,
59
80
  computed:{
60
81
  getComponentClass(){
61
82
  return `size-${this.size} layout-${this.layout}`
62
- },
83
+ },
84
+ getInputId() {
85
+ if (this?.inputAttrs?.id) {
86
+ return this.inputAttrs.id
87
+ } else if (this?.$attrs?.id) {
88
+ return this.$attrs.id
89
+ } else {
90
+ return randomString(16)
91
+ }
92
+ },
93
+ getComponentAttrs() {
94
+ let componentAttrs = { ... this.$attrs }
95
+ delete componentAttrs.id
96
+ return componentAttrs
97
+ }
63
98
  },
64
99
  }
65
100
  </script>
@@ -32,14 +32,14 @@
32
32
  class="psui-w-full psui-flex psui-items-center"
33
33
  >
34
34
  <span class="psui-el-draggable-item-title">
35
- <PsCheckbox
35
+ <PsCheckboxSimple
36
36
  size="small"
37
- :value="column.isActive"
38
37
  :label="column.title"
39
38
  :class="{'active' : column.isActive}"
39
+ :checked="column.isActive"
40
40
  :disabled="column.isDisabled"
41
41
  class="psui-el-draggable-item-checkbox"
42
- @input="$emit('on-select-item', { studyKey: getColumns.key, indexColumnGroup, indexColumn, columnGroupKey: columnGroup.key })"
42
+ @change="$emit('on-select-item', { studyKey: getColumns.key, indexColumnGroup, indexColumn, columnGroupKey: columnGroup.key })"
43
43
  />
44
44
  </span>
45
45
  <span class="psui-el-draggable-item-append">
@@ -80,7 +80,6 @@ export default {
80
80
  },
81
81
  computed: {
82
82
  getStatus() {
83
- console.log('var:', this.column.key)
84
83
  if (this.column.key == 'compliance_margin') {
85
84
  return true
86
85
  } else {
@@ -70,6 +70,13 @@ export default {
70
70
  type: Boolean,
71
71
  default: true,
72
72
  },
73
+ /**
74
+ * Disable the toogle on click. default: false.
75
+ */
76
+ disabled: {
77
+ type: Boolean,
78
+ default: false,
79
+ },
73
80
  },
74
81
  data() {
75
82
  return {
@@ -90,6 +97,8 @@ export default {
90
97
  },
91
98
  methods: {
92
99
  toggle() {
100
+ if (this.disabled) return
101
+
93
102
  if (!this.show) {
94
103
  this.open()
95
104
  } else {
@@ -1,6 +1,7 @@
1
1
  <template>
2
- <div class="psui-el-input-select" :class="[{'disabled':disabled}, getComponentClass, {'selected':selectedClass}]">
2
+ <div class="psui-el-input-select" :class="[getComponentClass, {'selected':selectedClass}, {'disabled':disabled}]">
3
3
  <label :for='label' v-if="label" >{{ label }}</label>
4
+ <div class="psui-el-input-select-wrapper">
4
5
  <select
5
6
  :name="label"
6
7
  :id="label"
@@ -9,6 +10,7 @@
9
10
  <option value='' disabled>Select</option>
10
11
  <option v-for="item in getItems" :value="item[keyValue]" :key="item[keyValue]">{{ item[keyLabel] }}</option>
11
12
  </select>
13
+ </div>
12
14
  <p v-if="optionalLabel && !disabled && layout !== 'mini'" class="psui-el-input-helper">{{ optionalLabel }}</p>
13
15
  </div>
14
16
  </template>
@@ -16,7 +18,7 @@
16
18
  <script>
17
19
 
18
20
  export default {
19
- name: 'PsSelectInput',
21
+ name: 'PsInputSelect',
20
22
  props: {
21
23
  /**
22
24
  * It sets the items which will be rendered within the select input.