@policystudio/policy-studio-ui-vue 1.1.90-beta.12 → 1.1.90-beta.18

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 (231) hide show
  1. package/.eslintrc.js +2 -1
  2. package/.github/workflows/deploy-storybook.yml +4 -4
  3. package/.nvmrc +1 -0
  4. package/dist/css/psui_styles_output.css +6986 -0
  5. package/dist/index.d.ts +50 -0
  6. package/dist/index.js +53 -63
  7. package/dist/index.js.map +1 -1
  8. package/dist/util/GeneralFunctions.d.ts +3 -0
  9. package/dist/util/GeneralFunctions.js.map +1 -1
  10. package/dist/util/directives.d.ts +1 -0
  11. package/dist/util/directives.js +22 -0
  12. package/dist/util/directives.js.map +1 -0
  13. package/dist/util/eventBus.d.ts +7 -0
  14. package/dist/util/eventBus.js +8 -0
  15. package/dist/util/eventBus.js.map +1 -0
  16. package/dist/util/imageLoader.d.ts +6 -0
  17. package/dist/util/imageLoader.js.map +1 -1
  18. package/package.json +9 -23
  19. package/src/assets/scss/components/PsDataTable.scss +1 -1
  20. package/src/components/accordion/PsAccordionItem.vue +75 -75
  21. package/src/components/badges-and-tags/PsBadgeWithIcon.vue +31 -34
  22. package/src/components/badges-and-tags/PsCardInfos.vue +40 -41
  23. package/src/components/badges-and-tags/PsChartLegend.vue +47 -51
  24. package/src/components/badges-and-tags/PsClimateZoneBadge.vue +14 -19
  25. package/src/components/badges-and-tags/PsCostEffectBar.vue +24 -56
  26. package/src/components/badges-and-tags/PsDateCardInfo.vue +17 -18
  27. package/src/components/badges-and-tags/PsHighlightRippleDot.vue +3 -2
  28. package/src/components/badges-and-tags/PsMiniTag.vue +39 -41
  29. package/src/components/badges-and-tags/PsProgressBar.vue +72 -68
  30. package/src/components/badges-and-tags/PsTagScope.vue +17 -22
  31. package/src/components/badges-and-tags/PsTestimonialCard.vue +20 -26
  32. package/src/components/buttons/PsButton.vue +61 -62
  33. package/src/components/chips/PsChips.vue +98 -101
  34. package/src/components/controls/PsCheckbox.vue +84 -84
  35. package/src/components/controls/PsCheckboxSimple.vue +95 -95
  36. package/src/components/controls/PsDraggable.vue +53 -55
  37. package/src/components/controls/PsInlineSelector.vue +99 -99
  38. package/src/components/controls/PsRadioButton.vue +59 -58
  39. package/src/components/controls/PsRadioButtonSimple.vue +79 -75
  40. package/src/components/controls/PsSlider.vue +185 -176
  41. package/src/components/controls/PsSwitch.vue +51 -52
  42. package/src/components/controls/PsToggle.vue +53 -50
  43. package/src/components/data-graphics/PsBarChart.vue +19 -21
  44. package/src/components/datatable/PsDataTable.vue +56 -60
  45. package/src/components/datatable/PsDataTableItem.vue +14 -28
  46. package/src/components/forms/PsDropdown.vue +164 -162
  47. package/src/components/forms/PsDropdownList.vue +132 -129
  48. package/src/components/forms/PsInput.vue +155 -153
  49. package/src/components/forms/PsInputSelect.vue +91 -92
  50. package/src/components/forms/PsInputTextArea.vue +71 -71
  51. package/src/components/navigations/PsBreadcrumb.vue +26 -34
  52. package/src/components/notifications/PsDialog.vue +57 -56
  53. package/src/components/notifications/PsSimpleAlert.vue +28 -29
  54. package/src/components/notifications/PsToast.vue +40 -39
  55. package/src/components/table-results/PsTableResults.vue +452 -458
  56. package/src/components/table-results/PsTableResultsBody.vue +66 -67
  57. package/src/components/table-results/PsTableResultsHead.vue +62 -56
  58. package/src/components/table-results/PsTableResultsHeadComparison.vue +62 -56
  59. package/src/components/table-results/PsTableResultsHeadFlexible.vue +63 -56
  60. package/src/components/table-results/PsTableResultsRow.vue +55 -56
  61. package/src/components/tabs/PsTabHeader.vue +106 -100
  62. package/src/components/tooltip/PsDialogTooltip.vue +96 -101
  63. package/src/components/tooltip/PsRichTooltip.vue +42 -45
  64. package/src/components/tooltip/PsTooltip.vue +111 -116
  65. package/src/components/ui/PsDotLoader.vue +1 -5
  66. package/src/components/ui/PsIcon.vue +126 -129
  67. package/src/index.ts +57 -71
  68. package/src/tsconfig.json +12 -0
  69. package/src/{shims-vue.d.ts → types/index.d.ts} +0 -5
  70. package/src/util/{GeneralFunctions.ts → GeneralFunctions.js} +0 -3
  71. package/src/util/directives.ts +24 -0
  72. package/src/util/eventBus.js +10 -0
  73. package/src/util/{imageLoader.ts → imageLoader.js} +7 -8
  74. package/tailwind.config.js +1 -1
  75. package/tsconfig.json +15 -17
  76. package/.storybook/PolicyStudio.ts +0 -11
  77. package/.storybook/eventBus.ts +0 -26
  78. package/.storybook/main.ts +0 -21
  79. package/.storybook/manager.ts +0 -7
  80. package/.storybook/preview.ts +0 -17
  81. package/dist/contents/ComparisonData.js +0 -376
  82. package/dist/contents/ComparisonData.js.map +0 -1
  83. package/dist/contents/FlexibleData.js +0 -501
  84. package/dist/contents/FlexibleData.js.map +0 -1
  85. package/dist/contents/ResultsData.js +0 -530
  86. package/dist/contents/ResultsData.js.map +0 -1
  87. package/dist/css/psui_styles.css +0 -4647
  88. package/dist/stories/Accordion.stories.js +0 -56
  89. package/dist/stories/Accordion.stories.js.map +0 -1
  90. package/dist/stories/BadgeWithIcon.stories.js +0 -28
  91. package/dist/stories/BadgeWithIcon.stories.js.map +0 -1
  92. package/dist/stories/BarChart.stories.js +0 -16
  93. package/dist/stories/BarChart.stories.js.map +0 -1
  94. package/dist/stories/Breadcrumb.stories.js +0 -21
  95. package/dist/stories/Breadcrumb.stories.js.map +0 -1
  96. package/dist/stories/Button.stories.js +0 -44
  97. package/dist/stories/Button.stories.js.map +0 -1
  98. package/dist/stories/CardInfos.stories.js +0 -13
  99. package/dist/stories/CardInfos.stories.js.map +0 -1
  100. package/dist/stories/ChartLegend.stories.js +0 -13
  101. package/dist/stories/ChartLegend.stories.js.map +0 -1
  102. package/dist/stories/Checkbox.stories.js +0 -44
  103. package/dist/stories/Checkbox.stories.js.map +0 -1
  104. package/dist/stories/CheckboxSimple.stories.js +0 -48
  105. package/dist/stories/CheckboxSimple.stories.js.map +0 -1
  106. package/dist/stories/Chips.stories.js +0 -27
  107. package/dist/stories/Chips.stories.js.map +0 -1
  108. package/dist/stories/ClimateZoneBadge.stories.js +0 -15
  109. package/dist/stories/ClimateZoneBadge.stories.js.map +0 -1
  110. package/dist/stories/CostEffectBar.stories.js +0 -21
  111. package/dist/stories/CostEffectBar.stories.js.map +0 -1
  112. package/dist/stories/Datatable.stories.js +0 -45
  113. package/dist/stories/Datatable.stories.js.map +0 -1
  114. package/dist/stories/DateCardInfo.stories.js +0 -18
  115. package/dist/stories/DateCardInfo.stories.js.map +0 -1
  116. package/dist/stories/Dialog.stories.js +0 -127
  117. package/dist/stories/Dialog.stories.js.map +0 -1
  118. package/dist/stories/Draggable.stories.js +0 -20
  119. package/dist/stories/Draggable.stories.js.map +0 -1
  120. package/dist/stories/Dropdown.stories.js +0 -98
  121. package/dist/stories/Dropdown.stories.js.map +0 -1
  122. package/dist/stories/DropdownList.stories.js +0 -208
  123. package/dist/stories/DropdownList.stories.js.map +0 -1
  124. package/dist/stories/Header.stories.js +0 -39
  125. package/dist/stories/Header.stories.js.map +0 -1
  126. package/dist/stories/HighlightRippleDot.stories.js +0 -13
  127. package/dist/stories/HighlightRippleDot.stories.js.map +0 -1
  128. package/dist/stories/Icon.stories.js +0 -19
  129. package/dist/stories/Icon.stories.js.map +0 -1
  130. package/dist/stories/InlineSelector.stories.js +0 -16
  131. package/dist/stories/InlineSelector.stories.js.map +0 -1
  132. package/dist/stories/Input.stories.js +0 -235
  133. package/dist/stories/Input.stories.js.map +0 -1
  134. package/dist/stories/InputSelect.stories.js +0 -28
  135. package/dist/stories/InputSelect.stories.js.map +0 -1
  136. package/dist/stories/InputTextArea.stories.js +0 -23
  137. package/dist/stories/InputTextArea.stories.js.map +0 -1
  138. package/dist/stories/MiniTag.stories.js +0 -44
  139. package/dist/stories/MiniTag.stories.js.map +0 -1
  140. package/dist/stories/Playground.stories.js +0 -14
  141. package/dist/stories/Playground.stories.js.map +0 -1
  142. package/dist/stories/ProgressBar.stories.js +0 -21
  143. package/dist/stories/ProgressBar.stories.js.map +0 -1
  144. package/dist/stories/RadioButton.stories.js +0 -36
  145. package/dist/stories/RadioButton.stories.js.map +0 -1
  146. package/dist/stories/RadioButtonSimple.stories.js +0 -40
  147. package/dist/stories/RadioButtonSimple.stories.js.map +0 -1
  148. package/dist/stories/SimpleAlert.stories.js +0 -19
  149. package/dist/stories/SimpleAlert.stories.js.map +0 -1
  150. package/dist/stories/Slider.stories.js +0 -70
  151. package/dist/stories/Slider.stories.js.map +0 -1
  152. package/dist/stories/Switch.stories.js +0 -35
  153. package/dist/stories/Switch.stories.js.map +0 -1
  154. package/dist/stories/TabHeader.stories.js +0 -48
  155. package/dist/stories/TabHeader.stories.js.map +0 -1
  156. package/dist/stories/TableResults.stories.js +0 -717
  157. package/dist/stories/TableResults.stories.js.map +0 -1
  158. package/dist/stories/TagScope.stories.js +0 -16
  159. package/dist/stories/TagScope.stories.js.map +0 -1
  160. package/dist/stories/TestimonialCard.stories.js +0 -24
  161. package/dist/stories/TestimonialCard.stories.js.map +0 -1
  162. package/dist/stories/Toast.stories.js +0 -51
  163. package/dist/stories/Toast.stories.js.map +0 -1
  164. package/dist/stories/Toggle.stories.js +0 -42
  165. package/dist/stories/Toggle.stories.js.map +0 -1
  166. package/dist/stories/Tooltip.stories.js +0 -108
  167. package/dist/stories/Tooltip.stories.js.map +0 -1
  168. package/postcss.config.js +0 -8
  169. package/src/assets/images/multifamily-units.svg +0 -10
  170. package/src/assets/images/policy-studio.svg +0 -15
  171. package/src/components/playground/PsScrollBar.vue +0 -320
  172. package/src/contents/ComparisonData.ts +0 -378
  173. package/src/contents/FlexibleData.ts +0 -502
  174. package/src/contents/ResultsData.ts +0 -531
  175. package/src/stories/Accordion.stories.ts +0 -59
  176. package/src/stories/BadgeWithIcon.stories.ts +0 -31
  177. package/src/stories/BarChart.stories.ts +0 -17
  178. package/src/stories/Breadcrumb.stories.ts +0 -22
  179. package/src/stories/Button.stories.ts +0 -48
  180. package/src/stories/Button.vue +0 -59
  181. package/src/stories/CardInfos.stories.ts +0 -15
  182. package/src/stories/ChartLegend.stories.ts +0 -15
  183. package/src/stories/Checkbox.stories.ts +0 -45
  184. package/src/stories/CheckboxSimple.stories.ts +0 -49
  185. package/src/stories/Chips.stories.ts +0 -33
  186. package/src/stories/ClimateZoneBadge.stories.ts +0 -18
  187. package/src/stories/Colors.mdx +0 -70
  188. package/src/stories/CostEffectBar.stories.ts +0 -24
  189. package/src/stories/Datatable.stories.ts +0 -53
  190. package/src/stories/DateCardInfo.stories.ts +0 -20
  191. package/src/stories/Dialog.stories.ts +0 -131
  192. package/src/stories/Draggable.stories.ts +0 -23
  193. package/src/stories/Dropdown.stories.ts +0 -100
  194. package/src/stories/DropdownList.stories.ts +0 -213
  195. package/src/stories/ElevationSystem.mdx +0 -41
  196. package/src/stories/Header.stories.ts +0 -42
  197. package/src/stories/Header.vue +0 -77
  198. package/src/stories/HighlightRippleDot.stories.ts +0 -16
  199. package/src/stories/Icon.stories.ts +0 -23
  200. package/src/stories/InlineSelector.stories.ts +0 -18
  201. package/src/stories/Input.stories.ts +0 -243
  202. package/src/stories/InputSelect.stories.ts +0 -31
  203. package/src/stories/InputTextArea.stories.ts +0 -25
  204. package/src/stories/Introduction.mdx +0 -211
  205. package/src/stories/MiniTag.stories.ts +0 -59
  206. package/src/stories/Playground.stories.ts +0 -16
  207. package/src/stories/ProgressBar.stories.ts +0 -24
  208. package/src/stories/RadioButton.stories.ts +0 -40
  209. package/src/stories/RadioButtonSimple.stories.ts +0 -43
  210. package/src/stories/SimpleAlert.stories.ts +0 -22
  211. package/src/stories/Slider.stories.ts +0 -79
  212. package/src/stories/Switch.stories.ts +0 -39
  213. package/src/stories/TabHeader.stories.ts +0 -57
  214. package/src/stories/TableResults.stories.ts +0 -728
  215. package/src/stories/TagScope.stories.ts +0 -17
  216. package/src/stories/TestimonialCard.stories.ts +0 -27
  217. package/src/stories/Toast.stories.ts +0 -52
  218. package/src/stories/Toggle.stories.ts +0 -48
  219. package/src/stories/Tooltip.stories.ts +0 -114
  220. package/src/stories/Typography.mdx +0 -212
  221. package/src/stories/assets/code-brackets.svg +0 -1
  222. package/src/stories/assets/colors.svg +0 -1
  223. package/src/stories/assets/comments.svg +0 -1
  224. package/src/stories/assets/direction.svg +0 -1
  225. package/src/stories/assets/flow.svg +0 -1
  226. package/src/stories/assets/plugin.svg +0 -1
  227. package/src/stories/assets/repo.svg +0 -1
  228. package/src/stories/assets/stackalt.svg +0 -1
  229. package/src/stories/button.css +0 -30
  230. package/src/stories/header.css +0 -32
  231. package/webpack.config.js +0 -36
