@policystudio/policy-studio-ui-vue 1.1.88 → 1.1.90-access.0

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 (170) hide show
  1. package/.eslintignore +1 -0
  2. package/.eslintrc.js +75 -67
  3. package/.github/workflows/deploy-storybook.yml +5 -5
  4. package/.nvmrc +1 -0
  5. package/dist/css/psui_styles_output.css +6617 -0
  6. package/dist/index.d.ts +51 -0
  7. package/dist/index.js +106 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/util/GeneralFunctions.d.ts +3 -0
  10. package/dist/util/GeneralFunctions.js +35 -0
  11. package/dist/util/GeneralFunctions.js.map +1 -0
  12. package/dist/util/directives.d.ts +1 -0
  13. package/dist/util/directives.js +22 -0
  14. package/dist/util/directives.js.map +1 -0
  15. package/dist/util/imageLoader.d.ts +6 -0
  16. package/dist/util/imageLoader.js +52 -0
  17. package/dist/util/imageLoader.js.map +1 -0
  18. package/doc/.nvmrc +1 -0
  19. package/doc/.storybook/PolicyStudio.ts +11 -0
  20. package/doc/.storybook/main.ts +27 -0
  21. package/doc/.storybook/manager.ts +7 -0
  22. package/{.storybook/preview.js → doc/.storybook/preview.ts} +2 -3
  23. package/doc/package-lock.json +22653 -0
  24. package/doc/package.json +71 -0
  25. package/doc/shims-vue.d.ts +6 -0
  26. package/{src/stories/Accordion.stories.js → doc/src/stories/Accordion.stories.ts} +4 -5
  27. package/{src/stories/BadgeWithIcon.stories.js → doc/src/stories/BadgeWithIcon.stories.ts} +2 -2
  28. package/{src/stories/BarChart.stories.js → doc/src/stories/BarChart.stories.ts} +2 -2
  29. package/{src/stories/Breadcrumb.stories.js → doc/src/stories/Breadcrumb.stories.ts} +2 -5
  30. package/{src/stories/Button.stories.js → doc/src/stories/Button.stories.ts} +130 -130
  31. package/{src/stories/CardInfos.stories.js → doc/src/stories/CardInfos.stories.ts} +2 -3
  32. package/{src/stories/ChartLegend.stories.js → doc/src/stories/ChartLegend.stories.ts} +2 -3
  33. package/{src/stories/Checkbox.stories.js → doc/src/stories/Checkbox.stories.ts} +2 -2
  34. package/{src/stories/CheckboxSimple.stories.js → doc/src/stories/CheckboxSimple.stories.ts} +2 -2
  35. package/{src/stories/Chips.stories.js → doc/src/stories/Chips.stories.ts} +22 -23
  36. package/{src/stories/ClimateZoneBadge.stories.js → doc/src/stories/ClimateZoneBadge.stories.ts} +3 -2
  37. package/doc/src/stories/Collapse.stories.ts +46 -0
  38. package/{src/stories/CostEffectBar.stories.js → doc/src/stories/CostEffectBar.stories.ts} +3 -2
  39. package/{src/stories/Datatable.stories.js → doc/src/stories/Datatable.stories.ts} +7 -4
  40. package/{src/stories/DateCardInfo.stories.js → doc/src/stories/DateCardInfo.stories.ts} +2 -6
  41. package/{src/stories/Dialog.stories.js → doc/src/stories/Dialog.stories.ts} +2 -2
  42. package/{src/stories/Draggable.stories.js → doc/src/stories/Draggable.stories.ts} +3 -2
  43. package/{src/stories/Dropdown.stories.js → doc/src/stories/Dropdown.stories.ts} +4 -3
  44. package/{src/stories/DropdownList.stories.js → doc/src/stories/DropdownList.stories.ts} +4 -2
  45. package/{src/stories/ElevationSystem.stories.mdx → doc/src/stories/ElevationSystem.mdx} +1 -1
  46. package/{src/stories/HighlightRippleDot.stories.js → doc/src/stories/HighlightRippleDot.stories.ts} +3 -2
  47. package/{src/stories/Icon.stories.js → doc/src/stories/Icon.stories.ts} +3 -1
  48. package/{src/stories/InlineSelector.stories.js → doc/src/stories/InlineSelector.stories.ts} +2 -2
  49. package/{src/stories/Input.stories.js → doc/src/stories/Input.stories.ts} +7 -4
  50. package/{src/stories/InputSelect.stories.js → doc/src/stories/InputSelect.stories.ts} +3 -2
  51. package/{src/stories/InputTextArea.stories.js → doc/src/stories/InputTextArea.stories.ts} +2 -2
  52. package/{src/stories/Introduction.stories.mdx → doc/src/stories/Introduction.mdx} +101 -101
  53. package/{src/stories/MiniTag.stories.js → doc/src/stories/MiniTag.stories.ts} +9 -2
  54. package/{src/stories/ProgressBar.stories.js → doc/src/stories/ProgressBar.stories.ts} +3 -2
  55. package/{src/stories/RadioButton.stories.js → doc/src/stories/RadioButton.stories.ts} +2 -2
  56. package/{src/stories/RadioButtonSimple.stories.js → doc/src/stories/RadioButtonSimple.stories.ts} +2 -2
  57. package/{src/stories/SimpleAlert.stories.js → doc/src/stories/SimpleAlert.stories.ts} +3 -2
  58. package/{src/stories/Slider.stories.js → doc/src/stories/Slider.stories.ts} +6 -2
  59. package/{src/stories/Switch.stories.js → doc/src/stories/Switch.stories.ts} +2 -2
  60. package/{src/stories/TabHeader.stories.js → doc/src/stories/TabHeader.stories.ts} +6 -1
  61. package/{src/stories/TableResults.stories.js → doc/src/stories/TableResults.stories.ts} +11 -7
  62. package/{src/stories/TagScope.stories.js → doc/src/stories/TagScope.stories.ts} +3 -2
  63. package/{src/stories/TestimonialCard.stories.js → doc/src/stories/TestimonialCard.stories.ts} +3 -3
  64. package/{src/stories/Toast.stories.js → doc/src/stories/Toast.stories.ts} +2 -2
  65. package/{src/stories/Toggle.stories.js → doc/src/stories/Toggle.stories.ts} +7 -4
  66. package/{src/stories/Tooltip.stories.js → doc/src/stories/Tooltip.stories.ts} +6 -6
  67. package/{src/stories/Typography.stories.mdx → doc/src/stories/Typography.mdx} +107 -105
  68. package/doc/tsconfig.json +17 -0
  69. package/package.json +43 -39
  70. package/scripts/gulp.js +11 -0
  71. package/scripts/kill-port.sh +12 -0
  72. package/src/App.vue +30 -0
  73. package/src/assets/scss/base.scss +3 -30
  74. package/src/assets/scss/components/PsAccordion.scss +2 -2
  75. package/src/assets/scss/components/PsButton.scss +7 -1
  76. package/src/assets/scss/components/PsChips.scss +12 -7
  77. package/src/assets/scss/components/PsCollapse.scss +71 -0
  78. package/src/assets/scss/components/PsCostEffectBar.scss +4 -4
  79. package/src/assets/scss/components/PsDataTable.scss +1 -1
  80. package/src/assets/scss/components/PsDateCardInfo.scss +4 -5
  81. package/src/assets/scss/components/PsDialog.scss +7 -0
  82. package/src/assets/scss/components/PsDropdownList.scss +1 -1
  83. package/src/assets/scss/components/PsInput.scss +9 -0
  84. package/src/assets/scss/components/PsProgressBar.scss +4 -4
  85. package/src/assets/scss/components/PsTabHeader.scss +57 -2
  86. package/src/assets/scss/components/PsTableResults.scss +53 -22
  87. package/src/assets/scss/components/PsTestimonialCard.scss +1 -1
  88. package/src/assets/scss/components/PsTooltip.scss +149 -145
  89. package/src/components/accordion/PsAccordion.vue +20 -21
  90. package/src/components/accordion/PsAccordionItem.vue +121 -81
  91. package/src/components/badges-and-tags/PsBadgeWithIcon.vue +37 -36
  92. package/src/components/badges-and-tags/PsCardInfos.vue +40 -40
  93. package/src/components/badges-and-tags/PsChartLegend.vue +50 -41
  94. package/src/components/badges-and-tags/PsClimateZoneBadge.vue +13 -19
  95. package/src/components/badges-and-tags/PsCostEffectBar.vue +28 -61
  96. package/src/components/badges-and-tags/PsDateCardInfo.vue +17 -18
  97. package/src/components/badges-and-tags/PsHighlightRippleDot.vue +4 -3
  98. package/src/components/badges-and-tags/PsMiniTag.vue +39 -41
  99. package/src/components/badges-and-tags/PsProgressBar.vue +72 -68
  100. package/src/components/badges-and-tags/PsTagScope.vue +17 -22
  101. package/src/components/badges-and-tags/PsTestimonialCard.vue +25 -30
  102. package/src/components/buttons/PsButton.vue +90 -98
  103. package/src/components/chips/PsChips.vue +118 -103
  104. package/src/components/collapse/PsCollapse.vue +124 -0
  105. package/src/components/controls/PsCheckbox.vue +86 -83
  106. package/src/components/controls/PsCheckboxSimple.vue +97 -97
  107. package/src/components/controls/PsDraggable.vue +100 -99
  108. package/src/components/controls/PsInlineSelector.vue +111 -113
  109. package/src/components/controls/PsRadioButton.vue +72 -60
  110. package/src/components/controls/PsRadioButtonSimple.vue +81 -77
  111. package/src/components/controls/PsSlider.vue +190 -181
  112. package/src/components/controls/PsSwitch.vue +63 -54
  113. package/src/components/controls/PsToggle.vue +62 -57
  114. package/src/components/data-graphics/PsBarChart.vue +22 -23
  115. package/src/components/datatable/PsDataTable.vue +70 -65
  116. package/src/components/datatable/PsDataTableItem.vue +30 -32
  117. package/src/components/forms/PsDropdown.vue +173 -166
  118. package/src/components/forms/PsDropdownList.vue +133 -130
  119. package/src/components/forms/PsInput.vue +163 -146
  120. package/src/components/forms/PsInputSelect.vue +121 -100
  121. package/src/components/forms/PsInputTextArea.vue +84 -74
  122. package/src/components/navigations/PsBreadcrumb.vue +25 -34
  123. package/src/components/notifications/PsDialog.vue +67 -60
  124. package/src/components/notifications/PsSimpleAlert.vue +47 -37
  125. package/src/components/notifications/PsToast.vue +48 -42
  126. package/src/components/table-results/PsTableResults.vue +534 -506
  127. package/src/components/table-results/PsTableResultsBody.vue +69 -68
  128. package/src/components/table-results/PsTableResultsHead.vue +108 -69
  129. package/src/components/table-results/PsTableResultsHeadComparison.vue +88 -69
  130. package/src/components/table-results/PsTableResultsHeadFlexible.vue +112 -72
  131. package/src/components/table-results/PsTableResultsRow.vue +61 -58
  132. package/src/components/tabs/PsTabHeader.vue +138 -116
  133. package/src/components/tooltip/PsDialogTooltip.vue +112 -107
  134. package/src/components/tooltip/PsRichTooltip.vue +46 -43
  135. package/src/components/tooltip/PsTooltip.vue +126 -122
  136. package/src/components/ui/PsDotLoader.vue +6 -10
  137. package/src/components/ui/PsIcon.vue +149 -134
  138. package/src/index.ts +159 -0
  139. package/src/tsconfig.json +12 -0
  140. package/src/types/index.d.ts +6 -0
  141. package/src/util/GeneralFunctions.js +16 -7
  142. package/src/util/directives.ts +24 -0
  143. package/src/util/imageLoader.js +14 -7
  144. package/tailwind.config.js +12 -3
  145. package/tsconfig.json +47 -0
  146. package/.storybook/PolicyStudio.js +0 -10
  147. package/.storybook/eventBus.js +0 -3
  148. package/.storybook/main.js +0 -25
  149. package/.storybook/manager.js +0 -6
  150. package/babel.config.js +0 -3
  151. package/backup-package-lock.json +0 -37194
  152. package/dist/css/psui_styles.css +0 -110890
  153. package/postcss.config.js +0 -8
  154. package/src/components/playground/PsScrollBar.vue +0 -248
  155. package/src/index.js +0 -167
  156. package/src/stories/Playground.stories.js +0 -16
  157. /package/{src → doc/src}/assets/images/multifamily-units.svg +0 -0
  158. /package/{src → doc/src}/assets/images/policy-studio.svg +0 -0
  159. /package/{src/contents/ComparisonData.js → doc/src/contents/ComparisonData.ts} +0 -0
  160. /package/{src/contents/FlexibleData.js → doc/src/contents/FlexibleData.ts} +0 -0
  161. /package/{src/contents/ResultsData.js → doc/src/contents/ResultsData.ts} +0 -0
  162. /package/{src/stories/Colors.stories.mdx → doc/src/stories/Colors.mdx} +0 -0
  163. /package/{src → doc/src}/stories/assets/code-brackets.svg +0 -0
  164. /package/{src → doc/src}/stories/assets/colors.svg +0 -0
  165. /package/{src → doc/src}/stories/assets/comments.svg +0 -0
  166. /package/{src → doc/src}/stories/assets/direction.svg +0 -0
  167. /package/{src → doc/src}/stories/assets/flow.svg +0 -0
  168. /package/{src → doc/src}/stories/assets/plugin.svg +0 -0
  169. /package/{src → doc/src}/stories/assets/repo.svg +0 -0
  170. /package/{src → doc/src}/stories/assets/stackalt.svg +0 -0
