@policystudio/policy-studio-ui-vue 1.0.20 → 1.0.24

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.
Files changed (50) hide show
  1. package/.storybook/main.js +9 -1
  2. package/dist/css/psui_styles.css +15690 -14620
  3. package/package.json +8 -3
  4. package/postcss.config.js +2 -0
  5. package/src/assets/scss/base.scss +10 -3
  6. package/src/assets/scss/components/PsAccordion.scss +63 -0
  7. package/src/assets/scss/components/PsButton.scss +145 -0
  8. package/src/assets/scss/components/PsInput.scss +104 -0
  9. package/src/components/accordion/PsAccordion.vue +30 -29
  10. package/src/components/accordion/PsAccordionItem.vue +29 -67
  11. package/src/components/badges-and-tags/PsCardInfos.vue +38 -0
  12. package/src/components/badges-and-tags/PsChartLegend.vue +43 -0
  13. package/src/components/badges-and-tags/PsClimateZoneBadge.vue +18 -0
  14. package/src/components/badges-and-tags/PsCostEffectBar.vue +114 -0
  15. package/src/components/badges-and-tags/PsHighlightRippleDot.vue +78 -0
  16. package/src/components/badges-and-tags/PsMiniTag.vue +46 -0
  17. package/src/components/badges-and-tags/PsProgressBar.vue +0 -0
  18. package/src/components/buttons/PsButton.vue +42 -94
  19. package/src/components/chips/PsChips.vue +10 -20
  20. package/src/components/controls/PsCheckbox.vue +29 -16
  21. package/src/components/controls/PsDraggable.vue +171 -25
  22. package/src/components/controls/PsRadioButton.vue +25 -19
  23. package/src/components/controls/PsToggle.vue +1 -1
  24. package/src/components/forms/PsInput.vue +122 -102
  25. package/src/components/notifications/PsDialog.vue +37 -18
  26. package/src/components/tabs/PsTabHeader.vue +3 -2
  27. package/src/components/tooltip/PsRichTooltip.vue +6 -0
  28. package/src/components/tooltip/PsTooltip.vue +1 -3
  29. package/src/index.js +15 -9
  30. package/src/stories/Accordion.stories.js +88 -28
  31. package/src/stories/Button.stories.js +83 -35
  32. package/src/stories/CardInfos.stories.js +16 -0
  33. package/src/stories/ChartLegend.stories.js +16 -0
  34. package/src/stories/Chips.stories.js +7 -1
  35. package/src/stories/ClimateZoneBadge.stories.js +24 -0
  36. package/src/stories/Colors.stories.mdx +1 -1
  37. package/src/stories/CostEffectBar.stories.js +23 -0
  38. package/src/stories/Dialog.stories.js +141 -8
  39. package/src/stories/Draggable.stories.js +4 -6
  40. package/src/stories/Dropdown.stories.js +3 -5
  41. package/src/stories/HighlightRippleDot.stories.js +16 -0
  42. package/src/stories/Input.stories.js +61 -9
  43. package/src/stories/MiniTag.stories.js +46 -0
  44. package/src/stories/ProgressBar.stories.js +23 -0
  45. package/src/stories/RadioButton.stories.js +2 -2
  46. package/src/stories/Toggle.stories.js +7 -8
  47. package/src/stories/Tooltip.stories.js +5 -4
  48. package/src/util/GeneralFunctions.js +6 -7
  49. package/src/util/imageLoader.js +1 -1
  50. package/tailwind.config.js +71 -48
