@policystudio/policy-studio-ui-vue 1.0.29 → 1.0.32

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 (84) hide show
  1. package/.eslintrc.js +36 -35
  2. package/.storybook/preview.js +7 -1
  3. package/README.md +6 -2
  4. package/babel.config.js +1 -1
  5. package/dist/css/psui_styles.css +1580 -185
  6. package/package.json +16 -5
  7. package/postcss.config.js +1 -1
  8. package/src/assets/scss/base.scss +3 -0
  9. package/src/assets/scss/components/PsAccordion.scss +28 -11
  10. package/src/assets/scss/components/PsButton.scss +39 -18
  11. package/src/assets/scss/components/PsCardInfos.scss +1 -1
  12. package/src/assets/scss/components/PsCheckbox.scss +4 -5
  13. package/src/assets/scss/components/PsChips.scss +13 -8
  14. package/src/assets/scss/components/PsClimateZoneBadge.scss +1 -1
  15. package/src/assets/scss/components/PsCostEffectBar.scss +22 -27
  16. package/src/assets/scss/components/PsDataTable.scss +17 -0
  17. package/src/assets/scss/components/PsDialog.scss +5 -2
  18. package/src/assets/scss/components/PsDotLoader.scss +45 -0
  19. package/src/assets/scss/components/PsDraggable.scss +64 -0
  20. package/src/assets/scss/components/PsDropdown.scss +9 -24
  21. package/src/assets/scss/components/PsDropdownList.scss +19 -0
  22. package/src/assets/scss/components/PsInlineSelector.scss +40 -25
  23. package/src/assets/scss/components/PsInput.scss +8 -3
  24. package/src/assets/scss/components/PsInputSelect.scss +6 -3
  25. package/src/assets/scss/components/PsInputTextArea.scss +5 -2
  26. package/src/assets/scss/components/PsMiniTag.scss +3 -3
  27. package/src/assets/scss/components/PsRadioButton.scss +5 -5
  28. package/src/assets/scss/components/PsSwitch.scss +4 -4
  29. package/src/assets/scss/components/PsTabHeader.scss +14 -0
  30. package/src/assets/scss/components/PsToast.scss +3 -3
  31. package/src/assets/scss/components/PsToggle.scss +6 -2
  32. package/src/assets/scss/components/PsTooltip.scss +50 -18
  33. package/src/components/accordion/PsAccordion.vue +7 -23
  34. package/src/components/accordion/PsAccordionItem.vue +42 -26
  35. package/src/components/badges-and-tags/PsCardInfos.vue +12 -0
  36. package/src/components/badges-and-tags/PsChartLegend.vue +13 -0
  37. package/src/components/badges-and-tags/PsClimateZoneBadge.vue +7 -0
  38. package/src/components/badges-and-tags/PsCostEffectBar.vue +6 -0
  39. package/src/components/badges-and-tags/PsHighlightRippleDot.vue +3 -1
  40. package/src/components/badges-and-tags/PsMiniTag.vue +6 -0
  41. package/src/components/badges-and-tags/PsProgressBar.vue +17 -9
  42. package/src/components/buttons/PsButton.vue +27 -2
  43. package/src/components/chips/PsChips.vue +33 -13
  44. package/src/components/controls/PsCheckbox.vue +32 -16
  45. package/src/components/controls/PsDraggable.vue +39 -150
  46. package/src/components/controls/PsInlineSelector.vue +34 -16
  47. package/src/components/controls/PsRadioButton.vue +28 -15
  48. package/src/components/controls/PsSlider.vue +1 -1
  49. package/src/components/controls/PsSwitch.vue +20 -11
  50. package/src/components/controls/PsToggle.vue +33 -12
  51. package/src/components/datatable/PsDataTable.vue +21 -1
  52. package/src/components/datatable/PsDataTableItem.vue +1 -1
  53. package/src/components/forms/PsDropdown.vue +73 -101
  54. package/src/components/forms/PsDropdownList.vue +82 -0
  55. package/src/components/forms/PsInput.vue +28 -1
  56. package/src/components/forms/PsInputSelect.vue +21 -0
  57. package/src/components/forms/PsInputTextArea.vue +54 -41
  58. package/src/components/notifications/PsDialog.vue +15 -0
  59. package/src/components/notifications/PsToast.vue +12 -0
  60. package/src/components/playground/PsScrollBar.vue +54 -0
  61. package/src/components/tabs/PsTabHeader.vue +31 -5
  62. package/src/components/tooltip/PsDialogTooltip.vue +107 -24
  63. package/src/components/tooltip/PsRichTooltip.vue +12 -9
  64. package/src/components/tooltip/PsTooltip.vue +27 -11
  65. package/src/components/ui/PsDotLoader.vue +15 -0
  66. package/src/components/ui/PsIcon.vue +30 -0
  67. package/src/index.js +39 -7
  68. package/src/stories/Accordion.stories.js +12 -48
  69. package/src/stories/Button.stories.js +30 -7
  70. package/src/stories/Chips.stories.js +16 -4
  71. package/src/stories/Colors.stories.mdx +1 -0
  72. package/src/stories/Dropdown.stories.js +81 -14
  73. package/src/stories/InlineSelector.stories.js +1 -1
  74. package/src/stories/Playground.stories.js +16 -0
  75. package/src/stories/Switch.stories.js +8 -2
  76. package/src/stories/Toast.stories.js +16 -16
  77. package/src/stories/Tooltip.stories.js +6 -6
  78. package/src/stories/Typography.stories.mdx +22 -18
  79. package/src/util/GeneralFunctions.js +8 -0
  80. package/src/util/imageLoader.js +1 -1
  81. package/tailwind.config.js +8 -3
  82. package/vetur/attributes.json +1376 -0
  83. package/vetur/tags.json +632 -0
  84. package/src/components/forms/PsDropdownCopy.vue +0 -212