@@ -1,150 +1,154 @@
1
1
  @layer components {
2
- .psui-el-tooltip {
3
-
4
- .psui-el-tooltip-wrapper{
5
- @apply psui-relative;
6
-
7
- .psui-el-tooltip-dialog {
8
- @apply psui-fixed psui-opacity-0 psui-transition-opacity psui-duration-300 psui-ease-in-out psui-z-10 psui-hidden;
9
- transition-delay: 0.4s;
10
-
11
- .psui-el-tooltip-content {
12
- @apply psui-flex psui-flex-col psui-bg-gray-50 psui-text-white;
13
- padding: 5px 8px 4px 8px;
14
- border-radius: 4px;
15
-
16
- h2 {
17
- @apply psui-font-bold;
18
- }
19
-
20
- .psui-el-tooltip-content-wrapper{
21
- @apply psui-text-xsmall psui-font-bold;
22
- }
23
-
24
- &.layout {
25
- &-gray {
26
- @apply psui-bg-gray-30 psui-text-gray-80 psui-shadow-none;
27
- font-size: 12px;
28
- line-height: 120%;
29
- padding: 10px 16px 12px 16px;
30
-
31
- .psui-el-tooltip-content-wrapper {
32
- @apply psui-font-normal psui-mt-1
33
- }
34
- }
35
-
36
- &-blue {
37
- @apply psui-bg-blue-70 psui-text-white psui-shadow-none;
38
- font-size: 12px;
39
- line-height: 120%;
40
- padding: 10px 16px 12px 16px;
41
-
42
- .psui-el-tooltip-content-wrapper {
43
- @apply psui-font-normal psui-mt-1
44
- }
45
- }
46
-
47
- &-red {
48
- @apply psui-bg-red-10 psui-text-red-70 psui-shadow-none;
49
- font-size: 12px;
50
- line-height: 120%;
51
- padding: 10px 16px 12px 16px;
52
-
53
- .psui-el-tooltip-content-wrapper {
54
- @apply psui-font-normal psui-mt-1
55
- }
56
- }
57
-
58
- &-white {
59
- @apply psui-bg-white psui-py-4 psui-px-6 psui-flex psui-flex-col psui-shadow-elevation-30;
60
- gap: 8.8px;
61
-
62
- h2 {
63
- @apply psui-text-gray-80 psui-font-bold;
64
- font-size: 17px;
65
- line-height: 120%;
66
- }
67
-
68
- .psui-el-tooltip-content-wrapper {
69
- @apply psui-text-gray-50 psui-font-normal psui-flex psui-flex-col;
70
- gap: 13.6px;
71
- font-size: 14px;
72
- line-height: 120%;
73
-
74
- button {
75
- @apply psui-rounded-md psui-bg-blue-20 psui-text-blue-60 psui-font-bold;
76
- padding: 7px 16px;
77
- width: fit-content;
78
-
79
- &:focus {
80
- outline: none;
81
- }
82
- }
83
- }
84
- }
85
-
86
- &-dark {
87
- @apply psui-bg-blue-70 psui-py-4 psui-px-6 psui-flex psui-flex-col psui-shadow-elevation-30;
88
- gap: 8.8px;
89
-
90
- h2 {
91
- @apply psui-text-white psui-font-bold;
92
- font-size: 17px;
93
- line-height: 120%;
94
- }
95
-
96
- .psui-el-tooltip-content-wrapper {
97
- @apply psui-text-white psui-font-normal psui-flex psui-flex-col;
98
- gap: 13.6px;
99
- font-size: 14px;
100
- line-height: 120%;
101
-
102
- button {
103
- @apply psui-rounded-md psui-bg-blue-60 psui-text-white psui-font-bold;
104
- padding: 7px 16px;
105
- width: fit-content;
106
-
107
- &:focus {
108
- outline: none;
109
- }
110
-
111
- }
112
- }
113
- }
114
-
115
- &-color {
116
- @apply psui-bg-blue-50 psui-py-4 psui-px-6 psui-flex psui-flex-col psui-shadow-elevation-30;
117
- gap: 8.8px;
118
-
119
-
120
- h2 {
121
- @apply psui-text-white psui-font-bold;
122
- font-size: 17px;
123
- line-height: 120%;
124
- }
125
-
126
- .psui-el-tooltip-content-wrapper {
127
- @apply psui-text-white psui-font-normal psui-flex psui-flex-col;
128
- gap: 13.6px;
129
- font-size: 14px;
130
- line-height: 120%;
131
-
132
- button {
133
- @apply psui-rounded-md psui-bg-blue-60 psui-text-white psui-font-bold;
134
- padding: 7px 16px;
135
- width: fit-content;
136
-
137
- &:focus {
138
- outline: none;
139
- }
140
-
141
- }
142
- }
143
- }
144
-
145
- }
2
+ .psui-el-tooltip {
3
+ .psui-el-tooltip-wrapper {
4
+ @apply psui-relative;
5
+
6
+ .psui-el-tooltip-dialog {
7
+ @apply psui-fixed psui-opacity-0 psui-transition-opacity psui-duration-300 psui-ease-in-out psui-hidden;
8
+ transition-delay: 0.4s;
9
+ z-index: 999;
10
+
11
+ .psui-el-tooltip-content {
12
+ @apply psui-flex psui-flex-col psui-bg-gray-50 psui-text-white;
13
+ padding: 10px 16px 12px 16px;
14
+ border-radius: 4px;
15
+ font-family: Lato, sans-serif;
16
+ font-style: normal;
17
+
18
+ h2 {
19
+ font-size: 12px;
20
+ line-height: 120%;
21
+ font-weight: 700;
22
+ }
23
+
24
+ .psui-el-tooltip-content-wrapper {
25
+ font-size: 12px;
26
+ line-height: 120%;
27
+ font-weight: 400;
28
+
29
+ h2,
30
+ p {
31
+ font-size: 12px;
32
+ line-height: 120%;
33
+ }
34
+
35
+ h2 {
36
+ font-weight: 700;
37
+ }
38
+
39
+ p {
40
+ font-weight: 400;
41
+ }
42
+ }
43
+
44
+ &.layout-gray,
45
+ &.layout-blue,
46
+ &.layout-red,
47
+ &.layout-green {
48
+ @apply psui-shadow-none;
49
+ font-size: 12px;
50
+ line-height: 120%;
51
+ padding: 10px 16px 12px 16px;
52
+ }
53
+
54
+ &.layout-gray {
55
+ @apply psui-bg-gray-30 psui-text-gray-80;
56
+ }
57
+
58
+ &.layout-blue {
59
+ @apply psui-bg-blue-70 psui-text-white;
60
+ }
61
+
62
+ &.layout-red {
63
+ @apply psui-bg-red-10 psui-text-red-70;
64
+ }
65
+
66
+ &.layout-green {
67
+ @apply psui-items-center;
68
+ gap: 4px;
69
+ border-radius: 6px;
70
+ background: linear-gradient(270deg, #5db883 0%, #28b08e 100%);
71
+
72
+ h2,
73
+ .psui-el-tooltip-content-wrapper {
74
+ @apply psui-text-white;
75
+ }
76
+ }
77
+
78
+ &.layout-white,
79
+ &.layout-dark,
80
+ &.layout-color {
81
+ @apply psui-py-4 psui-px-6 psui-flex psui-flex-col psui-shadow-elevation-30;
82
+ gap: 8.8px;
83
+
84
+ h2 {
85
+ font-size: 17px;
86
+ line-height: 120%;
87
+ font-weight: 700;
88
+ }
89
+
90
+ .psui-el-tooltip-content-wrapper {
91
+ @apply psui-flex psui-flex-col;
92
+ gap: 13.6px;
93
+ font-size: 14px;
94
+ line-height: 120%;
95
+ font-weight: 400;
96
+
97
+ button {
98
+ @apply psui-rounded-md psui-font-bold;
99
+ padding: 7px 16px;
100
+ width: fit-content;
101
+
102
+ &:focus {
103
+ outline: none;
146
104
  }
105
+ }
106
+ }
107
+ }
108
+
109
+ &.layout-white {
110
+ @apply psui-bg-white;
111
+
112
+ h2 {
113
+ @apply psui-text-gray-80;
114
+ }
115
+
116
+ .psui-el-tooltip-content-wrapper {
117
+ @apply psui-text-gray-50;
118
+
119
+ button {
120
+ @apply psui-bg-blue-20 psui-text-blue-60;
121
+ }
122
+ }
123
+ }
124
+
125
+ &.layout-dark {
126
+ @apply psui-bg-blue-70;
127
+
128
+ h2,
129
+ .psui-el-tooltip-content-wrapper {
130
+ @apply psui-text-white;
131
+ }
132
+
133
+ .psui-el-tooltip-content-wrapper button {
134
+ @apply psui-bg-blue-60 psui-text-white;
135
+ }
136
+ }
137
+
138
+ &.layout-color {
139
+ @apply psui-bg-blue-50;
140
+
141
+ h2,
142
+ .psui-el-tooltip-content-wrapper {
143
+ @apply psui-text-white;
144
+ }
145
+
146
+ .psui-el-tooltip-content-wrapper button {
147
+ @apply psui-bg-blue-60 psui-text-white;
147
148
  }
149
+ }
148
150
  }
151
+ }
149
152
  }
150
- }
153
+ }
154
+ }
@@ -1,28 +1,27 @@
1
1
  <template>
2
- <div class="psui-el-accordion" :class="getComponentClass">
3
- <slot></slot>
2
+ <div
3
+ class="psui-el-accordion"
4
+ :class="getComponentClass"
5
+ >
6
+ <slot />
4
7
  </div>
5
8
  </template>
6
9
 
7
- <script>
8
- export const layouts = ['big', 'medium']
9
- export default {
10
- name: 'PsAccordion',
11
- props: {
12
- /**
13
- * It defines the size of the accordion items. eg: text size and font.
14
- */
15
- layout: {
16
- type: String,
17
- default: 'medium',
18
- validator: (value) => ['medium','big'].includes(value),
19
- },
10
+ <script setup>
11
+ import { computed } from 'vue'
12
+
13
+ const props = defineProps({
14
+ layout:{
15
+ type: String,
16
+ default: 'medium',
17
+ validator: (value) => ['big', 'medium'].includes(value)
20
18
  },
21
- computed: {
22
- getComponentClass() {
23
- return `layout-${this.layout}`
24
- }
25
- }
26
- }
19
+ })
20
+
21
+ const getComponentClass = computed(() => {
22
+ return `layout-${props.layout}`
23
+ })
24
+
27
25
  </script>
26
+
28
27
  <style> /* Please, use the file src/assets/scss/components/PsAccordion.scss */</style>
@@ -1,11 +1,30 @@
1
1
  <template>
2
- <div class="psui-el-accordion-item" :class="{'status-opened':isOpen, 'disabled':disabled}">
2
+ <div
3
+ class="psui-el-accordion-item"
4
+ :class="{ 'status-opened': isOpen, disabled: disabled }"
5
+ >
3
6
  <div class="psui-el-accordion-item-header">
4
- <slot name='custom-header' :toggle="toggle" :isOpen="isOpen">
5
- <div @click="toggle" class="psui-el-accordion-item-header-wrapper" v-if="!hasCustomHeader">
6
- <h2 v-if="title" class="psui-el-accordion-item-title">{{ title }}</h2>
7
- <slot name='header-additionals'></slot>
8
- <i v-if="!disabled" class="psui-el-accordion-item-icon">{{ getIcon }}</i>
7
+ <slot
8
+ name="custom-header"
9
+ :toggle="toggle"
10
+ :is-open="isOpen"
11
+ >
12
+ <div
13
+ @click="toggle"
14
+ class="psui-el-accordion-item-header-wrapper"
15
+ v-if="!hasCustomHeader"
16
+ >
17
+ <h2
18
+ v-if="title"
19
+ class="psui-el-accordion-item-title"
20
+ >
21
+ {{ title }}
22
+ </h2>
23
+ <slot name="header-additionals" />
24
+ <i
25
+ v-if="!disabled"
26
+ class="psui-el-accordion-item-icon"
27
+ >{{ getIcon }}</i>
9
28
  </div>
10
29
  </slot>
11
30
  </div>
@@ -16,91 +35,112 @@
16
35
  @before-leave="start"
17
36
  @after-leave="end"
18
37
  >
19
- <div v-if="isOpen" class="psui-el-accordion-item-content">
20
- <slot></slot>
38
+ <div
39
+ v-if="isOpen"
40
+ class="psui-el-accordion-item-content"
41
+ >
42
+ <slot />
21
43
  </div>
22
44
  </transition>
23
45
  </div>
24
46
  </template>
25
47
 
26
- <script>
27
- import { getParentVueComponentByName } from '../../util/GeneralFunctions'
28
-
29
- export default {
30
- name: 'PsAccordionItem',
31
- props: {
32
- /**
33
- * It sets the title of the accordion item.
34
- */
35
- title: {
36
- type: String,
37
- },
38
- /**
39
- * It sets the status of the accordion item when mounted.
40
- */
41
- opened: {
42
- type: [Boolean],
43
- default: false
44
- },
45
- /**
46
- * 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/.
47
- */
48
- icon: {
49
- type: String
50
- },
51
- /**
52
- * It sets if it has a custom header.
53
- */
54
- hasCustomHeader: {
55
- type: Boolean,
56
- default: false
57
- },
58
- /**
59
- * It sets the disabled status.
60
- */
61
- disabled: {
62
- type: Boolean,
63
- default: false
64
- }
48
+ <script setup>
49
+ import { getParentVueComponentByName } from '../../util/GeneralFunctions.js'
50
+ import { ref, computed, getCurrentInstance } from 'vue'
51
+
52
+ defineExpose({
53
+ toggle: () => toggle()
54
+ })
55
+
56
+ const localOpened = ref(null)
57
+
58
+ const props = defineProps({
59
+ /**
60
+ * It sets the title of the accordion item.
61
+ */
62
+ title: {
63
+ type: String,
64
+ default: '',
65
+ },
66
+ /**
67
+ * It sets the status of the accordion item when mounted.
68
+ */
69
+ opened: {
70
+ type: [Boolean],
71
+ default: false,
72
+ },
73
+ /**
74
+ * 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/.
75
+ */
76
+ icon: {
77
+ type: String,
78
+ default: '',
65
79
  },
66
- data() {
67
- return {
68
- localOpened: null,
69
- }
80
+ /**
81
+ * It sets if it has a custom header.
82
+ */
83
+ hasCustomHeader: {
84
+ type: Boolean,
85
+ default: false,
70
86
  },
71
- computed: {
72
- isOpen() {
73
- return this.localOpened !== null ? this.localOpened : this.opened
74
- },
75
- getParent() {
76
- return getParentVueComponentByName(this,'PsAccordion')
77
- },
78
- getIcon(){
79
- if(this.getParent._props.layout === 'medium') return 'expand_more'
80
- if(this.getParent._props.layout === 'big' && this.isOpen === false) return 'add'
81
- if(this.getParent._props.layout === 'big' && this.isOpen === true) return 'remove'
82
- return `${this.icon}`
83
- }
87
+ /**
88
+ * It sets the disabled status.
89
+ */
90
+ disabled: {
91
+ type: Boolean,
92
+ default: false,
84
93
  },
85
- methods: {
86
- toggle() {
87
- if (this.localOpened === null) {
88
- this.localOpened = !this.opened
89
- } else {
90
- this.localOpened = !this.localOpened
91
- }
92
- },
93
- start(el) {
94
- el.style.height = el.scrollHeight + 'px'
95
- el.style.padding = el.srcollPaddingBottom + 'px'
96
- },
97
- end(el) {
98
- el.style.height = ''
99
- el.style.padding = ''
100
- }
94
+ })
95
+
96
+ const isOpen = computed(() => {
97
+ return localOpened.value !== null ? localOpened.value : props.opened
98
+ })
99
+
100
+ const getParent = computed(() => {
101
+ const instance = getCurrentInstance()
102
+
103
+ if (instance?.parent) {
104
+ return getParentVueComponentByName(instance.parent, 'PsAccordion')
105
+ }
106
+
107
+ if (instance.proxy && instance.proxy.$parent) {
108
+ return getParentVueComponentByName(instance.proxy.$parent, 'PsAccordion')
109
+ }
110
+
111
+ return null
112
+ })
113
+
114
+ const getIcon = computed(() => {
115
+ if (!getParent.value) return
116
+
117
+ const layout = getParent.value._props ? getParent.value._props.layout : getParent?.value?.props.layout.default
118
+ if (layout === 'medium') return 'expand_more'
119
+ if (layout === 'big' && isOpen.value === false) return 'add'
120
+ if (layout === 'big' && isOpen.value === true) return 'remove'
121
+ return `${props.icon}`
122
+ })
123
+
124
+ const toggle = () => {
125
+ if (localOpened.value === null) {
126
+ localOpened.value = !props.opened
127
+ } else {
128
+ localOpened.value = !localOpened.value
101
129
  }
102
130
  }
131
+ const start = (el) => {
132
+ el.style.height = el.scrollHeight + 'px'
133
+ el.style.padding = el.srcollPaddingBottom + 'px'
134
+ }
135
+ const end = (el) => {
136
+ el.style.height = ''
137
+ el.style.padding = ''
138
+ }
103
139
  </script>
104
140
 
105
- <style> /* Please, use the file src/assets/scss/components/PsAccordion.scss */</style>
141
+ <style>
142
+ /* Please, use the file src/assets/scss/components/PsAccordion.scss */
143
+ </style>
144
+
145
+
106
146
 
@@ -1,43 +1,44 @@
1
1
  <template>
2
- <div class="psui-el-badge-with-icon" :class="getComponentClass">
3
- <i
4
- v-if="icon"
2
+ <div
3
+ class="psui-el-badge-with-icon"
4
+ :class="getComponentClass"
5
+ >
6
+ <i
7
+ v-if="icon"
5
8
  :class="iconClass"
6
9
  class="psui-el-badge-with-icon-icon"
7
- >{{icon}}</i>
8
- <span class="psui-el-badge-with-icon-message">{{message}}</span>
10
+ >{{ icon }}</i>
11
+ <span class="psui-el-badge-with-icon-message">{{ message }}</span>
9
12
  </div>
10
13
  </template>
11
14
 
12
- <script>
13
- export default {
14
- name: 'PsBadgeWithIcon',
15
- props: {
16
- icon: {
17
- type: String,
18
- default:'info'
19
- },
20
- /**
21
- * It set any further css style that might be needed.
22
- */
23
- iconClass: {
24
- type: String
25
- },
26
- message: {
27
- type: String,
28
- default: 'Lorem ipsum'
29
- },
30
- layout: {
31
- type: String,
32
- default: 'grey',
33
- validator: (value) => ['grey', 'blue', 'green','yellow'].includes(value)
34
- }
35
- },
36
- computed:{
37
- getComponentClass(){
38
- return `layout-${this.layout}`
39
- }
40
- }
41
- }
42
- </script>
15
+ <script setup>
16
+ import { computed } from 'vue'
17
+
18
+ const props = defineProps({
19
+ icon: {
20
+ type: String,
21
+ default: 'info',
22
+ },
23
+ /**
24
+ * It set any further css style that might be needed.
25
+ */
26
+ iconClass: {
27
+ type: String,
28
+ default: '',
29
+ },
30
+ message: {
31
+ type: String,
32
+ default: 'Lorem ipsum',
33
+ },
34
+ layout: {
35
+ type: String,
36
+ default: 'grey',
37
+ validator: (value) => ['grey', 'blue', 'green', 'yellow'].includes(value),
38
+ },
39
+ })
43
40
 
41
+ const getComponentClass = computed(() => {
42
+ return `layout-${props.layout}`
43
+ })
44
+ </script>