@policystudio/policy-studio-ui-vue 1.0.22 → 1.0.26

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.
@@ -1,34 +1,16 @@
1
1
  <template>
2
- <div class="container">
3
- <div
4
- @click="toggleTitle"
5
- :class="cssClass"
6
- class="
7
- psui-flex psui-cursor-pointer psui-transition-all psui-justify-between
8
- "
9
- >
10
- <div
11
- v-if="title"
12
- :class="display ? 'selected' : ''"
13
- class="psui-font-bold psui-gray04"
14
- >
15
- {{ title }}
16
- </div>
17
- <i v-if="!display" class="material-icons">{{ iconClass.closed }}</i>
18
- <i v-else :class="display ? 'selected' : ''" class="material-icons">{{
19
- iconClass.open
20
- }}</i>
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 material-icons">{{ getIcon }}</i>
21
6
  </div>
22
- <div v-if="display" class="psui-transition-all psui-duration-300">
7
+ <div v-if="isOpen" class="psui-el-accordion-item-content">
23
8
  <slot></slot>
24
9
  </div>
25
10
  </div>
26
11
  </template>
27
12
 
28
13
  <script>
29
- export const iconTypes = ["mathsign", "chevron"]
30
- export const fontCss = ["medium", "big"]
31
-
32
14
  export default {
33
15
  name: "PsAccordionItem",
34
16
  props: {
@@ -36,67 +18,54 @@ export default {
36
18
  type: String,
37
19
  required: true,
38
20
  },
39
- iconType: {
21
+ 'iconOpened': {
40
22
  type: String,
41
- default: "chevron",
42
23
  },
43
- fontCss: {
24
+ 'iconClosed': {
44
25
  type: String,
45
- default: "medium",
46
26
  },
27
+ opened: {
28
+ type: [Boolean],
29
+ default: false
30
+ }
47
31
  },
48
32
  data() {
49
33
  return {
50
- display: false,
34
+ localOpened: null,
51
35
  }
52
36
  },
53
37
  computed: {
54
- iconClass() {
55
- if (this.iconType === "chevron") {
56
- return { closed: "expand_more", open: "expand_less" }
57
- } else if (this.iconType === "mathsign") {
58
- return { closed: "add", open: "remove" }
38
+ getIcons() {
39
+ return {
40
+ 'iconOpened' : this.iconOpened ?? this.getParentVueComponentByName(this.$parent, 'PsAccordion').getIcons.iconOpened,
41
+ 'iconClosed' : this.iconClosed ?? this.getParentVueComponentByName(this.$parent, 'PsAccordion').getIcons.iconClosed,
59
42
  }
60
- return ''
61
43
  },
62
- cssClass() {
63
- if (this.fontCss === "big") return "big"
64
- return "medium"
44
+ getIcon() {
45
+ return this.isOpen ? this.getIcons.iconOpened : this.getIcons.iconClosed
65
46
  },
47
+ isOpen() {
48
+ return this.localOpened !== null ? this.localOpened : this.opened
49
+ }
66
50
  },
67
51
  methods: {
68
- toggleTitle() {
69
- this.display = !this.display
52
+ toggle() {
53
+ if (this.localOpened === null) {
54
+ this.localOpened = !this.opened
55
+ } else {
56
+ this.localOpened = !this.localOpened
57
+ }
70
58
  },
71
- },
59
+ getParentVueComponentByName(comp, name) {
60
+ if (comp.$options.name === name) {
61
+ return comp
62
+ } else {
63
+ return this.getParentVueComponentByName(comp.$parent, name)
64
+ }
65
+ }
66
+ }
72
67
  }
73
68
  </script>
74
69
 
75
- <style scoped>
76
- .container {
77
- border-bottom: 1px solid #e6ecf2;
78
- padding-top: 16px;
79
- padding-bottom: 16px;
80
- }
81
-
82
- span {
83
- font-weight: 700;
84
- color: #e6ecf2;
85
- }
86
-
87
- .selected {
88
- color: #318fac;
89
- transition: color 300ms;
90
- }
91
-
92
- .big {
93
- font-size: 18px;
94
- line-height: 130%;
95
- }
96
-
97
- .medium {
98
- font-size: 16px;
99
- line-height: 130%;
100
- }
101
- </style>
70
+ <style> /* Please, use the file src/assets/scss/components/PsAccordion.scss */</style>
102
71
 
@@ -0,0 +1,38 @@
1
+ <template>
2
+ <div class="psui-border psui-border-gray-20 psui-rounded-md psui-flex psui-flex-col psui-items-center psui-justify-center psui-px-3 psui-py-2 psui-space-y-2">
3
+ <h5 class="psui-text-xsmall psui-font-bold psui-text-gray-40">
4
+ <span class="psui-text-gray-60">{{ title }} </span>{{ subtitle }}
5
+ </h5>
6
+ <div class="psui-w-full psui-flex psui-justify-center psui-items-center psui-space-x-2 psui-text-p">
7
+ <span class="psui-text-blue-50 material-icons-round">{{ icon }}</span>
8
+ <h5 class="psui-text-gray-80">{{ total }}</h5>
9
+ </div>
10
+ </div>
11
+ </template>
12
+
13
+ <script>
14
+ export default {
15
+ name: 'PsCardInfos',
16
+ props: {
17
+ title: {
18
+ type: String,
19
+ default: 'Total',
20
+ },
21
+ subtitle: {
22
+ type: String,
23
+ default: '',
24
+ },
25
+ icon: {
26
+ type: String,
27
+ default: 'edit',
28
+ },
29
+ total: {
30
+ type: String,
31
+ default: '',
32
+ },
33
+ }
34
+ }
35
+ </script>
36
+
37
+ <style scoped>
38
+ </style>
@@ -1,15 +1,12 @@
1
1
  <template>
2
- <div class="toView psui-flex psui-flex-row psui-p-8 psui-rounded">
3
- <div class="container psui-p-2 psui-rounded">
4
- <div class="psui-flex">
5
- <div class="dot"></div>
6
- <div class="text">{{ text }}</div>
7
- </div>
8
- <div class="container1">
9
- <span v-if="this.value" :class="isValue">{{ value }}</span>
10
- <span :class="isBar"></span>
11
- <span :class="isPercentage">{{ percentage }}</span>
12
- </div>
2
+ <div class="psui-flex psui-p-2 psui-rounded">
3
+ <div class="psui-flex psui-flex-shrink-0">
4
+ <div class="dot psui-rounded-full" :style="dotColor"></div>
5
+ </div>
6
+ <div class="psui-flex-grow-1">
7
+ <div class="psui-text-xsmall psui-text-gray-50 psui-font-bold psui-mb-1">{{ text }}</div>
8
+ <span v-if="this.total" class="psui-text-p psui-text-gray-80">{{ total }}</span>
9
+ <span class="psui-text-gray-50" v-if="percentage"><span class="psui-text-gray-30" v-if="total && percentage"> | </span>{{ percentage }}%</span>
13
10
  </div>
14
11
  </div>
15
12
  </template>
@@ -21,108 +18,26 @@ export default {
21
18
  type: String,
22
19
  default: 'Climate Zone 10',
23
20
  },
24
- value: {
25
- type: Number,
26
- // required: true,
21
+ total: {
22
+ type: String,
27
23
  default: null,
28
24
  },
29
25
  percentage: {
30
26
  type: String,
31
- // required: true,
32
- default: '',
33
- },
34
- },
35
- computed: {
36
- isValue() {
37
- if (this.value) {
38
- return 'value'
39
- } else {
40
- return 'hide'
41
- }
42
- },
43
- isPercentage() {
44
- if (this.percentage) {
45
- return 'percentage'
46
- } else {
47
- return 'hide'
48
- }
27
+ default: null,
49
28
  },
50
- isBar() {
51
- if (this.value !== 0 && this.percentage !== '') {
52
- return 'bar'
53
- } else {
54
- return 'hide'
55
- }
29
+ dotColor: {
30
+ type: Object,
31
+ default: null
56
32
  },
57
33
  },
58
34
  }
59
35
  </script>
60
36
 
61
37
  <style scoped>
62
- .toView {
63
- /* display: flex; */
64
- /* flex-direction: row; */
65
- /* padding: 32px; */
66
-
67
- width: 351px;
68
- height: 119px;
69
-
70
- background: #f3ebfa;
71
- border: 1.5px dashed #7b61ff;
72
- /* border-radius: 5px; */
73
- }
74
-
75
- .container {
76
- /* padding: 8px; */
77
-
78
- width: fit-content;
79
- height: fit-content;
80
-
81
- background: #ffffff;
82
- /* border-radius: 4px; */
83
-
84
- /* margin: 0px 32px; */
85
- }
86
-
87
- .hide {
88
- display: none;
89
- }
90
-
91
38
  .dot {
92
- width: 14px;
93
- height: 14px;
94
- background: #43cec2;
95
- border-radius: 8px;
96
- margin: 0px 6px 0px 0px;
97
- }
98
-
99
- .text {
100
- font-weight: bold;
101
- font-size: 12px;
102
- line-height: 120%;
103
-
104
- color: #798490;
105
- }
106
-
107
- .container1 {
108
- margin: 0px 0px 0px 20px;
109
- }
110
-
111
- .value {
112
- color: #28323b;
113
- }
114
-
115
- .percentage {
116
- color: #798490;
117
- }
118
-
119
- .bar {
120
- background-color: #d6dde5;
121
- height: 14px;
122
-
123
- border-radius: 2px;
124
-
125
- padding: 0px 1px;
126
- margin-right: 3px;
39
+ width: 14px; height: 14px;
40
+ background-color: #43cec2;
41
+ margin-right: 6px;
127
42
  }
128
43
  </style>
@@ -1,129 +1,78 @@
1
1
  <template>
2
2
  <button
3
- class="psui-font-bold psui-items-center psui-flex psui-rounded-md"
4
- :class="classes"
5
- @click="onClick()"
6
- >
7
- <i
8
- v-if="icon"
9
- :class="['psui-mr-2', iconClasses]"
10
- >
11
- {{ icon }}
12
- </i>
13
- <span
14
- v-if="label"
15
- class="psui-flex-grow psui-text-left"
16
- >{{ label }}
17
- </span>
18
- <i
19
- v-if="iconRight"
20
- :class="['psui-ml-2', iconClasses]"
21
- >
22
- {{ iconRight }}
23
- </i>
3
+ @click="onClick()"
4
+ @mouseenter="onMouseEnter"
5
+ @mouseleave="onMouseLeave"
6
+ class='psui-el-button'
7
+ :class="[getComponentClass, {'hover': isHover}, {'disabled': disabled}]"
8
+ >
9
+ <i v-if="icon" :class='iconClass' class='material-icons-round'>{{icon}}</i>
10
+ <span v-if="label">{{ label }}</span>
24
11
  </button>
25
12
  </template>
26
13
 
27
14
  <script>
28
- export const sizes = ['big', 'medium', 'small']
29
15
  export default {
30
16
  props: {
31
17
  label: {
32
18
  type: String,
33
19
  },
34
- outline: {
35
- type: Boolean,
36
- default: false
37
- },
38
- ghost: {
39
- type: Boolean,
40
- default: false
41
- },
42
- textOnly: {
43
- type: Boolean,
44
- default: false
20
+ layout: {
21
+ type: String,
22
+ default: 'solid',
23
+ validator: (value) => ['solid','outline','ghost','onlytext'].includes(value)
45
24
  },
46
25
  icon: {
47
26
  type: String,
48
27
  },
49
- iconRight: {
28
+ iconPosition:{
50
29
  type: String,
30
+ default: 'left',
31
+ validator: (value) => ['left','right'].includes(value)
51
32
  },
52
33
  size: {
53
34
  type: String,
54
35
  default: 'big',
55
- validator: (value) => sizes.indexOf(value) !== -1
36
+ validator: (value) => ['small','medium','big','custom'].includes(value)
56
37
  },
57
38
  disabled: {
58
- type: [Boolean, String]
59
- },
60
- 'text-color': {
61
- type: String,
62
- default: ''
63
- },
64
- 'icon-color': {
65
- type: String,
66
- default: ''
39
+ type: Boolean,
40
+ default: false
67
41
  },
68
- color: {
69
- type: String,
70
- default: ''
42
+ iconClass:{
43
+ type: String
44
+ }
45
+ },
46
+ data(){
47
+ return {
48
+ isHover: false,
71
49
  }
72
50
  },
73
51
  computed: {
74
- iconClasses() {
75
- const size = this.size === 'small' ? 'psui-text-small' : this.size === 'medium' ? 'psui-text-small' : 'psui-text-big'
76
- const color = this.iconColor.length > 0 ? `psui-text-${this.iconColor}` : ''
77
- return `psui-my-auto material-icons ${size} ${color}`
78
- },
79
- classes() {
80
- let sizeCss = ''
81
-
82
- if (this.size === 'medium') sizeCss = 'medium'
83
- if (this.size === 'small') sizeCss = 'small'
84
- if (this.size === 'big') sizeCss = 'big'
85
-
86
- if (this.outline) return `${sizeCss} psui-bg-white psui-border ${this.disabled ? 'psui-border-gray-40 psui-text-gray-40 psui-cursor-default' : 'psui-border-blue-60 psui-text-blue-60'}`
87
- if (this.ghost) return `${sizeCss} ${this.disabled ? 'psui-bg-gray-20 psui-text-gray-40 psui-cursor-default' : 'psui-bg-blue-20 psui-text-blue-60 active:psui-shadow-inner'}`
88
- if (this.textOnly) {
89
- const hasTextColor = this.textColor.length > 0
90
- const color = hasTextColor ? this.textColor.split('hover:')[0] : ''
91
- const hover = hasTextColor ? this.textColor.split('hover:')[1] : ''
92
-
93
- let textCss = 'psui-text-blue-50 hover:psui-text-blue-60'
94
- if (this.disabled) textCss = 'psui-text-gray-40 psui-cursor-default'
95
-
96
- if (hasTextColor) textCss = `psui-text-${color}`
97
- if (hover) textCss += `hover:psui-text-${hover}`
98
-
99
- return `${sizeCss} ${textCss}`
52
+ getComponentClass(){
53
+ if (this.size != 'custom') {
54
+ return `layout-${this.layout} size-${this.size} icon-${this.iconPosition}`
55
+ } else {
56
+ return `layout-${this.layout} icon-${this.iconPosition}`
100
57
  }
101
- if (this.disabled) return `${sizeCss} psui-bg-gray-20 psui-text-gray-40 psui-cursor-default`
102
- return `${sizeCss} psui-bg-blue-60 hover:psui-bg-blue-50 psui-text-white active:psui-shadow-inner psui-cursor-pointer`
103
- }
58
+ }
104
59
  },
105
60
  methods: {
106
61
  onClick() {
107
- if (this.disabled) return false
62
+ if (this.disabled) return
108
63
  this.$emit('click')
64
+ },
65
+ onMouseEnter(){
66
+ if(!this.disabled){
67
+ this.isHover = true
68
+ }
69
+ },
70
+ onMouseLeave(){
71
+ if(!this.disabled){
72
+ this.isHover = false
73
+ }
109
74
  }
110
75
  }
111
76
  }
112
77
  </script>
113
78
 
114
- <style scoped>
115
- .small {
116
- padding: 4px 8px 4px 8px;
117
- font-size: 14px;
118
- }
119
-
120
- .medium{
121
- padding: 7px 16px 7px 16px;
122
- font-size: 14px;
123
- }
124
-
125
- .big{
126
- padding: 9.5px 16px 9.5px 16px;
127
- font-size: 16px;
128
- }
129
- </style>
@@ -32,7 +32,7 @@ export default {
32
32
  }
33
33
  </script>
34
34
 
35
- <style>
35
+ <style scoped>
36
36
  .wrapper {
37
37
  padding: 2px;
38
38
  }
@@ -25,7 +25,7 @@
25
25
  @keydown="$emit('keydown', $event)"
26
26
  @change="$emit('change', $event)"
27
27
  v-bind="getAttrs"
28
- :class="getInputClasses"
28
+ :class="{ 'focus': isFocus }"
29
29
  />
30
30
 
31
31
  <div v-if="$slots.append || hasError" class="psui-el-input-append">
@@ -1,28 +1,33 @@
1
1
  <template>
2
- <div class="psui-flex psui-justify-between psui-pr-3 psui-pl-2 psui-py-2 psui-rounded-md" :class="getDialogColor">
3
- <div class="psui-flex psui-justify-between psui-gap-2">
4
- <i class="material-icons-round">info</i>
5
- <div class="psui-flex psui-flex-col">
6
- <p v-if="message" class="psui-w-full">{{ message }}</p>
7
- <slot v-else name="content"></slot>
8
- <slot v-if="layout === 'vertical'" name="action"></slot>
9
- </div>
2
+ <div class="psui-el-dialog" :class="getComponentClass">
3
+ <div class="psui-el-dialog-icon">
4
+ <i class="material-icons-round">{{icon}}</i>
5
+ </div>
6
+ <div class="psui-el-dialog-wrapper">
7
+ <div class="psui-el-dialog-default">
8
+ <slot>
9
+ <p class="psui-el-dialog-message">{{ message }}</p>
10
+ </slot>
10
11
  </div>
11
- <div class="psui-flex psui-gap-3">
12
- <slot v-if="layout === 'horizontal'" name="action"></slot>
13
- <button @click="onClose" class="psui-w-4 psui-h-4 focus:psui-outline-none">
14
- <i class="material-icons-round">close</i>
15
- </button>
12
+ <div class="psui-el-dialog-action">
13
+ <slot name="action"></slot>
16
14
  </div>
15
+ </div>
16
+ <button
17
+ class="psui-el-dialog-close"
18
+ v-if="hasClose"
19
+ @click="onClose">
20
+ <i class="material-icons-round">close</i>
21
+ </button>
17
22
  </div>
18
23
  </template>
19
24
 
20
25
  <script>
21
-
26
+ // Figma - 3. Inline Dialog https://www.figma.com/file/Tto8hrNlSfuPcwd1pfqogF/%E2%9A%A1%EF%B8%8F-Design-System?node-id=3694%3A55841
22
27
  export default {
23
28
  name: 'PsDialog',
24
29
  props: {
25
- status: {
30
+ theme: {
26
31
  type: String,
27
32
  default: 'informative',
28
33
  validator: (value) => ['informative', 'success', 'alert'].includes(value)
@@ -35,18 +40,19 @@ export default {
35
40
  default: 'horizontal',
36
41
  validator: (value) => ['horizontal', 'vertical'].includes(value)
37
42
  },
38
- cssClass:{
39
- type: String
43
+ hasClose: {
44
+ type: Boolean,
45
+ default: true
46
+ },
47
+ icon: {
48
+ type: String,
49
+ default: 'info'
40
50
  }
41
51
  },
42
52
  emits:['close'],
43
53
  computed: {
44
- getDialogColor() {
45
- let dialogColor = ''
46
- if(this.status === 'informative') dialogColor = `psui-bg-blue-20 psui-text-blue-60 ${this.cssClass}`
47
- if(this.status === 'success') dialogColor = `psui-bg-green-10 psui-text-green-70 ${this.cssClass}`
48
- if(this.status === 'alert') dialogColor = `psui-bg-yellow-10 psui-text-yellow-70 ${this.cssClass}`
49
- return dialogColor
54
+ getComponentClass() {
55
+ return [`layout-${this.layout}`, `theme-${this.theme}`, `close-${this.hasClose ? 'on' : 'off'}` ]
50
56
  }
51
57
  },
52
58
  methods:{
@@ -1,37 +1,36 @@
1
1
  <template>
2
- <div :class="wrapperClasses" role="group">
2
+ <div
3
+ class="psui-el-tab-header"
4
+ :class="[getComponentClass, `layout-${layout}`]"
5
+ role="group"
6
+ >
7
+
3
8
  <button
4
9
  type="button"
5
10
  v-for="item in getItems"
6
11
  :key="item[keyValue]"
7
12
  @click="selectTab(item)"
8
- :class="[
9
- classes,
10
- { 'psui-bg-blue-60 psui-text-white': getSelected === item[keyValue] && theme === 'standard' },
11
- { 'psui-border-b-2 psui-border-blue-60 psui-text-blue-60 psui-font-bold': getSelected === item[keyValue] && theme === 'underline' },
12
- { 'psui-text-blue-60 psui-font-bold psui-bg-white hover:psui-text-blue-60': getSelected === item[keyValue] && theme === 'folder' }
13
- ]"
13
+ :class="{ 'status-active': getSelected === item[keyValue] }"
14
14
  >
15
15
  {{ item[keyLabel] }}
16
16
  </button>
17
- </div>
17
+
18
+ </div>
18
19
  </template>
19
20
 
20
21
  <script>
21
- export const themeOptions = ['standard', 'underline', 'folder']
22
22
  export default {
23
23
  name: 'PsTabHeader',
24
24
  props: {
25
- theme: {
25
+ layout: {
26
26
  type: String,
27
27
  default: 'standard',
28
- validator: (value) => themeOptions.indexOf(value) !== -1
28
+ validator: (value) => ['standard', 'underline', 'folder'].includes(value)
29
29
  },
30
30
  items: {
31
31
  type: Array,
32
32
  required: true
33
33
  },
34
- selected: {},
35
34
  keyLabel: {
36
35
  type: String,
37
36
  default: 'label'
@@ -39,26 +38,20 @@ export default {
39
38
  keyValue: {
40
39
  type: String,
41
40
  default: 'value'
42
- }
41
+ },
42
+ disabled: {
43
+ type: Boolean,
44
+ default: false
45
+ },
46
+ selected: {},
43
47
  },
44
48
  computed: {
45
- wrapperClasses() {
46
- if (this.theme === 'underline') {
47
- return 'psui-flex psui-space-x-4 psui-border-b psui-border-gray-20'
48
- }
49
- if (this.theme === 'folder') {
50
- return 'psui-flex psui-space-x-1'
51
- }
52
- return 'psui-inline-flex psui-rounded-md psui-flex psui-gap-x-px'
53
- },
54
- classes() {
55
- if (this.theme === 'underline') {
56
- return 'psui-text-gray-60 psui-pb-3 hover:psui-text-blue-60'
57
- }
58
- if (this.theme === 'folder') {
59
- return 'psui-bg-gray-10 psui-text-gray-50 psui-py-2 psui-px-4 psui-rounded-t-lg hover:psui-text-gray-60 active:psui-text-blue-60'
49
+ getComponentClass() {
50
+ if (this.disabled) {
51
+ return 'status-disabled'
52
+ } else {
53
+ return 'status-resting'
60
54
  }
61
- return 'psui-bg-gray-10 psui-px-4 psui-py-2 psui-text-gray-60 hover:psui-text-blue-60 last:psui-rounded-r-lg first:psui-rounded-l-lg active:psui-text-white active:psui-bg-blue-60'
62
55
  },
63
56
  getIsObject() {
64
57
  return typeof this.selected === 'object'
@@ -85,7 +78,7 @@ export default {
85
78
  } else {
86
79
  return this.items
87
80
  }
88
- }
81
+ },
89
82
  },
90
83
  methods: {
91
84
  selectTab(item) {
@@ -96,3 +89,5 @@ export default {
96
89
 
97
90
  }
98
91
  </script>
92
+
93
+ <style> /* Please, use the file src/assets/scss/components/PsTabHeader.scss */</style>