@@ -0,0 +1,114 @@
1
+ <template>
2
+ <div>
3
+ <div class="container">
4
+ <div
5
+ class="loading-bar"
6
+ :class="{
7
+ 'psui-bg-blue-20': value >= breakEven,
8
+ 'psui-bg-red-10': value < breakEven,
9
+ }"
10
+ >
11
+ <span class="breakEven" :style="breakEvenPosition"> </span>
12
+
13
+ <input
14
+ type="number"
15
+ min="0"
16
+ max="100"
17
+ class="percentage"
18
+ :style="{ width: `${value}px` }"
19
+ :class="{
20
+ 'psui-bg-blue-60': value >= breakEven,
21
+ 'psui-bg-red-20': value < breakEven,
22
+ }"
23
+ />
24
+ </div>
25
+ </div>
26
+ </div>
27
+ </template>
28
+
29
+ <script>
30
+ export default {
31
+ props: {
32
+ value: {
33
+ type: Number,
34
+ required: true,
35
+ default: 0,
36
+ },
37
+ breakEven: {
38
+ type: Number,
39
+ required: true,
40
+ default: 1,
41
+ },
42
+ },
43
+ data() {
44
+ return {
45
+ errors: [],
46
+ }
47
+ },
48
+
49
+ computed: {
50
+ valueBar() {
51
+ if (this.value > 100) return 100
52
+ else if (this.value < 0) return 0
53
+ else return this.value
54
+ },
55
+
56
+ breakEvenPosition() {
57
+ return `left: ${this.breakEven}px`
58
+ },
59
+ getIsBreakEven() {
60
+ if (this.breakEven < 0) return 0
61
+ else if (this.breakEven > 100) return 100
62
+ else return this.breakEven
63
+ // else return true;
64
+ // return this.value > this.breakEven ? true : false;
65
+ },
66
+ },
67
+ }
68
+ </script>
69
+
70
+ <style scoped>
71
+ .container {
72
+ overflow: visible;
73
+ }
74
+
75
+ .loading-bar {
76
+ position: relative;
77
+ width: 100px;
78
+ height: 8px;
79
+ border-radius: 15px;
80
+ }
81
+
82
+ .loading-bar .percentage {
83
+ position: absolute;
84
+ display: block;
85
+ max-width: 100px;
86
+ height: 100%;
87
+ border-radius: 15px;
88
+ overflow: visible;
89
+ background-size: 30px 30px;
90
+ animation: animate-stripes 3s linear infinite;
91
+ }
92
+
93
+ .breakEven {
94
+ position: absolute;
95
+ background-color: #d6dde5;
96
+ width: 2px;
97
+ height: 14px;
98
+ /* max-width: 100px; */
99
+ border-radius: 2px;
100
+ top: -3px;
101
+ z-index: 1;
102
+ /* left: 2px; */
103
+ /* right: -2px; */
104
+ }
105
+
106
+ @keyframes animate-stripes {
107
+ 0% {
108
+ background-position: 0 0;
109
+ }
110
+ 100% {
111
+ background-position: 60px 0;
112
+ }
113
+ }
114
+ </style>
@@ -0,0 +1,78 @@
1
+ <template>
2
+ <div class="example">
3
+ <div class="dot"></div>
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ export default {}
9
+ </script>
10
+
11
+ <style scoped>
12
+ .example {
13
+ position: static;
14
+ /* margin: 0px 32px; */
15
+ /* width: 275px;
16
+ height: 229px; */
17
+ /* left: 0px;
18
+ top: 0px; */
19
+ /* border: 1.5px dashed #9b51e0; */
20
+ /* background: #f3f6f9; */
21
+ box-sizing: border-box;
22
+ }
23
+ .dot {
24
+ background: #5db883;
25
+ /* border: solid 1px #2bb24c; */
26
+ border-radius: 50%;
27
+ /* box-shadow: 0px 0 2px #2bb24c; */
28
+ width: 8px;
29
+ height: 8px;
30
+ /* left: 6px;
31
+ top: 6px; */
32
+ margin: 100px auto;
33
+ position: relative;
34
+ }
35
+
36
+ .dot::before,
37
+ .dot::after {
38
+ background: #def8e8;
39
+ border: solid 0px #2bb24c;
40
+ border-radius: 50%;
41
+ content: '';
42
+ width: 36px;
43
+ height: 36px;
44
+ left: -8px;
45
+ top: -8px;
46
+ position: absolute;
47
+ transform-origin: center center;
48
+ transform: scale(1) translate(-1px, -1px);
49
+ }
50
+ .dot::before {
51
+ animation: ripple 1s infinite;
52
+ }
53
+ .dot::after {
54
+ animation: ripple 1s infinite;
55
+ /* animation-delay: 0.4s; */
56
+ }
57
+
58
+ @keyframes ripple {
59
+ 0% {
60
+ /* transform: scale(1) translate(-1px, -1px);
61
+ opacity: 0.75; */
62
+ left: 5px;
63
+ top: 5px;
64
+ opacity: 0.95;
65
+ width: 0;
66
+ height: 0;
67
+ }
68
+ 100% {
69
+ /* transform: scale(2) translate(-1px, -1px);
70
+ opacity: 0; */
71
+ left: -13px;
72
+ top: -13px;
73
+ opacity: 0;
74
+ width: 36px;
75
+ height: 36px;
76
+ }
77
+ }
78
+ </style>
@@ -0,0 +1,46 @@
1
+ <template>
2
+ <div :class="cssClass">
3
+ <div class="psui-w-full">{{ message }}</div>
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ export const typeOptions = ['informative', 'success', 'warning', 'error']
9
+ export default {
10
+ name: 'PsMiniTag',
11
+ props: {
12
+ type: {
13
+ type: String,
14
+ default: 'informative',
15
+ validator: (value) => typeOptions.indexOf(value) !== -1,
16
+ },
17
+ message: {
18
+ type: String,
19
+ required: true,
20
+ },
21
+ },
22
+ data() {
23
+ return {
24
+ colors: {
25
+ informative: { background: 'blue-20', color: 'blue-60' },
26
+ success: { background: 'green-10', color: 'green-70' },
27
+ warning: { background: 'yellow-10', color: 'yellow-70' },
28
+ error: { background: 'red-10', color: 'red-20' },
29
+ },
30
+ }
31
+ },
32
+ computed: {
33
+ cssClass() {
34
+ return `fit-content psui-flex psui-rounded-lg psui-px-2 psui-items-center psui-justify-center psui-flex-row psui-mx-6 psui-bg-${
35
+ this.colors[this.type].background
36
+ } psui-text-${this.colors[this.type].color}`
37
+ },
38
+ },
39
+ }
40
+ </script>
41
+
42
+ <style scoped>
43
+ .fit-content {
44
+ width: fit-content;
45
+ }
46
+ </style>
@@ -1,129 +1,77 @@
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}, {'active': isActive}, {'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
+ required: true,
23
+ default: 'solid',
24
+ validator: (value) => ['solid','outline','ghost','onlytext'].includes(value)
45
25
  },
