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

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 (72) hide show
  1. package/dist/css/psui_styles.css +4822 -383
  2. package/package.json +1 -1
  3. package/src/assets/scss/base.scss +39 -2
  4. package/src/assets/scss/components/PsAccordion.scss +6 -2
  5. package/src/assets/scss/components/PsButton.scss +114 -118
  6. package/src/assets/scss/components/PsCardInfos.scss +26 -0
  7. package/src/assets/scss/components/PsChartLegend.scss +25 -0
  8. package/src/assets/scss/components/PsCheckbox.scss +96 -0
  9. package/src/assets/scss/components/PsChips.scss +155 -0
  10. package/src/assets/scss/components/PsClimateZoneBadge.scss +26 -0
  11. package/src/assets/scss/components/PsCostEffectBar.scss +31 -0
  12. package/src/assets/scss/components/PsDataTable.scss +50 -0
  13. package/src/assets/scss/components/PsDialog.scss +80 -0
  14. package/src/assets/scss/components/PsDropdown.scss +44 -0
  15. package/src/assets/scss/components/PsHighlightRippleDot.scss +48 -0
  16. package/src/assets/scss/components/PsInlineSelector.scss +5 -0
  17. package/src/assets/scss/components/PsInputSelect.scss +62 -0
  18. package/src/assets/scss/components/PsInputTextArea.scss +49 -0
  19. package/src/assets/scss/components/PsProgressBar.scss +24 -0
  20. package/src/assets/scss/components/PsRadioButton.scss +78 -0
  21. package/src/assets/scss/components/PsSlider.scss +11 -0
  22. package/src/assets/scss/components/PsSwitch.scss +66 -0
  23. package/src/assets/scss/components/PsTabHeader.scss +105 -0
  24. package/src/assets/scss/components/PsToast.scss +52 -0
  25. package/src/assets/scss/components/PsToggle.scss +23 -0
  26. package/src/assets/scss/components/PsTooltip.scss +118 -0
  27. package/src/components/accordion/PsAccordion.vue +0 -1
  28. package/src/components/accordion/PsAccordionItem.vue +9 -2
  29. package/src/components/badges-and-tags/PsCardInfos.vue +14 -7
  30. package/src/components/badges-and-tags/PsChartLegend.vue +12 -18
  31. package/src/components/badges-and-tags/PsClimateZoneBadge.vue +15 -6
  32. package/src/components/badges-and-tags/PsCostEffectBar.Copy.vue +72 -0
  33. package/src/components/badges-and-tags/PsCostEffectBar.vue +33 -70
  34. package/src/components/badges-and-tags/PsHighlightRippleDot.vue +3 -69
  35. package/src/components/badges-and-tags/PsProgressBar.vue +42 -0
  36. package/src/components/buttons/PsButton.vue +74 -77
  37. package/src/components/chips/PsChips.vue +46 -87
  38. package/src/components/controls/PsCheckbox.vue +58 -134
  39. package/src/components/controls/PsInlineSelector.vue +15 -0
  40. package/src/components/controls/PsRadioButton.vue +33 -88
  41. package/src/components/controls/PsSlider.vue +4 -5
  42. package/src/components/controls/PsSwitch.vue +29 -81
  43. package/src/components/controls/PsToggle.vue +45 -39
  44. package/src/components/datatable/PsDataTable.vue +3 -15
  45. package/src/components/forms/PsDropdown.vue +27 -11
  46. package/src/components/forms/PsInputSelect.vue +80 -0
  47. package/src/components/forms/PsInputTextArea.vue +80 -0
  48. package/src/components/notifications/PsDialog.vue +32 -23
  49. package/src/components/notifications/PsToast.vue +13 -28
  50. package/src/components/tabs/PsTabHeader.vue +53 -41
  51. package/src/components/tooltip/PsDialogTooltip.vue +6 -31
  52. package/src/components/tooltip/PsRichTooltip.vue +37 -44
  53. package/src/components/tooltip/PsTooltip.vue +18 -28
  54. package/src/components/ui/PsIcon.vue +9 -9
  55. package/src/index.js +12 -3
  56. package/src/stories/Button.stories.js +102 -102
  57. package/src/stories/Checkbox.stories.js +34 -37
  58. package/src/stories/Chips.stories.js +43 -54
  59. package/src/stories/ClimateZoneBadge.stories.js +0 -7
  60. package/src/stories/Dialog.stories.js +15 -51
  61. package/src/stories/InlineSelector.stories.js +16 -0
  62. package/src/stories/InputSelect.stories.js +22 -0
  63. package/src/stories/InputTextArea.stories.js +25 -0
  64. package/src/stories/RadioButton.stories.js +32 -29
  65. package/src/stories/Switch.stories.js +33 -0
  66. package/src/stories/TabHeader.stories.js +6 -6
  67. package/src/stories/Toast.stories.js +40 -46
  68. package/src/stories/Tooltip.stories.js +86 -86
  69. package/tailwind.config.js +7 -1
  70. package/src/assets/images/check-checkbox-button.svg +0 -1
  71. package/src/assets/images/radio-checked-button.svg +0 -1
  72. package/src/stories/Swith.stories.js +0 -38
