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

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 (81) hide show
  1. package/.storybook/preview.js +7 -1
  2. package/README.md +6 -2
  3. package/dist/css/psui_styles.css +1863 -210
  4. package/package.json +15 -5
  5. package/src/assets/scss/base.scss +4 -0
  6. package/src/assets/scss/components/PsAccordion.scss +28 -11
  7. package/src/assets/scss/components/PsButton.scss +39 -18
  8. package/src/assets/scss/components/PsCardInfos.scss +1 -1
  9. package/src/assets/scss/components/PsCheckbox.scss +4 -5
  10. package/src/assets/scss/components/PsChips.scss +13 -8
  11. package/src/assets/scss/components/PsClimateZoneBadge.scss +1 -1
  12. package/src/assets/scss/components/PsCostEffectBar.scss +22 -27
  13. package/src/assets/scss/components/PsDialog.scss +5 -2
  14. package/src/assets/scss/components/PsDotLoader.scss +45 -0
  15. package/src/assets/scss/components/PsDraggable.scss +64 -0
  16. package/src/assets/scss/components/PsDropdown.scss +5 -22
  17. package/src/assets/scss/components/PsDropdownList.scss +19 -0
  18. package/src/assets/scss/components/PsHighlightRippleDot.scss +1 -1
  19. package/src/assets/scss/components/PsInlineSelector.scss +92 -1
  20. package/src/assets/scss/components/PsInput.scss +8 -3
  21. package/src/assets/scss/components/PsInputSelect.scss +75 -30
  22. package/src/assets/scss/components/PsInputTextArea.scss +5 -2
  23. package/src/assets/scss/components/PsMiniTag.scss +36 -0
  24. package/src/assets/scss/components/PsRadioButton.scss +5 -5
  25. package/src/assets/scss/components/PsSwitch.scss +4 -4
  26. package/src/assets/scss/components/PsTabHeader.scss +14 -0
  27. package/src/assets/scss/components/PsToast.scss +3 -3
  28. package/src/assets/scss/components/PsToggle.scss +6 -2
  29. package/src/assets/scss/components/PsTooltip.scss +51 -18
  30. package/src/components/accordion/PsAccordion.vue +7 -23
  31. package/src/components/accordion/PsAccordionItem.vue +41 -25
  32. package/src/components/badges-and-tags/PsCardInfos.vue +12 -0
  33. package/src/components/badges-and-tags/PsChartLegend.vue +13 -0
  34. package/src/components/badges-and-tags/PsClimateZoneBadge.vue +7 -0
  35. package/src/components/badges-and-tags/PsCostEffectBar.vue +6 -1
  36. package/src/components/badges-and-tags/PsHighlightRippleDot.vue +3 -1
  37. package/src/components/badges-and-tags/PsMiniTag.vue +21 -24
  38. package/src/components/badges-and-tags/PsProgressBar.vue +17 -9
  39. package/src/components/buttons/PsButton.vue +27 -2
  40. package/src/components/chips/PsChips.vue +24 -4
  41. package/src/components/controls/PsCheckbox.vue +32 -16
  42. package/src/components/controls/PsDraggable.vue +39 -150
  43. package/src/components/controls/PsInlineSelector.vue +144 -6
  44. package/src/components/controls/PsRadioButton.vue +28 -15
  45. package/src/components/controls/PsSlider.vue +1 -1
  46. package/src/components/controls/PsSwitch.vue +20 -11
  47. package/src/components/controls/PsToggle.vue +33 -12
  48. package/src/components/datatable/PsDataTable.vue +18 -0
  49. package/src/components/forms/PsDropdown.vue +18 -60
  50. package/src/components/forms/PsDropdownList.vue +82 -0
  51. package/src/components/forms/PsInput.vue +28 -1
  52. package/src/components/forms/PsInputSelect.vue +31 -2
  53. package/src/components/forms/PsInputTextArea.vue +53 -40
  54. package/src/components/notifications/PsDialog.vue +15 -0
  55. package/src/components/notifications/PsToast.vue +15 -0
  56. package/src/components/playground/PsScrollBar.vue +15 -0
  57. package/src/components/tabs/PsTabHeader.vue +19 -1
  58. package/src/components/tooltip/PsDialogTooltip.vue +103 -20
  59. package/src/components/tooltip/PsRichTooltip.vue +6 -3
  60. package/src/components/tooltip/PsTooltip.vue +19 -3
  61. package/src/components/ui/PsDotLoader.vue +15 -0
  62. package/src/components/ui/PsIcon.vue +30 -0
  63. package/src/index.js +39 -7
  64. package/src/stories/Accordion.stories.js +12 -48
  65. package/src/stories/Button.stories.js +30 -7
  66. package/src/stories/Chips.stories.js +14 -2
  67. package/src/stories/Colors.stories.mdx +1 -0
  68. package/src/stories/Dropdown.stories.js +36 -13
  69. package/src/stories/InlineSelector.stories.js +3 -1
  70. package/src/stories/InputSelect.stories.js +8 -0
  71. package/src/stories/MiniTag.stories.js +12 -6
  72. package/src/stories/Playground.stories.js +16 -0
  73. package/src/stories/Switch.stories.js +8 -2
  74. package/src/stories/Toast.stories.js +16 -16
  75. package/src/stories/Tooltip.stories.js +6 -6
  76. package/src/stories/Typography.stories.mdx +22 -18
  77. package/src/util/GeneralFunctions.js +8 -0
  78. package/tailwind.config.js +8 -3
  79. package/vetur/attributes.json +1376 -0
  80. package/vetur/tags.json +632 -0
  81. package/src/components/badges-and-tags/PsCostEffectBar.Copy.vue +0 -72