46
26
  icon: {
47
27
  type: String,
48
28
  },
49
- iconRight: {
29
+ iconPosition:{
50
30
  type: String,
31
+ default: 'right',
32
+ validator: (value) => ['left','right'].includes(value)
51
33
  },
52
34
  size: {
53
35
  type: String,
54
36
  default: 'big',
55
- validator: (value) => sizes.indexOf(value) !== -1
37
+ validator: (value) => ['small','medium','big'].includes(value)
56
38
  },
57
39
  disabled: {
58
- type: [Boolean, String]
59
- },
60
- 'text-color': {
61
- type: String,
62
- default: ''
63
- },
64
- 'icon-color': {
65
- type: String,
66
- default: ''
40
+ type: Boolean,
41
+ default: false
67
42
  },
68
- color: {
69
- type: String,
70
- default: ''
43
+ iconClass:{
44
+ type: String
45
+ }
46
+ },
47
+ data(){
48
+ return {
49
+ isHover: false,
50
+ isActive: false,
71
51
  }
72
52
  },
73
53
  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}`
100
- }
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
- }
54
+ getComponentClass(){
55
+ return `layout-${this.layout} ${this.size} ${this.iconPosition}`
56
+ }
104
57
  },
105
58
  methods: {
106
59
  onClick() {
107
- if (this.disabled) return false
60
+ if (this.disabled) return
61
+ this.isActive = true,
108
62
  this.$emit('click')
63
+ },
64
+ onMouseEnter(){
65
+ if(!this.disabled){
66
+ this.isHover = true
67
+ }
68
+ },
69
+ onMouseLeave(){
70
+ if(!this.disabled){
71
+ this.isHover = false
72
+ }
109
73
  }
110
74
  }
111
75
  }
112
76
  </script>
113
77
 
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>
@@ -2,7 +2,7 @@
2
2
  <label
3
3
  @click="onClick"
4
4
  :for="title"
5
- :class="cssClass"
5
+ :class="getCssClass"
6
6
  class="
7
7
  psui-flex
8
8
  psui-gap-2
@@ -42,6 +42,7 @@ export default {
42
42
  type: {
43
43
  type: String,
44
44
  required: true,
45
+ validator: (type) => ["text", "radio", "checkbox", "button"].includes(type)
45
46
  },
46
47
  icon: {
47
48
  type: String,
@@ -53,28 +54,20 @@ export default {
53
54
  },
54
55
  checked: {
55
56
  type: Boolean,
57
+ default: false
56
58
  },
57
59
  },
58
60
  emits: ["click", "change"],
59
61
  data() {
60
62
  return {
61
63
  isChecked: false,
62
- value: null,
63
64
  }
64
65
  },
65
66
  computed: {
66
- cssClass() {
67
+ getCssClass() {
67
68
  let cssClass = ''
68
69
 
69
- if (this.isChecked === true && this.type === "radio") {
70
- cssClass = "psui-text-blue-50 psui-bg-blue-20"
71
- }
72
-
73
- if (this.isChecked === true && this.type === "checkbox") {
74
- cssClass = "psui-text-blue-50 psui-bg-blue-20"
75
- }
76
-
77
- if (this.isChecked === true) {
70
+ if (this.checked === true ) {
78
71
  cssClass = "psui-text-blue-50 psui-bg-blue-20"
79
72
  }
80
73
 
@@ -83,18 +76,15 @@ export default {
83
76
  },
84
77
  methods: {
85
78
  onClick() {
86
- if (this.disabled) return false
87
-
88
- if (this.type !== "checkbox" || this.type !== "radio") {
89
- this.isChecked = !this.isChecked
90
- }
91
-
79
+ this.isChecked = !this.isChecked
92
80
  this.$emit("click")
93
81
  },
94
82
  onChange(event) {
83
+
95
84
  this.isChecked = event.target.checked
96
- this.checked = event.target.checked
97
- this.$emit("change", event.target.checked)
85
+
86
+ this.$emit('update:checked', event.target.checked)
87
+ this.$emit("change")
98
88
  },
99
89
  onClose() {
100
90
  this.$emit("close")
@@ -1,5 +1,12 @@
1
1
  <template>
2
- <label class="container psui-pl-6" :class="[{ 'psui-text-gray-40': disabled }, { 'psui-text-gray-50': !disabled }, labelClasses]">
2
+ <label
3
+ class="container psui-pl-6"
4
+ :class="[
5
+ { 'psui-text-gray-40': disabled },
6
+ { 'psui-text-gray-50': !disabled },
7
+ labelClasses,
8
+ ]"
9
+ >
3
10
  {{ label }}
4
11
  <input
5
12
  type="checkbox"
@@ -7,7 +14,11 @@
7
14
  :disabled="disabled"
8
15
  :value="inputValue"
9
16
  />
10
- <span class="checkmark psui-border-2" :class="classes" :style="getSize"></span>
17
+ <span
18
+ class="checkmark psui-border-2"
19
+ :class="classes"
20
+ :style="getSize"
21
+ ></span>
11
22
  </label>
12
23
  </template>
13
24
 
@@ -18,26 +29,26 @@ export default {
18
29
  value: {
19
30
  required: true,
20
31
  },
21
- inputValue: String,
32
+ inputValue: String,
22
33
  label: {
23
34
  type: String,
24
- default: ''
35
+ default: '',
25
36
  },
26
37
  checkboxClasses: {
27
38
  type: String,
28
- default: ''
39
+ default: '',
29
40
  },
30
41
  labelClasses: {
31
42
  type: String,
32
- default: ''
43
+ default: '',
33
44
  },
34
45
  disabled: {
35
46
  type: Boolean,
36
- default: false
47
+ default: false,
37
48
  },
38
49
  size: {
39
- default: 18
40
- }
50
+ default: 18,
51
+ },
41
52
  },
42
53
  computed: {
43
54
  model: {
@@ -50,15 +61,17 @@ export default {
50
61
  },
51
62
  },
52
63
  classes() {
53
- return `${this.disabled ? 'psui-border-gray-40': 'psui-border-gray-50'} ${this.checkboxClasses}`
64
+ return `${
65
+ this.disabled ? 'psui-border-gray-40' : 'psui-border-gray-50'
66
+ } ${this.checkboxClasses}`
54
67
  },
55
68
  getSize() {
56
69
  return {
57
70
  width: `${this.size}px`,
58
- height: `${this.size}px`
71
+ height: `${this.size}px`,
59
72
  }
60
- }
61
- }
73
+ },
74
+ },
62
75
  }
63
76
  </script>
64
77
 
@@ -92,12 +105,12 @@ export default {
92
105
  }
93
106
 
94
107
  .container input:checked ~ .checkmark {
95
- background-color: #64B5CE;
108
+ background-color: #64b5ce;
96
109
  border: none;
97
110
  }
98
111
 
99
112
  .checkmark:after {
100
- content: "";
113
+ content: '';
101
114
  position: absolute;
102
115
  display: none;
103
116
  }
@@ -118,4 +131,4 @@ export default {
118
131
  -ms-transform: rotate(45deg);
119
132
  transform: rotate(45deg);
120
133
  }
121
- </style>
134
+ </style>