@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,97 +1,45 @@
1
1
  <template>
2
- <div class="switch-button-control">
3
- <div
4
- :class="{ enabled: active, 'switch-button': !small, 'switch-button-small': small }"
5
- @click="toggle"
6
- :style="{'--color': color}"
7
- >
8
- <div class="button"></div>
9
- </div>
10
- <div class="switch-button-label">
11
- <slot></slot>
12
- </div>
2
+ <div class='psui-el-switch' :class="getComponentClass">
3
+ <input type="checkbox" :id='label' @change="onChange">
4
+ <transition>
5
+ <label :for="label" class='psui-el-switch-button' :class="getToggleClass" />
6
+ </transition>
13
7
  </div>
14
8
  </template>
15
9
 
16
10
  <script>
11
+ //FIGMA CONTROLS & SELECTORS https://www.figma.com/file/Tto8hrNlSfuPcwd1pfqogF/%E2%9A%A1%EF%B8%8F-Design-System?node-id=1768%3A64852
12
+
17
13
  export default {
18
14
  name: 'PsSwitch',
19
15
  props: {
20
- small: Boolean,
21
- active: Boolean,
22
- color: {
16
+ label:{
17
+ type: String,
18
+ },
19
+ value:{
20
+ type: Boolean,
21
+ required: true,
22
+ },
23
+ size:{
23
24
  type: String,
24
- required: false,
25
- default: '#5DB883'
25
+ default: 'big',
26
+ validator: (value)=> ['small', 'big'].includes(value)
26
27
  }
27
28
  },
28
- model: {
29
- prop: "active",
30
- event: "toggle"
29
+ computed:{
30
+ getToggleClass(){
31
+ return `toggle-${this.value.toString()}`
32
+ },
33
+ getComponentClass(){
34
+ return `size-${this.size}`
35
+ }
31
36
  },
32
- methods: {
33
- toggle: function() {
34
- this.$emit('toggle', !this.active)
37
+ methods:{
38
+ onChange(event){
39
+ this.value = event.target.checked
40
+ this.$emit('update:value', event.target.value)
35
41
  }
36
42
  }
37
- }
43
+ }
38
44
  </script>
39
45
 
40
- <style scoped>
41
- .switch-button-control {
42
- display: flex;
43
- flex-direction: row;
44
- align-items: center;
45
- }
46
- .switch-button-control .switch-button {
47
- height: 24px;
48
- width: calc(24px * 2);
49
- background-color: #A2ACB7;
50
- border: 2px solid #A2ACB7;
51
- border-radius: 24px;
52
- transition: all 0.3s ease-in-out;
53
- cursor: pointer;
54
- }
55
- .switch-button-control .switch-button-small {
56
- height: 16px;
57
- width: calc(16px * 2);
58
- background-color: #A2ACB7;
59
- border: 2px solid #A2ACB7;
60
- border-radius: 16px;
61
- transition: all 0.3s ease-in-out;
62
- cursor: pointer;
63
- }
64
- .switch-button-control .switch-button .button {
65
- height: calc(24px - (2 * 2px));
66
- width: calc(24px - (2 * 2px));
67
- border-radius: calc(24px - (2 * 2px));
68
- background:#F3F6F9;
69
- transition: all 0.3s ease-in-out;
70
- }
71
- .switch-button-control .switch-button-small .button {
72
- height: calc(16px - (2 * 2px));
73
- width: calc(16px - (2 * 2px));
74
- border-radius: calc(16px - (2 * 2px));
75
- background:#F3F6F9;
76
- transition: all 0.3s ease-in-out;
77
- }
78
- .switch-button-control .switch-button.enabled {
79
- background-color: var(--color);
80
- border: 2px solid var(--color);
81
- }
82
- .switch-button-control .switch-button-small.enabled {
83
- background-color: var(--color);
84
- border: 2px solid var(--color);
85
- }
86
- .switch-button-control .switch-button.enabled .button {
87
- background: white;
88
- transform: translateX(calc(calc(24px - (2 * 2px)) + (2 *2px)));
89
- }
90
- .switch-button-control .switch-button-small.enabled .button {
91
- background: white;
92
- transform: translateX(calc(calc(16px - (2 * 2px)) + (2 *2px)));
93
- }
94
- .switch-button-control .switch-button-label {
95
- margin-left: 10px;
96
- }
97
- </style>
@@ -1,39 +1,45 @@
1
- <template>
2
- <div class="psui-rounded-sm psui-inline-flex psui-bg-gray-10 wrapper psui-gap-x-px" role="group">
3
- <button
4
- v-for="(item, index) in items"
5
- :key="index"
6
- @click="selectOption(item)"
7
- type="button"
8
- class="psui-inline-flex psui-rounded-sm psui-text-small psui-text-blue-60 psui-px-2"
9
- :class="{'psui-bg-blue-60 psui-text-white psui-font-bold': selected === item}"
10
- >
11
- {{ item }}
12
- </button>
13
- </div>
14
- </template>
15
-
16
- <script>
17
- export default {
18
- name: 'PsSlider',
19
- props: {
20
- items: {
21
- type: Array,
22
- required: true
23
- },
24
- selected: {},
25
- },
26
- methods: {
27
- selectOption(item) {
28
- this.$emit('update:selected', item)
29
- this.$emit('change', item)
30
- }
31
- }
32
- }
33
- </script>
34
-
35
- <style scoped>
36
- .wrapper {
37
- padding: 2px;
38
- }
39
- </style>
1
+ <template>
2
+ <div class="psui-el-toggle" role="group">
3
+ <button
4
+ type="button"
5
+ v-for="(item, index) in items"
6
+ :key="index"
7
+ @click="selectOption(item)"
8
+ :class="{ 'status-active': getSelected === item }"
9
+ >
10
+ {{ item }}
11
+ </button>
12
+ </div>
13
+ </template>
14
+
15
+ <script>
16
+ //FIGMA CONTROLS & SELECTORS https://www.figma.com/file/Tto8hrNlSfuPcwd1pfqogF/%E2%9A%A1%EF%B8%8F-Design-System?node-id=1768%3A64852
17
+
18
+ export default {
19
+ name: 'PsToggle',
20
+ props: {
21
+ items: {
22
+ type: Array,
23
+ required: true
24
+ },
25
+ selected: {},
26
+ },
27
+ computed: {
28
+ getSelected() {
29
+ if (this.selected) {
30
+ return this.selected
31
+ } else {
32
+ return false
33
+ }
34
+ },
35
+ },
36
+ methods: {
37
+ selectOption(item) {
38
+ this.$emit('update:selected', item)
39
+ this.$emit('change', item)
40
+ }
41
+ }
42
+ }
43
+ </script>
44
+
45
+ <style> /* Please, use the file src/assets/scss/components/PsToggle.scss */</style>
@@ -1,10 +1,9 @@
1
1
  <template>
2
- <table :class='cssAlign' class='table psui-w-full psui-border-2 psui-border-gray-10' >
2
+ <table :class='cssAlign' class="psui-el-table psui-table">
3
3
  <thead v-if="header">
4
4
  <th
5
5
  v-for="head in header"
6
6
  :key="head"
7
- class='psui-bg-gray-10 psui-text-gray-80 psui-capitalize psui-font-bold'
8
7
  >
9
8
  {{ head }}
10
9
  </th>
@@ -21,7 +20,7 @@
21
20
  <th
22
21
  v-for="ft in footer"
23
22
  :key="ft"
24
- class='psui-bg-gray-10 psui-text-gray-80'
23
+ class='psui-bg-gray-10 psui-text-gray-80 psui-font-normal'
25
24
  >
26
25
  {{ ft }}
27
26
  </th>
@@ -75,15 +74,4 @@ export default {
75
74
  },
76
75
  }
77
76
  </script>
78
-
79
- <style scoped>
80
-
81
- .table th,
82
- .table td,
83
- .table tr {
84
- height: 40px;
85
- border: 1px solid #e6ecf2;
86
- padding: 11px 16px;
87
- }
88
-
89
- </style>
77
+ <style> /* Please, use the file src/assets/scss/components/PsDataTable.scss */</style>
@@ -1,6 +1,7 @@
1
1
  <template>
2
+ <div class="background-temporary">
2
3
  <div
3
- class="psui-relative psui-inline-block psui-text-left"
4
+ class="psui-el-dropdown-menu"
4
5
  ref="PSDropdown"
5
6
  >
6
7
 
@@ -12,7 +13,7 @@
12
13
  v-else
13
14
  @click="show && !toggleWhenActive ? '' : toggle()"
14
15
  type="button"
15
- class="psui-inline-flex psui-justify-center psui-items-center psui-w-full psui-font-medium psui-focus:shadow-outline-blue psui-dropdown-button psui-text-sm psui-leading-none"
16
+ class="psui-el-dropdown-menu-button"
16
17
  :class="[buttonClasses]"
17
18
  :id="id"
18
19
  aria-haspopup="true"
@@ -26,19 +27,21 @@
26
27
  <div
27
28
  ref="PSDropdownDialog"
28
29
  role="menu"
29
- class="psui-dropdown-dialog psui-hidden psui-origin-top-right psui-fixed psui-mt-2 psui-w-auto psui-rounded psui-shadow-lg psui-border psui-border-blue05 psui-z-50 psui-opacity-0"
30
+ class="psui-el-dropdown-menu-dialog"
30
31
  aria-orientation="vertical"
31
32
  :aria-labelledby="id"
32
33
  :class="[dialogClasses]"
33
34
  :style="{ minWidth: minWidthDropdown, marginLeft: marginLeft }"
34
35
  >
35
- <div class="w-full">
36
- <h2 class="psui-text-gray02 psui-font-bold psui-whitespace-no-wrap psui-mb-4 ts--accent--1" v-if="title">{{ title }}</h2>
36
+
37
+ <div class="psui-el-dropdown-menu-dialog-category-divider">
38
+ <h2 class="ts--accent--1" v-if="title">{{ title }}</h2>
37
39
  <slot name="items"></slot>
38
40
  </div>
39
41
 
40
42
  </div>
41
43
  </div>
44
+ </div>
42
45
  </template>
43
46
 
44
47
  <script>
@@ -178,19 +181,32 @@ export default {
178
181
 
179
182
  <style>
180
183
 
181
- .dropdown-button {
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 {
182
198
  background-color: transparent;
183
199
  padding-top: 2.5px;
184
200
  padding-bottom: 2.5px;
185
201
  min-height: 27px;
186
- }
202
+ } */
187
203
 
188
- .dropdown-button:focus {
204
+ /* .dropdown-button:focus {
189
205
  outline: none;
190
- }
206
+ } */
191
207
 
192
- .psui-dropdown-dialog {
208
+ /* .psui-dropdown-dialog {
193
209
  transition: opacity 150ms ease-in-out;
194
- }
210
+ } */
195
211
 
196
212
  </style>
@@ -0,0 +1,80 @@
1
+ <template>
2
+ <div class="psui-el-input-select" :class="[{'disabled':disabled}, {'selected':selectedClass}]">
3
+ <label :for='label' v-if="label" >{{ label }}</label>
4
+ <select
5
+ :name="label"
6
+ :id="label"
7
+ v-model="childValue"
8
+ >
9
+ <option value='' disabled>Select</option>
10
+ <option v-for="item in getItems" :value="item[keyValue]" :key="item[keyValue]">{{ item[keyLabel] }}</option>
11
+ </select>
12
+ <p v-if="optionalLabel && !disabled" class="psui-el-input-helper">{{ optionalLabel }}</p>
13
+ </div>
14
+ </template>
15
+
16
+ <script>
17
+
18
+ export default {
19
+ name: 'PsSelectInput',
20
+ props: {
21
+ items: {
22
+ required: true
23
+ },
24
+ value: {
25
+ default: '',
26
+ required: true
27
+ },
28
+ label: {
29
+ default: ''
30
+ },
31
+ optionalLabel:{
32
+ default:''
33
+ },
34
+ keyLabel: {
35
+ default: 'label'
36
+ },
37
+ keyValue: {
38
+ default: 'value'
39
+ },
40
+ disabled: {
41
+ type: Boolean,
42
+ default: false
43
+ }
44
+ },
45
+ data(){
46
+ return {
47
+ selectedClass: false,
48
+ }
49
+ },
50
+ computed: {
51
+ childValue: {
52
+ get() {
53
+ return this.value
54
+ },
55
+ set(value) {
56
+ if(this.isString) return this.$emit('input', value)
57
+ const finded = find(this.items, { [this.keyValue]: value })
58
+ this.$emit('input', value)
59
+ this.$emit('change', finded)
60
+ this.selectedClass = true
61
+ }
62
+ },
63
+ isString() {
64
+ return this.items.length > 0 && typeof this.items[0] === 'string'
65
+ },
66
+ getItems() {
67
+ if (this.items.length > 0 && typeof this.items[0] === 'string') {
68
+ return this.items.map((item) => {
69
+ return {
70
+ [this.keyLabel]: item,
71
+ [this.keyValue]: item,
72
+ }
73
+ })
74
+ } else {
75
+ return this.items
76
+ }
77
+ },
78
+ },
79
+ }
80
+ </script>
@@ -0,0 +1,80 @@
1
+ <template>
2
+ <div class="psui-el-input-textarea" :class="[{'disabled':disabled}]">
3
+ <div class="psui-el-input-textarea-wrapper">
4
+ <label :for="label" v-if="label">{{label}}</label>
5
+ <textarea
6
+ :id="label"
7
+ :autocapitalize="autocapitalize"
8
+ :aria-required="required"
9
+ :value="value"
10
+ @blur="onBlur"
11
+ @focus="onFocus"
12
+ @input="onInput"
13
+ :rows="rows"
14
+ :placeholder="placeholder"
15
+ :readonly='disabled'
16
+ />
17
+ </div>
18
+ <p class="psui-el-input-textarea-message" v-if="optionalLabel && !disabled">{{optionalLabel}}</p>
19
+ </div>
20
+ </template>
21
+
22
+ <script>
23
+ export default {
24
+ name: "PsInputTextArea",
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
+ }
63
+ },
64
+ methods: {
65
+ makeAction() {
66
+ if(this.action && typeof(this.action) == 'function') this.action()
67
+ },
68
+ onBlur(){
69
+ this.$emit('blur', this.$event)
70
+ },
71
+ onFocus(){
72
+ this.$emit('focus',this.$event)
73
+ },
74
+ onInput(){
75
+ this.$emit('input', this.$event)
76
+ }
77
+ }
78
+ }
79
+ </script>
80
+
@@ -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 hover:opacity-70 transition-default">
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:{
@@ -56,3 +62,6 @@ export default {
56
62
  }
57
63
  }
58
64
  </script>
65
+
66
+ <style> /* Please, use the file src/assets/scss/components/PsDialog.scss */</style>
67
+
@@ -1,53 +1,38 @@
1
1
  <template>
2
- <div :class="cssClass">
3
- <span class="material-icons psui-mr-4">{{ icon }}</span>
4
- <div class="psui-w-full">{{ message }}</div>
5
- <div class="psui-flex psui-space-x-4">
2
+ <div class='psui-el-toast' :class="getComponentClass">
3
+ <i class="material-icons-round psui-el-toast-icon">{{ icon }}</i>
4
+ <p class="psui-el-toast-message">{{ message }}</p>
5
+ <div class="psui-el-toast-actions">
6
6
  <slot></slot>
7
7
  </div>
8
8
  </div>
9
9
  </template>
10
10
 
11
11
  <script>
12
- export const typeOptions = ['info', 'success', 'warning', 'error']
13
- export const fillOptions = ['soft', 'intense']
14
12
  export default {
15
13
  name: 'PsToast',
16
14
  props: {
17
- type: {
15
+ layout: {
18
16
  type: String,
19
17
  default: 'info',
20
- validator: (value) => typeOptions.indexOf(value) !== -1
18
+ validator: (value) => ['info', 'success', 'warning', 'error'].includes(value)
21
19
  },
22
20
  fill: {
23
21
  type: String,
24
22
  default: 'intense',
25
- validator: (value) => fillOptions.indexOf(value) !== -1
23
+ validator: (value) => ['soft', 'intense'].includes(value)
26
24
  },
27
25
  message: {
28
26
  type: String,
29
- required: true
27
+ },
28
+ icon:{
29
+ type: String,
30
30
  }
31
31
  },
32
32
  computed: {
33
- icon() {
34
- if (this.type === 'info') return 'info'
35
- if (this.type === 'success') return 'check_circle'
36
- return 'warning'
37
- },
38
- cssClass() {
39
- const colors = {
40
- info: 'blue-60',
41
- success: 'green-20',
42
- warning: 'yellow-20',
43
- error: 'red-20'
44
- }
45
-
46
- const textColor = this.fill === 'intense' ? 'white': colors[this.type]
47
- const background = this.fill === 'soft'? `${colors[this.type].split('-', 1)}-10` : colors[this.type]
48
-
49
- return `psui-font-bold psui-shadow-md psui-rounded-md psui-p-3 psui-h-12 psui-flex psui-bg-${background} psui-text-${textColor}`
33
+ getComponentClass(){
34
+ return `layout-${this.layout} fill-${this.fill}`
50
35
  }
51
- }
36
+ },
52
37
  }
53
38
  </script>