@@ -2,31 +2,46 @@
2
2
  <div class="psui-el-accordion-item" :class="`status-${isOpen ? 'opened' : 'closed'}`">
3
3
  <div @click="toggle" class="psui-el-accordion-item-header">
4
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>
6
- </div>
7
- <div v-if="isOpen" class="psui-el-accordion-item-content">
8
- <slot></slot>
5
+ <i class="psui-el-accordion-item-icon">{{ getIcon }}</i>
9
6
  </div>
7
+ <transition
8
+ name="accordion-fade"
9
+ @enter="start"
10
+ @after-enter="end"
11
+ @before-leave="start"
12
+ @after-leave="end"
13
+ >
14
+ <div v-if="isOpen" class="psui-el-accordion-item-content">
15
+ <slot></slot>
16
+ </div>
17
+ </transition>
10
18
  </div>
11
19
  </template>
12
20
 
13
21
  <script>
22
+ import { getParentVueComponentByName } from '../../util/GeneralFunctions'
14
23
  export default {
15
- name: "PsAccordionItem",
24
+ name: 'PsAccordionItem',
16
25
  props: {
26
+ /**
27
+ * It sets the title of the accordion item.
28
+ */
17
29
  title: {
18
30
  type: String,
19
31
  required: true,
20
32
  },
21
- 'iconOpened': {
22
- type: String,
23
- },
24
- 'iconClosed': {
25
- type: String,
26
- },
33
+ /**
34
+ * It sets the status of the accordion item when mounted.
35
+ */
27
36
  opened: {
28
37
  type: [Boolean],
29
38
  default: false
39
+ },
40
+ /**
41
+ * It sets the text key to get the svg icon in Google Fonts. Make sure to get the correct description of your icon on https://fonts.google.com/.
42
+ */
43
+ icon: {
44
+ type: String
30
45
  }
31
46
  },
32
47
  data() {
@@ -35,17 +50,17 @@ export default {
35
50
  }
36
51
  },
37
52
  computed: {
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,
42
- }
43
- },
44
- getIcon() {
45
- return this.isOpen ? this.getIcons.iconOpened : this.getIcons.iconClosed
46
- },
47
53
  isOpen() {
48
54
  return this.localOpened !== null ? this.localOpened : this.opened
55
+ },
56
+ getParent() {
57
+ return getParentVueComponentByName(this,'PsAccordion')
58
+ },
59
+ getIcon(){
60
+ if(this.getParent._props.layout === 'medium') return 'expand_more'
61
+ if(this.getParent._props.layout === 'big' && this.isOpen === false) return 'add'
62
+ if(this.getParent._props.layout === 'big' && this.isOpen === true) return 'remove'
63
+ return `${this.icon}`
49
64
  }
50
65
  },
51
66
  methods: {
@@ -56,12 +71,13 @@ export default {
56
71
  this.localOpened = !this.localOpened
57
72
  }
58
73
  },
59
- getParentVueComponentByName(comp, name) {
60
- if (comp.$options.name === name) {
61
- return comp
62
- } else {
63
- return this.getParentVueComponentByName(comp.$parent, name)
64
- }
74
+ start(el) {
75
+ el.style.height = el.scrollHeight + 'px'
76
+ el.style.padding = el.srcollPaddingBottom + 'px'
77
+ },
78
+ end(el) {
79
+ el.style.height = ''
80
+ el.style.padding = ''
65
81
  }
66
82
  }