@@ -1,13 +1,13 @@
1
- <template>
1
+ <template>
2
2
  <div
3
3
  class="psui-el-progress-bar"
4
- :style="{width: `${width}px`}"
5
- :class="{ 'is-breakeven' : getIsBreakEven }"
4
+ :style="{ width: `${width}px` }"
5
+ :class="{ 'is-breakeven': getIsBreakEven }"
6
6
  >
7
7
  <div class="psui-el-progress-bar-bg" />
8
8
  <div
9
- class="psui-el-progress-bar-value"
10
- :class="[getBg, {'rounded-tr-full rounded-br-full': getProgressWidth === '100%'}]"
9
+ class="psui-el-progress-bar-value"
10
+ :class="[getBg, { 'rounded-tr-full rounded-br-full': getProgressWidth === '100%' }]"
11
11
  :style="{ width: getProgressWidth }"
12
12
  />
13
13
  <div
@@ -17,69 +17,73 @@
17
17
  </div>
18
18
  </template>
19
19
 
20
- <script>
21
- export default {
22
- name: 'PsProgressBar',
23
- props: {
24
- width: {
25
- type: [String, Number],
26
- default: 100
27
- },
28
- min: {
29
- type: Number,
30
- default: 0
31
- },
32
- max: {
33
- type: Number,
34
- default: 5
35
- },
36
- breakEven: {
37
- type: Number,
38
- default: 1
39
- },
40
- forceBreakEven: {
41
- type: Boolean,
42
- default: false
43
- },
44
- value: {
45
- type: [String, Number],
46
- default: null
47
- },
48
- positiveBg: {
49
- type: String,
50
- default: 'psui-bg-blue-60'
51
- },
52
- negativeBg: {
53
- type: String,
54
- default: 'psui-bg-red-20'
55
- }
20
+ <script setup>
21
+ import { defineProps, computed } from 'vue'
22
+
23
+ const props = defineProps({
24
+ width: {
25
+ type: [String, Number],
26
+ default: 100,
56
27
  },
57
- computed: {
58
- getVolume(){
59
- return (this.max - this.min)
60
- },
61
- getProgress() {
62
- if(this.value == 9876543210) return 100
63
- const progress = (100 / this.getVolume) * this.value
64
- return progress > 100 ? 100 : progress
65
- },
66
- getProgressWidth() {
67
- return `${this.getProgress}%`
68
- },
69
- getIsBreakEven() {
70
- if ( this.forceBreakEven ) return true
71
- return this.value >= this.breakEven ? true : false
72
- },
73
- getBreakEvenLeft() {
74
- return `${(100 / this.getVolume) * this.breakEven}%`
75
- },
76
- getBg() {
77
- if ( this.forceBreakEven ) return this.positiveBg
78
- return this.getIsBreakEven ? this.positiveBg : this.negativeBg
79
- }
80
- }
81
- }
82
- </script>
28
+ min: {
29
+ type: Number,
30
+ default: 0,
31
+ },
32
+ max: {
33
+ type: Number,
34
+ default: 5,
35
+ },
36
+ breakEven: {
37
+ type: Number,
38
+ default: 1,
39
+ },
40
+ forceBreakEven: {
41
+ type: Boolean,
42
+ default: false,
43
+ },
44
+ value: {
45
+ type: [String, Number],
46
+ default: null,
47
+ },
48
+ positiveBg: {
49
+ type: String,
50
+ default: 'psui-bg-blue-60',
51
+ },
52
+ negativeBg: {
53
+ type: String,
54
+ default: 'psui-bg-red-20',
55
+ },
56
+ })
57
+
58
+ const getVolume = computed(() => {
59
+ return props.max - props.min
60
+ })
61
+
62
+ const getProgress = computed(() => {
63
+ if (props.value == 9876543210) return 100
64
+ const progress = (100 / getVolume.value) * props.value
65
+ return progress > 100 ? 100 : progress
66
+ })
67
+
68
+ const getProgressWidth = computed(() => {
69
+ return `${getProgress.value}%`
70
+ })
83
71
 
84
- <style> /* Please, use the file src/assets/scss/components/PsProgressBar.scss */ </style>
72
+ const getIsBreakEven = computed(() => {
73
+ if (props.forceBreakEven) return true
74
+ return props.value >= props.breakEven ? true : false
75
+ })
76
+
77
+ const getBreakEvenLeft = computed(() => {
78
+ return `${(100 / getVolume.value) * props.breakEven}%`
79
+ })
80
+
81
+ const getBg = computed(() => {
82
+ if (props.forceBreakEven) return props.positiveBg
83
+ return getIsBreakEven.value ? props.positiveBg : props.negativeBg
84
+ })
85
+ </script>
85
86
 
87
+ <style>
88
+ /* Please, use the file src/assets/scss/components/PsProgressBar.scss */
89
+ </style>
@@ -1,31 +1,26 @@
1
1
  <template>
2
- <div
3
- class="psui-el-tag-scope"
2
+ <div
3
+ class="psui-el-tag-scope"
4
4
  :class="getComponentClass"
5
5
  >
6
6
  <span class="psui-el-tag-scope-icon">{{ getComponentIcon }}</span>
7
7
  </div>
8
8
  </template>
9
9
 
10
- <script>
11
- export default {
12
- name: 'PsTagScope',
13
- props: {
14
- included: {
15
- type: Boolean,
16
- default: true
17
- },
18
- },
19
- computed: {
20
- getComponentClass() {
21
- return `psui-el-tag-scope-${this.included}`
22
- },
23
- getComponentIcon() {
24
- return this.included ? 'check' : 'remove'
25
- }
26
- },
27
- }
28
- </script>
10
+ <script setup>
11
+ import { defineProps, computed } from 'vue'
12
+
13
+ const props = defineProps({})
29
14
 
30
- <style> /* Please, use the file src/assets/scss/components/PsTagScope.scss */ </style>
15
+ const getComponentClass = computed(() => {
16
+ return `psui-el-tag-scope-${props.included}`
17
+ })
18
+
19
+ const getComponentIcon = computed(() => {
20
+ return props.included ? 'check' : 'remove'
21
+ })
22
+ </script>
31
23
 
24
+ <style>
25
+ /* Please, use the file src/assets/scss/components/PsTagScope.scss */
26
+ </style>
@@ -19,32 +19,26 @@
19
19
  </div>
20
20
  </template>
21
21
 
22
- <script>
22
+ <script setup>
23
+ import { defineProps } from 'vue'
23
24
  import PsIcon from '../ui/PsIcon.vue'
24
25
 
25
- export default {
26
- name: 'PsTestimonialCard',
27
- components:{
28
- PsIcon
29
- },
30
- props:{
31
- description:{
32
- type: String,
33
- default: '',
34
- },
35
- user:{
36
- type: String,
37
- default: '',
38
- },
39
- position:{
40
- type: String,
41
- default: '',
42
- },
43
- jurisdiction:{
44
- type: String,
45
- default: '',
46
- },
47
- }
48
- }
26
+ defineProps({
27
+ description: {
28
+ type: String,
29
+ default: '',
30
+ },
31
+ user: {
32
+ type: String,
33
+ default: '',
34
+ },
35
+ position: {
36
+ type: String,
37
+ default: '',
38
+ },
39
+ jurisdiction: {
40
+ type: String,
41
+ default: '',
42
+ },
43
+ })
49
44
  </script>
50
-
@@ -1,13 +1,13 @@
1
1
  <template>
2
2
  <button
3
- @click="onClick()"
3
+ @click="onClick()"
4
4
  @mouseenter="onMouseEnter"
5
- @mouseleave="onMouseLeave"
6
- class="psui-el-button"
7
- :class="[getComponentClass, {'hover': isHover}, {'disabled': disabled || loading }]"
5
+ @mouseleave="onMouseLeave"
6
+ class="psui-el-button"
7
+ :class="[getComponentClass, { hover: isHover }, { disabled: disabled || loading }]"
8
8
  >
9
9
  <svg
10
- v-if="loading"
10
+ v-if="loading"
11
11
  class="psui-animate-spin psui-mr-3 psui-h-5 psui-w-5 psui-text-black"
12
12
  :class="`${iconPosition == 'left' ? 'psui-mr-3' : 'psui-ml-3 psui--mr-1'}`"
13
13
  xmlns="http://www.w3.org/2000/svg"
@@ -37,74 +37,73 @@
37
37
  </button>
38
38
  </template>
39
39
 
40
- <script setup lang="ts">
41
- import { PropType, computed, ref } from 'vue'
40
+ <script setup>
41
+ import { computed, ref, defineEmits } from 'vue'
42
42
 
43
- const isHover = ref(false)
43
+ const isHover = ref(false)
44
44
 
45
- const emit = defineEmits(['click'])
45
+ const emit = defineEmits(['click'])
46
46
 
47
- const props = defineProps({
48
- label: {
49
- type: String,
50
- default: ''
51
- },
52
- layout:{
53
- type: String as PropType<'solid' | 'outline' | 'ghost' | 'onlytext' | 'caution'>,
54
- default: 'solid',
55
- validator: (value:string) => ['solid','outline','ghost','onlytext','caution'].includes(value)
56
- },
57
- icon: {
58
- type: String,
59
- default: ''
60
- },
61
- iconPosition: {
62
- type: String,
63
- default: 'left',
64
- validator: (value:string) => ['left','right'].includes(value)
65
- },
66
- size: {
67
- type: String,
68
- default: 'big',
69
- validator: (value:string) => ['small','medium','big'].includes(value)
70
- },
71
- disabled: {
72
- type: Boolean,
73
- default: false
74
- },
75
- loading: {
76
- type: Boolean,
77
- default: false
78
- },
79
- iconClass:{
80
- type: String,
81
- default: ''
82
- }
83
- })
47
+ const props = defineProps({
48
+ label: {
49
+ type: String,
50
+ default: '',
51
+ },
52
+ layout: {
53
+ type: String,
54
+ default: 'solid',
55
+ validator: (value) => ['solid', 'outline', 'ghost', 'onlytext', 'caution'].includes(value),
56
+ },
57
+ icon: {
58
+ type: String,
59
+ default: '',
60
+ },
61
+ iconPosition: {
62
+ type: String,
63
+ default: 'left',
64
+ validator: (value) => ['left', 'right'].includes(value),
65
+ },
66
+ size: {
67
+ type: String,
68
+ default: 'big',
69
+ validator: (value) => ['small', 'medium', 'big'].includes(value),
70
+ },
71
+ disabled: {
72
+ type: Boolean,
73
+ default: false,
74
+ },
75
+ loading: {
76
+ type: Boolean,
77
+ default: false,
78
+ },
79
+ iconClass: {
80
+ type: String,
81
+ default: '',
82
+ },
83
+ })
84
84
 
85
- const getComponentClass = computed(()=>{
86
- if(props.icon){
85
+ const getComponentClass = computed(() => {
86
+ if (props.icon) {
87
87
  return `layout-${props.layout} size-${props.size} icon-${props.iconPosition}`
88
88
  } else {
89
- return `layout-${props.layout} size-${props.size}`
89
+ return `layout-${props.layout} size-${props.size}`
90
90
  }
91
- })
91
+ })
92
92
 
93
- const onClick = () => {
93
+ const onClick = () => {
94
94
  if (props.disabled) return
95
- emit('click')
96
- }
97
- const onMouseEnter = () => {
98
- if(!props.disabled){
95
+ emit('click')
96
+ }
97
+
98
+ const onMouseEnter = () => {
99
+ if (!props.disabled) {
99
100
  isHover.value = true
100
101
  }
101
- }
102
+ }
102
103
 
103
- const onMouseLeave = () => {
104
- if(!props.disabled){
105
- isHover.value = false
106
- }
104
+ const onMouseLeave = () => {
105
+ if (!props.disabled) {
106
+ isHover.value = false
107
107
  }
108
-
108
+ }
109
109
  </script>
110
-
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <div
3
- class="psui-el-chips"
2
+ <div
3
+ class="psui-el-chips"
4
4
  :class="[getComponentClass, `layout-${layout}`, `type-${type}`]"
5
5
  >
6
6
  <input
@@ -14,16 +14,16 @@
14
14
  <label
15
15
  :disabled="disabled"
16
16
  :for="getInputId"
17
- :class="{'checked':checked && type === 'button'}"
17
+ :class="{'checked': checked && type === 'button' }"
18
18
  >
19
19
  <i
20
20
  v-if="icon"
21
21
  class="psui-el-chips-icon psui-el-chips-icon-prepend"
22
22
  >{{ icon }}</i>
23
23
  {{ label }}
24
- <button
25
- @click="onClose"
26
- v-if="layout === 'rich'"
24
+ <button
25
+ @click="onClose"
26
+ v-if="layout === 'rich'"
27
27
  class="psui-el-chips-close"
28
28
  >
29
29
  <span class="psui-el-chips-icon">close</span>
@@ -32,105 +32,102 @@
32
32
  </div>
33
33
  </template>
34
34
 
35
- <script>
36
- export const type = ['radio', 'checkbox', 'button']
37
- import { randomString } from '../../util/GeneralFunctions'
35
+ <script setup>
36
+ import { defineProps, defineEmits, computed, useAttrs } from 'vue'
38
37
 
39
- export default {
40
- name: 'PsChips',
41
- props: {
42
- /**
43
- * It sets the label of the chips button.
44
- */
45
- label: {
46
- type: String,
47
- default: '',
48
- },
49
- /**
50
- * It sets the type of the chips button. eg: radio, checkbox, button.
51
- */
52
- type: {
53
- type: String,
54
- required: true,
55
- default: 'button',
56
- validator: (type) => ['radio', 'checkbox', 'button'].includes(type)
57
- },
58
- /**
59
- * It sets the layout of the chipsbutton. eg: simple, with-icon, rich.
60
- */
61
- layout: {
62
- type: String,
63
- default: 'simple',
64
- validator: (value) => ['simple', 'with-icon', 'rich'].includes(value)
65
- },
66
- /**
67
- * 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/.
68
- */
69
- icon: {
70
- type: String,
71
- default: '',
72
- },
73
- /**
74
- * It sets if the button was checked or not checked.
75
- */
76
- checked: {
77
- type: Boolean,
78
- default: false
79
- },
80
- /**
81
- * It disables the chips button.
82
- */
83
- disabled: {
84
- type: Boolean,
85
- default: false
86
- },
87
- /**
88
- * It sets if the button is active or not.
89
- */
90
- active: {
91
- type: Boolean,
92
- default: false
93
- },
94
- /**
95
- * Add html attributes to the element input
96
- */
97
- inputAttrs: {
98
- type: Object,
99
- default: () => ({})
100
- },
38
+ import { randomString } from '../../util/GeneralFunctions.js'
39
+
40
+ const emit = defineEmits(['click', 'change', 'update:checked', 'close'])
41
+
42
+ const attrs = useAttrs()
43
+
44
+ const props = defineProps({
45
+ /**
46
+ * It sets the label of the chips button.
47
+ */
48
+ label: {
49
+ type: String,
50
+ default: '',
51
+ },
52
+ type: {
53
+ type: String,
54
+ required: true,
55
+ default: 'button',
56
+ validator: (type) => ['radio', 'checkbox', 'button'].includes(type),
57
+ },
58
+ /**
59
+ * It sets the layout of the chipsbutton. eg: simple, with-icon, rich.
60
+ */
61
+ layout: {
62
+ type: String,
63
+ default: 'simple',
64
+ validator: (value) => ['simple', 'with-icon', 'rich'].includes(value),
65
+ },
66
+ /**
67
+ * 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/.
68
+ */
69
+ icon: {
70
+ type: String,
71
+ default: '',
72
+ },
73
+ /**
74
+ * It sets if the button was checked or not checked.
75
+ */
76
+ checked: {
77
+ type: Boolean,
78
+ default: false,
101
79
  },
102
- emits: ['click', 'change'],
103
- computed: {
104
- getComponentClass() {
105
- if (this.disabled) {
106
- return 'status-disabled'
107
- } else {
108
- return 'status-resting'
109
- }
110
- },
111
- getInputId() {
112
- if (this?.inputAttrs?.id) {
113
- return this.inputAttrs.id
114
- } else if (this?.$attrs?.id) {
115
- return this.$attrs.id
116
- } else {
117
- return randomString(16)
118
- }
119
- },
80
+ /**
81
+ * It disables the chips button.
82
+ */
83
+ disabled: {
84
+ type: Boolean,
85
+ default: false,
120
86
  },
121
- methods: {
122
- onClick() {
123
- this.$emit('click')
124
- },
125
- onChange(event) {
126
- this.$emit('update:checked', event.target.checked)
127
- this.$emit('change', event)
128
- },
129
- onClose() {
130
- this.$emit('close')
131
- },
87
+ /**
88
+ * It sets if the button is active or not.
89
+ */
90
+ active: {
91
+ type: Boolean,
92
+ default: false,
132
93
  },
94
+ /**
95
+ * Add html attributes to the element input
96
+ */
97
+ inputAttrs: {
98
+ type: Object,
99
+ default: () => ({}),
100
+ },
101
+ })
102
+
103
+ const getComponentClass = computed(() => {
104
+ if (props.disabled) {
105
+ return 'status-disabled'
106
+ } else {
107
+ return 'status-resting'
108
+ }
109
+ })
110
+
111
+ const getInputId = computed(() => {
112
+ if (props?.inputAttrs?.id) {
113
+ return props.inputAttrs.id
114
+ } else if (attrs?.id) {
115
+ return attrs.id
116
+ } else {
117
+ return randomString(16)
118
+ }
119
+ })
120
+
121
+ const onChange = (event) => {
122
+ emit('update:checked', event.target.checked)
123
+ emit('change', event)
124
+ }
125
+
126
+ const onClose = () => {
127
+ emit('close')
133
128
  }
134
129
  </script>
135
130
 
136
- <style> /* Please, use the file src/assets/scss/components/PsChips.scss */</style>
131
+ <style>
132
+ /* Please, use the file src/assets/scss/components/PsChips.scss */
133
+ </style>