@@ -1,38 +1,45 @@
1
1
  <template>
2
- <div :class="wrapperClasses" role="group">
3
- <button
4
- type="button"
5
- v-for="item in getItems"
6
- :key="item[keyValue]"
7
- @click="selectTab(item)"
8
- :class="[
9
- 'transition-default',
10
- classes,
11
- { 'psui-bg-blue-60 psui-text-white': getSelected === item[keyValue] && theme === 'standard' },
12
- { 'psui-border-blue-60 psui-text-blue-60': getSelected === item[keyValue] && theme === 'underline' },
13
- { 'psui-text-blue-60 psui-font-bold psui-bg-white hover:psui-text-blue-60': getSelected === item[keyValue] && theme === 'folder' }
14
- ]"
15
- >
16
- {{ item[keyLabel] }}
17
- </button>
18
- </div>
2
+ <div
3
+ class="psui-el-tab-header"
4
+ :class="[getComponentClass, `layout-${layout}`]"
5
+ role="group"
6
+ >
7
+
8
+ <template v-for="item in getItems">
9
+ <slot v-bind:item="item" >
10
+ <button
11
+ :key="item[keyValue]"
12
+ type="button"
13
+ @click="selectTab(item)"
14
+ :class="getButtonClass(item)"
15
+ >
16
+ <PsRichTooltip v-if="item.tooltip" :title="item.tooltip" type="blue">
17
+ <template v-slot:trigger>
18
+ <span>{{ item[keyLabel] }}</span>
19
+ </template>
20
+ </PsRichTooltip>
21
+ <span v-else>{{ item[keyLabel] }}</span>
22
+ </button>
23
+ </slot>
24
+ </template>
25
+ </div>
19
26
  </template>
20
27
 
21
28
  <script>