@@ -1,20 +1,18 @@
1
1
  <template>
2
- <div class="background-temporary">
3
2
  <div
4
3
  class="psui-el-dropdown-menu"
5
4
  ref="PSDropdown"
5
+ v-click-outside="close"
6
6
  >
7
7
 
8
- <div class="psui-bg-red" ref="PSDropdownTrigger" v-if="$slots.dropdownTrigger" @click="show && !toggleWhenActive ? '' : toggle()" >
9
- <slot name="dropdownTrigger" ></slot>
8
+ <div ref="PSDropdownTrigger" v-if="$slots.dropdownTrigger" @click="show && !toggleWhenActive ? '' : toggle()">
9
+ <slot name="dropdownTrigger"></slot>
10
10
  </div>
11
11
 
12
12
  <button
13
13
  v-else
14
14
  @click="show && !toggleWhenActive ? '' : toggle()"
15
15
  type="button"
16
- class="psui-el-dropdown-menu-button"
17
- :class="[buttonClasses]"
18
16
  :id="id"
19
17
  aria-haspopup="true"
20
18
  aria-expanded="true"
@@ -23,55 +21,46 @@
23
21
  <slot v-if="show && $slots.buttonLabelOnShow" name="buttonLabelOnShow"></slot>
24
22
  <slot v-else name="buttonLabel"></slot>
25
23
  </button>
26
-
27
24
  <div
28
25
  ref="PSDropdownDialog"
29
26
  role="menu"
30
- class="psui-el-dropdown-menu-dialog"
27
+ class="psui-el-dropdown-menu-dialog-wrapper psui-duration-300"
31
28
  aria-orientation="vertical"
32
29
  :aria-labelledby="id"
33
- :class="[dialogClasses]"
34
- :style="{ minWidth: minWidthDropdown, marginLeft: marginLeft }"
30
+ :style="{ minWidth: minWidthDropDown }"
35
31
  >
36
-
37
- <div class="psui-el-dropdown-menu-dialog-category-divider">
38
- <h2 class="ts--accent--1" v-if="title">{{ title }}</h2>
32
+ <div class="psui-el-dropdown-menu-dialog">
39
33
  <slot name="items"></slot>
40
34
  </div>
41
-
42
35
  </div>
43
36
  </div>
44
- </div>
45
37
  </template>
46
38
 
47
39
  <script>