67
83
  }
@@ -17,18 +17,30 @@
17
17
  export default {
18
18
  name: 'PsCardInfos',
19
19
  props: {
20
+ /**
21
+ * It sets the title of your card.
22
+ */
20
23
  title: {
21
24
  type: String,
22
25
  default: 'Total',
23
26
  },
27
+ /**
28
+ * It sets the subtitle of your card if needed.
29
+ */
24
30
  subtitle: {
25
31
  type: String,
26
32
  default: '',
27
33
  },
34
+ /**
35
+ * It sets the text key to get the svg icon in Google Fonts. Make sure to get the right description of your icon on https://fonts.google.com/.
36
+ */
28
37
  icon: {
29
38
  type: String,
30
39
  default: 'edit',
31
40
  },
41
+ /**
42
+ * It sets the data that will show up when component is mounted.
43
+ */
32
44
  total: {
33
45
  type: String,
34
46
  default: '',
@@ -13,19 +13,32 @@
13
13
 
14
14
  <script>
15
15
  export default {
16
+ name: 'PsChartLegend',
16
17
  props: {
18
+ /**
19
+ * It sets the text of the chart legend.
20
+ */
17
21
  text: {
18
22
  type: [String, Number],
19
23
  default: 'Climate Zone 10',
20
24
  },
25
+ /**
26
+ * It sets the data that will show up when component is mounted.
27
+ */
21
28
  total: {
22
29
  type: String,
23
30
  default: null,
24
31
  },
32
+ /**
33
+ * It sets the data that wull show up when component is mounted.
34
+ */
25
35
  percentage: {
26
36
  type: String,
27
37
  default: null,
28
38
  },
39
+ /**
40
+ * It sets the color of the dot component.
41
+ */
29
42
  dotColor: {
30
43
  type: Object,
31
44
  default: null
@@ -9,11 +9,18 @@
9
9
 
10
10
  <script>
11
11
  export default {
12
+ name: 'PsClimateZoneBadge',
12
13
  props: {
14
+ /**
15
+ * It sets the text key to get the svg icon in Google Fonts. Make sure to get the right description of your icon on https://fonts.google.com/.
16
+ */
13
17
  icon: {
14
18
  type: String,
15
19
  default: 'area_chart',
16
20
  },
21
+ /**
22
+ * It sets the content that will show up when the component is rendered.
23
+ */
17
24
  content: {
18
25
  type: Number,
19
26
  default: 10,
@@ -22,11 +22,17 @@ export default {
22
22
  },
23
23
 
24
24
  props: {
25
+ /**
26
+ * It sets the value of the progress bar within costeffectbar.
27
+ */
25
28
  value: {
26
29
  type: Number,
27
30
  required: true,
28
31
  default: 0,
29
32
  },
33
+ /**
34
+ * It sets the threshold of being effective or not effective within costeffectbar.
35
+ */
30
36
  breakEven: {
31
37
  type: Number,
32
38
  required: true,
@@ -5,7 +5,9 @@
5
5
  </template>
6
6
 
7
7
  <script>
8
- export default {}
8
+ export default {
9
+ name: 'PsHighlightRippleDot',
10
+ }
9
11
  </script>
10
12
 
11
13
  <style> /* Please, use the file src/assets/scss/components/PsHighlightRippleDot.scss */</style>
@@ -15,11 +15,17 @@ export const typeOptions = [
15
15
  export default {
16
16
  name: 'PsMiniTag',
17
17
  props: {
18
+ /**
19
+ * It sets the layout of the the minitag. eg: info, success, warning, error and default.
20
+ */
18
21
  layout: {
19
22
  type: String,
20
23
  default: 'info',
21
24
  validator: (value) => typeOptions.indexOf(value) !== -1,
22
25
  },
26
+ /**
27
+ * It sets the message that will show up within the minitag when component is rendered.
28
+ */
23
29
  message: {
24
30
  type: String,
25
31
  required: true,
@@ -13,21 +13,29 @@
13
13
 
14
14
  <script>
15
15
  export default {
16
+ name: 'PsProgressBar',
16
17
  props: {
17
- value: {
18
- type: Number,
19
- required: true,
20
- default: 0,
21
- validator: (value) => {
22
- return value >= 0 && value <= 100
23
- },
18
+ /**
19
+ * It sets the value of the progress bar.
20
+ */
21
+ value: {
22
+ type: Number,
23
+ required: true,
24
+ default: 0,
25
+ validator: (value) => {
26
+ return value >= 0 && value <= 100
24
27
  },
28
+ },
29
+ /**
30
+ * It sets the color of the progressbar.
31
+ */
25
32
  percentageColor: {
26
33
  type: String,
27
34
  default: 'psui-bg-blue-60'
28
- // required: true,
29
-
30
35
  },
36
+ /**
37
+ * It sets the background color of the progressbar.
38
+ */
31
39
  bgColor: {
32
40
  type: String,
33
41
  default: 'psui-bg-blue-20'
@@ -14,31 +14,52 @@
14
14
  <script>
15
15
  export default {
16
16
  props: {
17
+ /**
18
+ * It set de label of the button when component is rendered.
19
+ */
17
20
  label: {
18
21
  type: String,
19
22
  },
23
+ /**
24
+ * It set the layout of the button. eg: solid, outline, ghost, onlytext and caution.
25
+ */
20
26
  layout: {
21
27
  type: String,
22
28
  default: 'solid',
23
- validator: (value) => ['solid','outline','ghost','onlytext'].includes(value)
29
+ validator: (value) => ['solid','outline','ghost','onlytext','caution'].includes(value)
24
30
  },
31
+ /**
32
+ * It sets the text key which will retrieve a icon from Google Fonts. Make sure to get the correct description of your icon on https://fonts.google.com/.
33
+ */
25
34
  icon: {
26
35
  type: String,
27
36
  },
37
+ /**
38
+ * It sets the position of the icon. eg: left or right.
39
+ */
28
40
  iconPosition:{
29
41
  type: String,
30
42
  default: 'left',
31
43
  validator: (value) => ['left','right'].includes(value)
32
44
  },
45
+ /**
46
+ * It sets the size of the icon. eg: small, medium and big.
47
+ */
33
48
  size: {
34
49
  type: String,
35
50
  default: 'big',
36
51
  validator: (value) => ['small','medium','big'].includes(value)
37
52
  },
53
+ /**
54
+ * It disable the button. All mouse event are disabled.
55
+ */
38
56
  disabled: {
39
57
  type: Boolean,
40
58
  default: false
41
59
  },
60
+ /**
61
+ * It set any further css style that might be needed.
62
+ */
42
63
  iconClass:{
43
64
  type: String
44
65
  }
@@ -50,7 +71,11 @@ export default {
50
71
  },
51
72
  computed: {
52
73
  getComponentClass(){
53
- return `layout-${this.layout} size-${this.size} icon-${this.iconPosition}`
74
+ if(this.icon){
75
+ return `layout-${this.layout} size-${this.size} icon-${this.iconPosition}`
76
+ } else {
77
+ return `layout-${this.layout} size-${this.size}`
78
+ }
54
79
  }
55
80
  },
56
81
  methods: {
@@ -5,6 +5,7 @@
5
5
  >
6
6
  <input
7
7
  @change="onChange"
8
+ :disabled="disabled"
8
9
  v-if="type != 'button'"
9
10
  :type="type"
10
11
  :id="label"
@@ -12,12 +13,12 @@
12
13
  />
13
14
  <label
14
15
  @click="onClick"
16
+ :disabled="disabled"
15
17
  :for="label"
16
18
  :class="getCssClass"
17
19
  >
18
20
  <i v-if="icon" class="psui-el-chips-icon psui-el-chips-icon-prepend">{{ icon }}</i>
19
21
  {{ label }}
20
- {{ layout }}
21
22
  <button
22
23
  @click="onClose"
23
24
  v-if="layout === 'rich'"
@@ -30,44 +31,65 @@
30
31
  </template>
31
32
 
32
33
  <script>
33
- export const type = ["radio", "checkbox", "button"]
34
+ export const type = ['radio', 'checkbox', 'button']
34
35
 
35
36
  export default {
36
- name: "PsChips",
37
+ name: 'PsChips',
37
38
  props: {
39
+ /**
40
+ * It sets the label of the chips button.
41
+ */
38
42
  label: {
39
43
  type: String,
40
- default: "",
44
+ default: '',
41
45
  },
46
+ /**
47
+ * It sets the type of the chips button. eg: radio, checkbox, button.
48
+ */
42
49
  type: {
43
50
  type: String,
44
51
  required: true,
45
52
  default: 'button',
46
- validator: (type) => ["radio", "checkbox", "button"].includes(type)
53
+ validator: (type) => ['radio', 'checkbox', 'button'].includes(type)
47
54
  },
55
+ /**
56
+ * It sets the layout of the chipsbutton. eg: simple, with-icon, rich.
57
+ */
48
58
  layout: {
49
59
  type: String,
50
60
  default: 'simple',
51
61
  validator: (value) => ['simple', 'with-icon', 'rich'].includes(value)
52
62
  },
63
+ /**
64
+ * It sets the text key which will retrieve a icon from Google Fonts. Make sure to get the right description of your icon on https://fonts.google.com/.
65
+ */
53
66
  icon: {
54
67
  type: String,
55
- default: "",
68
+ default: '',
56
69
  },
70
+ /**
71
+ * It sets if the button was checked or not checked.
72
+ */
57
73
  checked: {
58
74
  type: Boolean,
59
75
  default: false
60
76
  },
77
+ /**
78
+ * It disables the chips button.
79
+ */
61
80
  disabled: {
62
81
  type: Boolean,
63
82
  default: false
64
83
  },
84
+ /**
85
+ * It sets if the button is active or not.
86
+ */
65
87
  active: {
66
88
  type: Boolean,
67
89
  default: false
68
90
  },
69
91
  },
70
- emits: ["click", "change"],
92
+ emits: ['click', 'change'],
71
93
  data() {
72
94
  return {
73
95
  isChecked: false,
@@ -85,7 +107,7 @@ export default {
85
107
  let cssClass = ''
86
108
 
87
109
  if (this.checked === true ) {
88
- cssClass = "psui-text-blue-50 psui-bg-blue-20"
110
+ cssClass = 'psui-text-blue-50 psui-bg-blue-20'
89
111
  }
90
112
 
91
113
  return cssClass
@@ -94,17 +116,15 @@ export default {
94
116
  methods: {
95
117
  onClick() {
96
118
  this.isChecked = !this.isChecked
97
- this.$emit("click")
119
+ this.$emit('click')
98
120
  },
99
121
  onChange(event) {
100
-
101
122
  this.isChecked = event.target.checked
102
-
103
123
  this.$emit('update:checked', event.target.checked)
104
- this.$emit("change")
124
+ this.$emit('change', event)
105
125
  },
106
126
  onClose() {
107
- this.$emit("close")
127
+ this.$emit('close')
108
128
  },
109
129
  },
110
130
  }
@@ -3,10 +3,9 @@
3
3
  <input
4
4
  :id="label"
5
5
  type="checkbox"
6
- :value="label"
7
- @change="onChange"
8
- :checked="checked"
9
- :disabled='disabled'
6
+ :value="inputValue"
7
+ v-model="model"
8
+ :disabled="disabled"
10
9
  />
11
10
  <label :for="label" class="psui-el-checkmark"><span>{{ label }}</span></label>
12
11
  </div>
@@ -18,41 +17,58 @@
18
17
  export default {
19
18
  name: 'PsCheckbox',
20
19
  props: {
20
+ /**
21
+ * It sets the label of the checkbox input.
22
+ */
21
23
  label: {
22
24
  type: String,
23
25
  default: '',
24
26
  },
27
+ /**
28
+ * It sets the value which should be monitored.
29
+ */
30
+ inputValue: {
31
+ type: String,
32
+ },
33
+ value:{
34
+ type: Array
35
+ },
36
+ /**
37
+ * It disables the checkbox input.
38
+ */
25
39
  disabled: {
26
40
  type: Boolean,
27
41
  default: false,
28
42
  },
43
+ /**
44
+ * It set the of the checkbox input. eg: big and small.
45
+ */
29
46
  size: {
30
47
  type: String,
31
48
  default: 'big',
32
49
  validator: (value)=> ['big', 'small'].includes(value)
33
50
  },
34
- checked:{
35
- type: Boolean,
36
- },
51
+ /**
52
+ * It set the layout of the checkbox input. eg: default and mixed.
53
+ */
37
54
  layout:{
38
55
  type: String,
39
56
  default: 'default',
40
57
  validator: (value)=> ['default','mixed'].includes(value)
41
58
  }
42
59
  },
43
- emits:['@update:checked', 'value'],
44
60
  computed:{
45
61
  getComponentClass(){
46
62
  return `size-${this.size} layout-${this.layout}`
47
- }
48
- },
49
- methods:{
50
- onChange(event){
51
- if(!this.disabled){
52
- this.$emit('value', event.target.value)
53
- this.$emit('update:checked', event.target.checked)
63
+ },
64
+ model: {
65
+ get(){
66
+ return this.value
67
+ },
68
+ set(value){
69
+ this.$emit('input', value)
54
70
  }
55
- }
71
+ }
56
72
  },
57
73
  }
58
74
  </script>