22
- export const themeOptions = ['standard', 'underline', 'folder']
29
+ import PsRichTooltip from '../tooltip/PsRichTooltip.vue'
23
30
  export default {
24
31
  name: 'PsTabHeader',
32
+ components: { PsRichTooltip },
25
33
  props: {
26
- theme: {
34
+ layout: {
27
35
  type: String,
28
36
  default: 'standard',
29
- validator: (value) => themeOptions.indexOf(value) !== -1
37
+ validator: (value) => ['standard', 'underline', 'folder'].includes(value)
30
38
  },
31
39
  items: {
32
40
  type: Array,
33
41
  required: true
34
42
  },
35
- selected: {},
36
43
  keyLabel: {
37
44
  type: String,
38
45
  default: 'label'
@@ -40,26 +47,20 @@ export default {
40
47
  keyValue: {
41
48
  type: String,
42
49
  default: 'value'
43
- }
50
+ },
51
+ disabled: {
52
+ type: Boolean,
53
+ default: false
54
+ },
55
+ selected: {},
44
56
  },
45
57
  computed: {
46
- wrapperClasses() {
47
- if (this.theme === 'underline') {
48
- return 'psui-flex psui-space-x-4 psui-border-b psui-border-gray-20'
49
- }
50
- if (this.theme === 'folder') {
51
- return 'psui-flex psui-space-x-1'
52
- }
53
- return 'psui-inline-flex psui-rounded-md psui-flex psui-gap-x-px'
54
- },
55
- classes() {
56
- if (this.theme === 'underline') {
57
- return 'psui-text-gray-60 psui-pb-3 psui-text-small psui-border-b-2 psui-border-transparent psui-font-bold hover:psui-text-blue-60'
58
- }
59
- if (this.theme === 'folder') {
60
- 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'
58
+ getComponentClass() {
59
+ if (this.disabled) {
60
+ return 'status-disabled'
61
+ } else {
62
+ return 'status-resting'
61
63
  }
62
- 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'
63
64
  },
64
65
  getIsObject() {
65
66
  return typeof this.selected === 'object'
@@ -86,14 +87,25 @@ export default {
86
87
  } else {
87
88
  return this.items
88
89
  }
89
- }
90
+ },
90
91
  },
91
92
  methods: {
92
93
  selectTab(item) {
93
- this.$emit('update:selected', this.getIsObject ? item : item[this.keyValue] )
94
- this.$emit('change', this.getIsObject ? item : item[this.keyValue])
94
+ if (item.disabled !== true) {
95
+ this.$emit('update:selected', this.getIsObject ? item : item[this.keyValue] )
96
+ this.$emit('change', this.getIsObject ? item : item[this.keyValue])
97
+ }
98
+ },
99
+ getButtonClass(item) {
100
+ if (item.disabled) {
101
+ return ['status-disabled']
102
+ } else {
103
+ return { 'status-active': this.getSelected === item[this.keyValue], 'status-enabled' : true }
104
+ }
95
105
  }
96
106
  }
97
107
 
98
108
  }
99
109
  </script>
110
+
111
+ <style> /* Please, use the file src/assets/scss/components/PsTabHeader.scss */</style>
@@ -1,17 +1,14 @@
1
1
  <template>
2
- <PsTooltip :cssClass="getCssClass.content" :title="title">
2
+ <PsTooltip :layout="layout" :cssClass="cssClass" :title="title">
3
3
  <template v-slot:trigger>
4
- <slot></slot>
4
+ <slot name="trigger"></slot>
5
5
  </template>
6
6
  <template
7
- v-slot:dialog
8
- class="psui-flex psui-fkex-col psui-gap-3 psui-items-start"
7
+ v-slot:content
9
8
  >
10
- <p :class="type === 'white' ? 'psui-text-gray-50' : ''">{{ text }}</p>
9
+ <slot name="content"></slot>
11
10
  <button
12
11
  v-if="buttonText"
13
- class="psui-py-2 psui-px-4 psui-rounded-md"
14
- :class="getCssClass.button"
15
12
  @click="onClick"
16
13
  >
17
14
  {{ buttonText }}
@@ -36,7 +33,7 @@ export default {
36
33
  buttonText: {
37
34
  type: String,
38
35
  },
39
- type: {
36
+ layout: {
40
37
  type: String,
41
38
  default: "white",
42
39
  validator: (value) => ["white", "dark", "color"].includes(value),
@@ -47,33 +44,11 @@ export default {
47
44
  },
48
45
  },
49
46
  emits: ["click"],
50
- computed: {
51
- getCssClass() {
52
-
53
- if (this.type === "dark")
54
- return {
55
- content: `psui-bg-blue-70 psui-text-white ${this.cssClass}`,
56
- button: `psui-bg-blue-60 psui-text-white`,
57
- }
58
- if (this.type === "color")
59
- return {
60
- content: `psui-bg-blue-50 psui-text-white ${this.cssClass}`,
61
- button: `psui-bg-blue-60 psui-text-white`,
62
- }
63
-
64
- return { content: `psui-bg-white psui-text-gray-80 ${this.cssClass}`, button: `psui-bg-blue-20 psui-text-blue-60`,}
65
- },
66
- },
67
47
  methods: {
68
48
  onClick() {
69
- this.$emit("click")
49
+ this.$emit("click", this.$event)
70
50
  },
71
51
  },
72
52
  }
73
53
  </script>
74
54
 
75
- <style scoped>
76
- button {
77
- width: fit-content;
78
- }
79
- </style>>
@@ -1,44 +1,37 @@
1
- <template>
2
- <PsTooltip :cssClass="`${textColorClass} ${cssClass}`" :title="title">
3
- <template v-slot:trigger>
4
- <slot></slot>
5
- </template>
6
- <template v-slot:dialog>
7
- <p v-if="text">{{text}}</p>
8
- </template>
9
- </PsTooltip>
10
- </template>
11
-
12
- <script>
13
- import PsTooltip from "../tooltip/PsTooltip.vue"
14
-
15
- export default {
16
- name: "PsRichTooltip",
17
- components: { PsTooltip },
18
- props: {
19
- title: {
20
- type: String,
21
- default: "",
22
- },
23
- type: {
24
- type: String,
25
- default: "gray",
26
- validator: (type) => ["gray", "red", "blue"].includes(type),
27
- },
28
- text: {
29
- type: String,
30
- },
31
- cssClass: {
32
- type: String,
33
- default: "",
34
- },
35
- },
36
- computed: {
37
- textColorClass() {
38
- if (this.type === "red") return `psui-text-red-70 psui-bg-red-10 `
39
- if (this.type === "blue") return `psui-bg-blue-70 psui-text-white`
40
- return `psui-text-gray-80 psui-bg-gray-30 `
41
- },
42
- },
43
- }
44
- </script>
1
+ <template>
2
+ <PsTooltip :layout="layout" :title="title" :cssClass="cssClass">
3
+ <template v-slot:trigger>
4
+ <slot name="trigger"></slot>
5
+ </template>
6
+ <template v-slot:content>
7
+ <slot name="content"></slot>
8
+ </template>
9
+ </PsTooltip>
10
+ </template>
11
+
12
+ <script>
13
+ import PsTooltip from "../tooltip/PsTooltip.vue"
14
+
15
+ export default {
16
+ name: "PsRichTooltip",
17
+ components: { PsTooltip },
18
+ props: {
19
+ title: {
20
+ type: String,
21
+ default: "",
22
+ },
23
+ layout: {
24
+ type: String,
25
+ default: "gray",
26
+ validator: (type) => ["gray", "red", "blue"].includes(type),
27
+ },
28
+ text: {
29
+ type: String,
30
+ },
31
+ cssClass: {
32
+ type: String,
33
+ default: "",
34
+ },
35
+ },
36
+ }
37
+ </script>
@@ -1,39 +1,25 @@
1
1
  <template>
2
- <div @mouseover="open" @mouseleave="close" ref="tooltip">
3
- <div ref="tooltiptrigger">
2
+ <div @mouseover="open" @mouseleave="close" ref="tooltip" class='psui-el-tooltip'>
3
+ <div ref="tooltiptrigger" class='psui-el-tooltip-trigger'>
4
4
  <slot name="trigger"></slot>
5
5
  </div>
6
6
 
7
- <div class="psui-relative">
7
+ <div class='psui-el-tooltip-wrapper'>
8
8
  <div
9
9
  role="menu"
10
10
  ref="dialog"
11
- class="
12
- psui-fixed
13
- psui-hidden
14
- psui-opacity-0
15
- psui-transition-opacity
16
- psui-duration-500
17
- psui-ease-in-out
18
- "
11
+ class='psui-el-tooltip-dialog'
12
+ :class="cssClass"
19
13
  >
20
14
  <div
21
- class="
22
- psui-flex
23
- psui-flex-col
24
- psui-rounded-md
25
- psui-shadow-md
26
- psui-z-20
27
- psui-p-4
28
- "
15
+ class="psui-el-tooltip-content"
29
16
  aria-orientation="vertical"
30
- :class="cssClass"
17
+ :class="getComponentClass"
31
18
  >
32
- <h2 v-if="title" class="psui-font-bold">{{ title}}</h2>
33
- <slot name="dialog" class="psui-font-normal"
34
- >
35
- </slot
36
- >
19
+ <h2 v-if="title">{{ title}}</h2>
20
+ <div class="psui-el-tooltip-content-wrapper">
21
+ <slot name="content"></slot>
22
+ </div>
37
23
  </div>
38
24
  </div>
39
25
  </div>
@@ -51,12 +37,11 @@ export default {
51
37
  type: Boolean,
52
38
  default: false,
53
39
  },
54
- keepOpen: {
55
- default: false,
40
+ layout:{
41
+ type: String,
56
42
  },
57
43
  cssClass:{
58
44
  type: String,
59
- default: 'psui-bg-gray-50 psui-text-white'
60
45
  }
61
46
  },
62
47
  inheritAttrs: true,
@@ -67,6 +52,11 @@ export default {
67
52
  closingTimeout: null,
68
53
  }
69
54
  },
55
+ computed:{
56
+ getComponentClass(){
57
+ return `layout-${this.layout}`
58
+ }
59
+ },
70
60
  mounted() {
71
61
  document.addEventListener("resize", this.updatePosition)
72
62
  },
@@ -27,7 +27,7 @@ export default {
27
27
  props: {
28
28
  icon: {
29
29
  type: String,
30
- required: true
30
+ default: 'more_horiz'
31
31
  },
32
32
  type: {
33
33
  type: String,
@@ -39,11 +39,11 @@ export default {
39
39
  type: [Number, String],
40
40
  },
41
41
  width: {
42
- type: Number,
42
+ type: [Number, String],
43
43
  default: 24
44
44
  },
45
45
  height: {
46
- type: Number,
46
+ type: [Number, String],
47
47
  default: 24
48
48
  },
49
49
  stroke: {
@@ -54,7 +54,7 @@ export default {
54
54
  type: String,
55
55
  default: null,
56
56
  validator: value => {
57
- return value.includes('psui-text-') &&
57
+ return value?.includes('psui-text-') &&
58
58
  typeof(tailwindConfig.theme.colors[value.replace('psui-text-', '')]) != 'undefined' ||
59
59
  typeof(tailwindConfig.theme.colors[value]) != 'undefined'
60
60
  }
@@ -78,15 +78,15 @@ export default {
78
78
  getIconType() {
79
79
  if(this.imageLoadError || !this.finishedImageLoad) return 'material-icons'
80
80
  if(this.type) return this.type
81
- if(!this.icon.includes('/')) return 'material-icons'
82
- if(!this.icon.includes('.svg')) return 'url'
81
+ if(!this.icon?.includes('/')) return 'material-icons'
82
+ if(!this.icon?.includes('.svg')) return 'url'
83
83
  return 'svg'
84
84
  },
85
85
  getIcon() {
86
- if(!this.icon.includes('/')) return this.icon
86
+ if(!this.icon?.includes('/')) return this.icon ? this.icon : this.loaderErrorIcon
87
87
  if(!this.finishedImageLoad && !this.imageLoadError && this.loaderIcon) return this.loaderIcon
88
88
  if(this.imageLoadError) return this.loaderErrorIcon
89
- return this.icon ? this.icon : ''
89
+ return this.icon ? this.icon : this.loaderErrorIcon
90
90
  },
91
91
  getIconClasses() {
92
92
  if(this.iconClasses) return this.iconClasses
@@ -111,7 +111,7 @@ export default {
111
111
  }
112
112
  },
113
113
  mounted() {
114
- if(this.icon.includes('/')) this.loadImage()
114
+ if(this.icon?.includes('/')) this.loadImage()
115
115
  },
116
116
  methods: {
117
117
  loadImage() {
package/src/index.js CHANGED
@@ -18,8 +18,11 @@ import PsTooltip from './components/tooltip/PsTooltip.vue'
18
18
  import PsRichTooltip from './components/tooltip/PsRichTooltip.vue'
19
19
  import PsDialogTooltip from './components/tooltip/PsDialogTooltip.vue'
20
20
  import PsDraggable from './components/controls/PsDraggable.vue'
21
- // import PsCardInfos from './components/badges-and-tags/PsCardInfos.vue'
21
+ import PsCardInfos from './components/badges-and-tags/PsCardInfos.vue'
22
22
  import PsChartLegend from './components/badges-and-tags/PsChartLegend.vue'
23
+ import PsInlineSelector from './components/controls/PsInlineSelector.vue'
24
+ import PsInputTextArea from './components/forms/PsInputTextArea.vue'
25
+ import PsInputSelect from './components/forms/PsInputSelect.vue'
23
26
 
24
27
  export default {
25
28
  install(Vue) {
@@ -43,8 +46,11 @@ export default {
43
46
  Vue.component('PsRichTooltip', PsRichTooltip)
44
47
  Vue.component('PsDialogTooltip', PsDialogTooltip)
45
48
  Vue.component('PsDraggable', PsDraggable)
46
- // Vue.component('PsCardInfos', PsCardInfos)
49
+ Vue.component('PsCardInfos', PsCardInfos)
47
50
  Vue.component('PsChartLegend', PsChartLegend)
51
+ Vue.component('PsInlineSelector', PsInlineSelector)
52
+ Vue.component('PsInputTextArea', PsInputTextArea)
53
+ Vue.component('PsInputSelect', PsInputSelect)
48
54
  },
49
55
  }
50
56
 
@@ -68,6 +74,9 @@ export {
68
74
  PsRichTooltip,
69
75
  PsDialogTooltip,
70
76
  PsDraggable,
71
- // PsCardInfos,
77
+ PsCardInfos,
72
78
  PsChartLegend,
79
+ PsInlineSelector,
80
+ PsInputTextArea,
81
+ PsInputSelect
73
82
  }