40
+ // Figma - 2.3 Dropdown with category divider https://www.figma.com/file/Tto8hrNlSfuPcwd1pfqogF/%E2%9A%A1%EF%B8%8F-Design-System?node-id=1768%3A64886
41
+
48
42
  import { randomString, getParentScrollableEl } from '../../util/GeneralFunctions'
49
43
 
50
44
  export default {
51
45
  name: 'PsDropdown',
52
46
  props: {
53
- buttonClasses: {
54
- type: String,
55
- default: 'psui-bg-white psui-border psui-border-blue'
56
- },
57
- title: {
58
- type: String,
59
- },
60
- dialogClasses: {
61
- type: String,
62
- default: 'psui-p-6 psui-left-0 psui-bg-white'
63
- },
64
- minWidthDropdown: {
65
- type: [String, Number],
66
- },
67
- maxWidthDropDown: {
47
+ /**
48
+ * It sets a minimun width for the dropdown menu.
49
+ */
50
+ minWidthDropDown: {
68
51
  type: String,
69
52
  default: '340px'
70
53
  },
54
+ /**
55
+ * It's a boolean responsible for showing a slot within the html tag button.
56
+ */
71
57
  buttonLabelOnShow: {
72
58
  type: Boolean,
73
59
  default: false
74
60
  },
61
+ /**
62
+ * It's a property responsible for toggling the dropdown menu. default: true.
63
+ */
75
64
  toggleWhenActive: {
76
65
  type: Boolean,
77
66
  default: true
@@ -179,34 +168,3 @@ export default {
179
168
  }
180
169
  </script>
181
170
 
182
- <style>
183
-
184
- .background-temporary {
185
- width: 300px;
186
- height: 200px;
187
- left: 0;
188
- top: 8px;
189
-
190
- background-color: #e6ecf2;
191
- border: 1.5px dashed #7b61ff;
192
- display: flex;
193
- align-items: center;
194
- justify-content: center;
195
- }
196
-
197
- /* .dropdown-button {
198
- background-color: transparent;
199
- padding-top: 2.5px;
200
- padding-bottom: 2.5px;
201
- min-height: 27px;
202
- } */
203
-
204
- /* .dropdown-button:focus {
205
- outline: none;
206
- } */
207
-
208
- /* .psui-dropdown-dialog {
209
- transition: opacity 150ms ease-in-out;
210
- } */
211
-
212
- </style>
@@ -0,0 +1,82 @@
1
+ <template>
2
+ <ul class="psui-el-dropdown-menu-list">
3
+ <li
4
+ v-for="item in getItems"
5
+ :key="getKeyValue(item)"
6
+ @click="selectItem(item)"
7
+ >
8
+ <span>{{ getKeyLabel(item) }}</span>
9
+ </li>
10
+ </ul>
11
+ </template>
12
+
13
+ <script>
14
+ export default {
15
+ name: 'PsDropdownSimple',
16
+ props: {
17
+ /**
18
+ * 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/.
19
+ */
20
+ icon:{
21
+ type: String,
22
+ },
23
+ /**
24
+ * It sets the items which will be displayed on the dropdown menu.
25
+ */
26
+ items: {
27
+ type: Array,
28
+ required: true
29
+ },
30
+ /**
31
+ * It sets the item selected on the dropdown menu.
32
+ */
33
+ selected: {},
34
+ /**
35
+ * It sets the key label of your items if needed.
36
+ */
37
+ keyLabel: {
38
+ type: [String, Function],
39
+ default: 'label'
40
+ },
41
+ /**
42
+ * It sets the key value of your items if needed.
43
+ */
44
+ keyValue: {
45
+ type: [String, Function],
46
+ default: 'value'
47
+ }
48
+ },
49
+ computed: {
50
+ getSelected() {
51
+ if (this.selected) {
52
+ if (typeof this.selected === 'object' && this.selected[this.keyValue] ) {
53
+ return this.selected[this.keyValue]
54
+ } else {
55
+ return this.selected
56
+ }
57
+ } else {
58
+ return false
59
+ }
60
+ },
61
+ getItems() {
62
+ return this.items
63
+ },
64
+ },
65
+ methods: {
66
+ selectItem(item) {
67
+ this.$emit('update:selected', this.getKeyValue(item) )
68
+ this.$emit('change', item )
69
+ },
70
+ getKeyLabel(item) {
71
+ if(typeof this.keyLabel == 'function') return this.keyLabel(item)
72
+ if(typeof item === 'string') return item
73
+ return item[this.keyLabel]
74
+ },
75
+ getKeyValue(item) {
76
+ if(typeof this.keyValue == 'function') return this.keyValue(item)
77
+ if(typeof item === 'string') return item
78
+ return item[this.keyValue]
79
+ },
80
+ }
81
+ }
82
+ </script>
@@ -46,35 +46,62 @@
46
46
  export default {
47
47
  name: 'PsInput',
48
48
  props: {
49
+ /**
50
+ * It sets the type of your button. default: text.
51
+ */
49
52
  type: {
50
53
  type: String,
51
54
  default: 'text'
52
55
  },
56
+ /**
57
+ * It sets a placeholder for your button if needed.
58
+ */
53
59
  placeholder: {
54
60
  type: String
55
61
  },
62
+ /**
63
+ * It sets the label of the input if needed.
64
+ */
56
65
  label: {
57
66
  type: String
58
67
  },
68
+ /**
69
+ * It sets a text below the input. See Figma Text fileds & Forms.
70
+ */
59
71
  hint: {
60
72
  type: String
61
- },
73
+ },
74
+ /**
75
+ * It sets the layout of your button. eg: mini and default.
76
+ */
62
77
  layout: {
63
78
  type: String,
64
79
  default: 'default',
65
80
  validator: (value) => ['default', 'mini'].includes(value)
66
81
  },
82
+ /**
83
+ * It sets the value of the button.
84
+ */
67
85
  value: {
68
86
  required: true,
69
87
  },
88
+ /**
89
+ * It disables the input. All mouse events are disabled.
90
+ */
70
91
  disabled: {
71
92
  type: Boolean,
72
93
  default: false
73
94
  },
95
+ /**
96
+ * It sets if the input found any error.
97
+ */
74
98
  hasError: {
75
99
  type: [String, Boolean],
76
100
  default: false
77
101
  },
102
+ /**
103
+ * It sets a active css class based on a boolean property.
104
+ */
78
105
  active: {
79
106
  type: Boolean,
80
107
  default: false
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="psui-el-input-select" :class="[{'disabled':disabled}, {'selected':selectedClass}]">
2
+ <div class="psui-el-input-select" :class="[{'disabled':disabled}, getComponentClass, {'selected':selectedClass}]">
3
3
  <label :for='label' v-if="label" >{{ label }}</label>
4
4
  <select
5
5
  :name="label"
@@ -9,7 +9,7 @@
9
9
  <option value='' disabled>Select</option>
10
10
  <option v-for="item in getItems" :value="item[keyValue]" :key="item[keyValue]">{{ item[keyLabel] }}</option>
11
11
  </select>
12
- <p v-if="optionalLabel && !disabled" class="psui-el-input-helper">{{ optionalLabel }}</p>
12
+ <p v-if="optionalLabel && !disabled && layout !== 'mini'" class="psui-el-input-helper">{{ optionalLabel }}</p>
13
13
  </div>
14
14
  </template>
15
15
 
@@ -18,6 +18,9 @@
18
18
  export default {
19
19
  name: 'PsSelectInput',
20
20
  props: {
21
+ /**
22
+ * It sets the items which will be rendered within the select input.
23
+ */
21
24
  items: {
22
25
  required: true
23
26
  },
@@ -25,21 +28,44 @@ export default {
25
28
  default: '',
26
29
  required: true
27
30
  },
31
+ /**
32
+ * It sets the value label of the select input if needed.
33
+ */
28
34
  label: {
29
35
  default: ''
30
36
  },
37
+ /**
38
+ * It sets a o optional label below the select input.
39
+ */
31
40
  optionalLabel:{
32
41
  default:''
33
42
  },
43
+ /**
44
+ * It sets the key label of your items if needed.
45
+ */
34
46
  keyLabel: {
35
47
  default: 'label'
36
48
  },
49
+ /**
50
+ * It sets the key value of yout items if needed.
51
+ */
37
52
  keyValue: {
38
53
  default: 'value'
39
54
  },
55
+ /**
56
+ * It disables the select input. All mouse events are disabled.
57
+ */
40
58
  disabled: {
41
59
  type: Boolean,
42
60
  default: false
61
+ },
62
+ /**
63
+ * It sets the layout of the select input. eg: default and mini.
64
+ */
65
+ layout:{
66
+ type: String,
67
+ default: 'default',
68
+ validator: (value) => ['default','mini'].includes(value)
43
69
  }
44
70
  },
45
71
  data(){
@@ -48,6 +74,9 @@ export default {
48
74
  }
49
75
  },
50
76
  computed: {
77
+ getComponentClass(){
78
+ return `layout-${this.layout}`
79
+ },
51
80
  childValue: {
52
81
  get() {
53
82
  return this.value
@@ -23,48 +23,61 @@
23
23
  export default {
24
24
  name: "PsInputTextArea",
25
25
  props: {
26
- placeholder: {
27
- type: String,
28
- default: ''
29
- },
30
- value: {
31
- required: true,
32
- },
33
- label: {
34
- type: String,
35
- },
36
- optionalLabel:{
37
- type: String,
38
- },
39
- action: {
40
- type: Function,
41
- required: false
42
- },
43
- required:{
44
- type: Boolean,
45
- default:true
46
- },
47
- autocapitalize: {
48
- type: String,
49
- default: 'sentences'
50
- },
51
- autocomplete: {
52
- type: Boolean,
53
- default: true
54
- },
55
- rows: {
56
- type: Number,
57
- default: 5
58
- },
59
- disabled: {
60
- type: Boolean,
61
- default: false,
62
- }
26
+ /**
27
+ * It sets the placeholder of the textarea input.
28
+ */
29
+ placeholder: {
30
+ type: String,
31
+ default: ''
63
32
  },
64
- methods: {
65
- makeAction() {
66
- if(this.action && typeof(this.action) == 'function') this.action()
33
+ /**
34
+ * It sets the value selected of the textarea input.
35
+ */
36
+ value: {
37
+ required: true,
38
+ },
39
+ /**
40
+ * It sets the label of the textarea input.
41
+ */
42
+ label: {
43
+ type: String,
44
+ },
45
+ /**
46
+ * It sets a optional label if needed.
47
+ */
48
+ optionalLabel:{
49
+ type: String,
50
+ },
51
+ /**
52
+ * It sets aria-required property. eg: true or false.
53
+ */
54
+ required:{
55
+ type: Boolean,
56
+ default:true
57
+ },
58
+ /**
59
+ * It sets the type of autocapitalize. See mdn web-doc for full information. default: sentences.
60
+ */
61
+ autocapitalize: {
62
+ type: String,
63
+ default: 'sentences'
67
64
  },
65
+ /**
66
+ * It sets the size of the textarea input.
67
+ */
68
+ rows: {
69
+ type: Number,
70
+ default: 5
71
+ },
72
+ /**
73
+ * It disabled the textarea input. All mouse events are disabled.
74
+ */
75
+ disabled: {
76
+ type: Boolean,
77
+ default: false,
78
+ }
79
+ },
80
+ methods: {
68
81
  onBlur(){
69
82
  this.$emit('blur', this.$event)
70
83
  },
@@ -27,23 +27,38 @@
27
27
  export default {
28
28
  name: 'PsDialog',
29
29
  props: {
30
+ /**
31
+ * It sets the theme of the dialog. eg: informative, success and alert.
32
+ */
30
33
  theme: {
31
34
  type: String,
32
35
  default: 'informative',
33
36
  validator: (value) => ['informative', 'success', 'alert'].includes(value)
34
37
  },
38
+ /**
39
+ * It set the which will be displayed when component is rendered.
40
+ */
35
41
  message: {
36
42
  type: String,
37
43
  },
44
+ /**
45
+ * It sets the direction of the items within the dialog. See Figma Notifications for full information.
46
+ */
38
47
  layout:{
39
48
  type: String,
40
49
  default: 'horizontal',
41
50
  validator: (value) => ['horizontal', 'vertical'].includes(value)
42
51
  },
52
+ /**
53
+ * It sets a close button if needed.
54
+ */
43
55
  hasClose: {
44
56
  type: Boolean,
45
57
  default: true
46
58
  },
59
+ /**
60
+ * 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/.
61
+ */
47
62
  icon: {
48
63
  type: String,
49
64
  default: 'info'
@@ -12,19 +12,31 @@
12
12
  export default {
13
13
  name: 'PsToast',
14
14
  props: {
15
+ /**
16
+ * It sets the layout of the toast. eg: info, success, warning and error.
17
+ */
15
18
  layout: {
16
19
  type: String,
17
20
  default: 'info',
18
21
  validator: (value) => ['info', 'success', 'warning', 'error'].includes(value)
19
22
  },
23
+ /**
24
+ * It sets a supportive layout. eg: soft and intese. See Figma - Notification for full information.
25
+ */
20
26
  fill: {
21
27
  type: String,
22
28
  default: 'intense',
23
29
  validator: (value) => ['soft', 'intense'].includes(value)
24
30
  },
31
+ /**
32
+ * It sets the message which will be displayed when component is rendered.
33
+ */
25
34
  message: {
26
35
  type: String,
27
36
  },
37
+ /**
38
+ * 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/.
39
+ */
28
40
  icon:{
29
41
  type: String,
30
42
  }
@@ -36,3 +48,6 @@ export default {
36
48
  },
37
49
  }
38
50
  </script>
51
+
52
+ <style> /* Please, use the file src/assets/scss/components/PsToast.scss */ </style>
53
+
@@ -0,0 +1,15 @@
1
+ <template>
2
+ <div>
3
+ Playground
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ export default {
9
+ name: 'PsScrollBar',
10
+ }
11
+ </script>
12
+
13
+ <style>
14
+
15
+ </style>
@@ -13,7 +13,7 @@
13
13
  @click="selectTab(item)"
14
14
  :class="getButtonClass(item)"
15
15
  >
16
- <PsRichTooltip v-if="item.tooltip" :title="item.tooltip" type="blue">
16
+ <PsRichTooltip v-if="item.tooltip" :title="item.tooltip" layout="blue">
17
17
  <template v-slot:trigger>
18
18
  <span>{{ item[keyLabel] }}</span>
19
19
  </template>
@@ -31,27 +31,45 @@ export default {
31
31
  name: 'PsTabHeader',
32
32
  components: { PsRichTooltip },
33
33
  props: {
34
+ /**
35
+ * It sets the layout of the tabheader. eg: standard, underline and folder.
36
+ */
34
37
  layout: {
35
38
  type: String,
36
39
  default: 'standard',
37
40
  validator: (value) => ['standard', 'underline', 'folder'].includes(value)
38
41
  },
42
+ /**
43
+ * It sets the tabs which will be rendered.
44
+ */
39
45
  items: {
40
46
  type: Array,
41
47
  required: true
42
48
  },
49
+ /**
50
+ * It sets the key label of the items if needed.
51
+ */
43
52
  keyLabel: {
44
53
  type: String,
45
54
  default: 'label'
46
55
  },
56
+ /**
57
+ * It sets the key value of the items if needed.
58
+ */
47
59
  keyValue: {
48
60
  type: String,
49
61
  default: 'value'
50
62
  },
63
+ /**
64
+ * It disabled the tab header. All mouse events are disabled.
65
+ */
51
66
  disabled: {
52
67
  type: Boolean,
53
68
  default: false
54
69
  },
70
+ /**
71
+ * It sets the tab seleced.
72
+ */
55
73
  selected: {},
56
74
  },
57
75
  computed: {