@policystudio/policy-studio-ui-vue 1.1.89 → 1.1.90-access.1

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 (171) 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 +6638 -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 +12 -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 +10 -0
  84. package/src/assets/scss/components/PsProgressBar.scss +4 -4
  85. package/src/assets/scss/components/PsSwitch.scss +10 -0
  86. package/src/assets/scss/components/PsTabHeader.scss +64 -2
  87. package/src/assets/scss/components/PsTableResults.scss +51 -82
  88. package/src/assets/scss/components/PsTestimonialCard.scss +1 -1
  89. package/src/assets/scss/components/PsTooltip.scss +149 -145
  90. package/src/components/accordion/PsAccordion.vue +20 -21
  91. package/src/components/accordion/PsAccordionItem.vue +122 -81
  92. package/src/components/badges-and-tags/PsBadgeWithIcon.vue +37 -36
  93. package/src/components/badges-and-tags/PsCardInfos.vue +40 -40
  94. package/src/components/badges-and-tags/PsChartLegend.vue +50 -41
  95. package/src/components/badges-and-tags/PsClimateZoneBadge.vue +13 -19
  96. package/src/components/badges-and-tags/PsCostEffectBar.vue +28 -61
  97. package/src/components/badges-and-tags/PsDateCardInfo.vue +17 -18
  98. package/src/components/badges-and-tags/PsHighlightRippleDot.vue +4 -3
  99. package/src/components/badges-and-tags/PsMiniTag.vue +39 -41
  100. package/src/components/badges-and-tags/PsProgressBar.vue +72 -68
  101. package/src/components/badges-and-tags/PsTagScope.vue +17 -22
  102. package/src/components/badges-and-tags/PsTestimonialCard.vue +25 -30
  103. package/src/components/buttons/PsButton.vue +90 -98
  104. package/src/components/chips/PsChips.vue +118 -103
  105. package/src/components/collapse/PsCollapse.vue +124 -0
  106. package/src/components/controls/PsCheckbox.vue +86 -83
  107. package/src/components/controls/PsCheckboxSimple.vue +97 -97
  108. package/src/components/controls/PsDraggable.vue +100 -99
  109. package/src/components/controls/PsInlineSelector.vue +111 -113
  110. package/src/components/controls/PsRadioButton.vue +72 -60
  111. package/src/components/controls/PsRadioButtonSimple.vue +81 -77
  112. package/src/components/controls/PsSlider.vue +190 -181
  113. package/src/components/controls/PsSwitch.vue +64 -54
  114. package/src/components/controls/PsToggle.vue +62 -57
  115. package/src/components/data-graphics/PsBarChart.vue +22 -23
  116. package/src/components/datatable/PsDataTable.vue +70 -65
  117. package/src/components/datatable/PsDataTableItem.vue +30 -32
  118. package/src/components/forms/PsDropdown.vue +173 -166
  119. package/src/components/forms/PsDropdownList.vue +133 -130
  120. package/src/components/forms/PsInput.vue +163 -146
  121. package/src/components/forms/PsInputSelect.vue +121 -100
  122. package/src/components/forms/PsInputTextArea.vue +84 -74
  123. package/src/components/navigations/PsBreadcrumb.vue +25 -34
  124. package/src/components/notifications/PsDialog.vue +67 -60
  125. package/src/components/notifications/PsSimpleAlert.vue +47 -37
  126. package/src/components/notifications/PsToast.vue +48 -42
  127. package/src/components/table-results/PsTableResults.vue +527 -504
  128. package/src/components/table-results/PsTableResultsBody.vue +69 -68
  129. package/src/components/table-results/PsTableResultsHead.vue +108 -69
  130. package/src/components/table-results/PsTableResultsHeadComparison.vue +88 -69
  131. package/src/components/table-results/PsTableResultsHeadFlexible.vue +112 -72
  132. package/src/components/table-results/PsTableResultsRow.vue +61 -58
  133. package/src/components/tabs/PsTabHeader.vue +138 -116
  134. package/src/components/tooltip/PsDialogTooltip.vue +112 -107
  135. package/src/components/tooltip/PsRichTooltip.vue +46 -43
  136. package/src/components/tooltip/PsTooltip.vue +126 -122
  137. package/src/components/ui/PsDotLoader.vue +6 -10
  138. package/src/components/ui/PsIcon.vue +149 -134
  139. package/src/index.ts +159 -0
  140. package/src/tsconfig.json +12 -0
  141. package/src/types/index.d.ts +6 -0
  142. package/src/util/GeneralFunctions.js +16 -7
  143. package/src/util/directives.ts +24 -0
  144. package/src/util/imageLoader.js +14 -7
  145. package/tailwind.config.js +12 -3
  146. package/tsconfig.json +47 -0
  147. package/.storybook/PolicyStudio.js +0 -10
  148. package/.storybook/eventBus.js +0 -3
  149. package/.storybook/main.js +0 -25
  150. package/.storybook/manager.js +0 -6
  151. package/babel.config.js +0 -3
  152. package/backup-package-lock.json +0 -37194
  153. package/dist/css/psui_styles.css +0 -110965
  154. package/postcss.config.js +0 -8
  155. package/src/components/playground/PsScrollBar.vue +0 -248
  156. package/src/index.js +0 -167
  157. package/src/stories/Playground.stories.js +0 -16
  158. /package/{src → doc/src}/assets/images/multifamily-units.svg +0 -0
  159. /package/{src → doc/src}/assets/images/policy-studio.svg +0 -0
  160. /package/{src/contents/ComparisonData.js → doc/src/contents/ComparisonData.ts} +0 -0
  161. /package/{src/contents/FlexibleData.js → doc/src/contents/FlexibleData.ts} +0 -0
  162. /package/{src/contents/ResultsData.js → doc/src/contents/ResultsData.ts} +0 -0
  163. /package/{src/stories/Colors.stories.mdx → doc/src/stories/Colors.mdx} +0 -0
  164. /package/{src → doc/src}/stories/assets/code-brackets.svg +0 -0
  165. /package/{src → doc/src}/stories/assets/colors.svg +0 -0
  166. /package/{src → doc/src}/stories/assets/comments.svg +0 -0
  167. /package/{src → doc/src}/stories/assets/direction.svg +0 -0
  168. /package/{src → doc/src}/stories/assets/flow.svg +0 -0
  169. /package/{src → doc/src}/stories/assets/plugin.svg +0 -0
  170. /package/{src → doc/src}/stories/assets/repo.svg +0 -0
  171. /package/{src → doc/src}/stories/assets/stackalt.svg +0 -0
@@ -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 { 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>
@@ -8,41 +8,36 @@
8
8
  display="flex"
9
9
  />
10
10
  </div>
11
- <p class="psui-el-testimonial-description">{{description}}</p>
11
+ <p class="psui-el-testimonial-description">
12
+ {{ description }}
13
+ </p>
12
14
  <div class="psui-el-testimonial-info">
13
- <span class="psui-el-testimonial-info-user" >{{user}}</span>
14
- <span class="psui-el-testimonial-info-position">{{position}}</span>
15
- <span class="psui-el-testimonial-info-jurisdiction">{{jurisdiction}}</span>
15
+ <span class="psui-el-testimonial-info-user">{{ user }}</span>
16
+ <span class="psui-el-testimonial-info-position">{{ position }}</span>
17
+ <span class="psui-el-testimonial-info-jurisdiction">{{ jurisdiction }}</span>
16
18
  </div>
17
19
  </div>
18
20
  </template>
19
21
 
20
- <script>
22
+ <script setup>
21
23
  import PsIcon from '../ui/PsIcon.vue'
22
24
 
23
- export default {
24
- name: 'PsTestimonialCard',
25
- components:{
26
- PsIcon
27
- },
28
- props:{
29
- description:{
30
- type: String,
31
- default: '',
32
- },
33
- user:{
34
- type: String,
35
- default: '',
36
- },
37
- position:{
38
- type: String,
39
- default: '',
40
- },
41
- jurisdiction:{
42
- type: String,
43
- default: '',
44
- },
45
- }
46
- }
25
+ defineProps({
26
+ description: {
27
+ type: String,
28
+ default: '',
29
+ },
30
+ user: {
31
+ type: String,
32
+ default: '',
33
+ },
34
+ position: {
35
+ type: String,
36
+ default: '',
37
+ },
38
+ jurisdiction: {
39
+ type: String,
40
+ default: '',
41
+ },
42
+ })
47
43
  </script>
48
-
@@ -1,113 +1,105 @@
1
1
  <template>
2
2
  <button
3
- @click="onClick()"
4
- @mouseenter="onMouseEnter"
5
- @mouseleave="onMouseLeave"
6
- class='psui-el-button'
7
- :class="[getComponentClass, {'hover': isHover}, {'disabled': disabled || loading }]"
8
- >
9
- <svg v-if="loading"
3
+ @click="onClick($event)"
4
+ @mouseenter="onMouseEnter"
5
+ @mouseleave="onMouseLeave"
6
+ class="psui-el-button"
7
+ :class="[getComponentClass, { hover: isHover && !disabled}, { disabled: disabled || loading }]"
8
+ >
9
+ <svg
10
+ v-if="loading"
10
11
  class="psui-animate-spin psui-mr-3 psui-h-5 psui-w-5 psui-text-black"
11
12
  :class="`${iconPosition == 'left' ? 'psui-mr-3' : 'psui-ml-3 psui--mr-1'}`"
12
- xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
13
- <circle class="psui-opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
14
- <path class="psui-opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
13
+ xmlns="http://www.w3.org/2000/svg"
14
+ fill="none"
15
+ viewBox="0 0 24 24"
16
+ >
17
+ <circle
18
+ class="psui-opacity-25"
19
+ cx="12"
20
+ cy="12"
21
+ r="10"
22
+ stroke="currentColor"
23
+ stroke-width="4"
24
+ />
25
+ <path
26
+ class="psui-opacity-75"
27
+ fill="currentColor"
28
+ d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
29
+ />
15
30
  </svg>
16
- <i v-else-if="icon" :class='iconClass' class='material-icons-round'>{{icon}}</i>
31
+ <i
32
+ v-else-if="icon"
33
+ :class="iconClass"
34
+ class="material-icons-round"
35
+ >{{ icon }}</i>
17
36
  <span v-if="label">{{ label }}</span>
18
37
  </button>
19
38
  </template>
20
39
 
21
- <script>
22
- export default {
23
- props: {
24
- /**
25
- * It set de label of the button when component is rendered.
26
- */
27
- label: {
28
- type: String,
29
- },
30
- /**
31
- * It set the layout of the button. eg: solid, outline, ghost, onlytext and caution.
32
- */
33
- layout: {
34
- type: String,
35
- default: 'solid',
36
- validator: (value) => ['solid','outline','ghost','onlytext','caution'].includes(value)
37
- },
38
- /**
39
- * 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/.
40
- */
41
- icon: {
42
- type: String,
43
- },
44
- /**
45
- * It sets the position of the icon. eg: left or right.
46
- */
47
- iconPosition:{
48
- type: String,
49
- default: 'left',
50
- validator: (value) => ['left','right'].includes(value)
51
- },
52
- /**
53
- * It sets the size of the icon. eg: small, medium and big.
54
- */
55
- size: {
56
- type: String,
57
- default: 'big',
58
- validator: (value) => ['small','medium','big'].includes(value)
59
- },
60
- /**
61
- * It disable the button. All mouse event are disabled.
62
- */
63
- disabled: {
64
- type: Boolean,
65
- default: false
66
- },
67
- /**
68
- * It disable and add a spin icon to the button. All mouse event are disabled.
69
- */
70
- loading: {
71
- type: Boolean,
72
- default: false
73
- },
74
- /**
75
- * It set any further css style that might be needed.
76
- */
77
- iconClass:{
78
- type: String
79
- }
40
+ <script setup>
41
+ import { computed, ref, } from 'vue'
42
+
43
+ const isHover = ref(false)
44
+
45
+ const emit = defineEmits(['click'])
46
+
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,
80
74
  },
81
- data(){
82
- return {
83
- isHover: false,
84
- }
75
+ loading: {
76
+ type: Boolean,
77
+ default: false,
85
78
  },
86
- computed: {
87
- getComponentClass(){
88
- if(this.icon){
89
- return `layout-${this.layout} size-${this.size} icon-${this.iconPosition}`
90
- } else {
91
- return `layout-${this.layout} size-${this.size}`
92
- }
93
- },
79
+ iconClass: {
80
+ type: String,
81
+ default: '',
94
82
  },
95
- methods: {
96
- onClick() {
97
- if (this.disabled) return
98
- this.$emit('click')
99
- },
100
- onMouseEnter(){
101
- if(!this.disabled){
102
- this.isHover = true
103
- }
104
- },
105
- onMouseLeave(){
106
- if(!this.disabled){
107
- this.isHover = false
108
- }
109
- }
83
+ })
84
+
85
+ const getComponentClass = computed(() => {
86
+ if (props.icon) {
87
+ return `layout-${props.layout} size-${props.size} icon-${props.iconPosition}`
88
+ } else {
89
+ return `layout-${props.layout} size-${props.size}`
110
90
  }
91
+ })
92
+
93
+ const onClick = (event) => {
94
+ if (props.disabled) return
95
+ emit('click', event)
111
96
  }
112
- </script>
113
97
 
98
+ const onMouseEnter = () => {
99
+ isHover.value = true
100
+ }
101
+
102
+ const onMouseLeave = () => {
103
+ isHover.value = false
104
+ }
105
+ </script>
@@ -1,7 +1,16 @@
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
+ v-tooltip="{
6
+ content: disabledText,
7
+ trigger: 'hover',
8
+ placement: 'bottom',
9
+ show: layout === 'disabled' && disabledText !== '' && isHovering
10
+ }"
11
+ @mouseover="isHovering = true"
12
+ @mouseleave="isHovering = false"
13
+ @click="emit('click')"
5
14
  >
6
15
  <input
7
16
  @change="onChange"
@@ -10,17 +19,20 @@
10
19
  :type="type"
11
20
  :id="getInputId"
12
21
  :checked="checked"
13
- />
22
+ >
14
23
  <label
15
24
  :disabled="disabled"
16
25
  :for="getInputId"
17
- :class="{'checked':checked && type === 'button'}"
26
+ :class="{'checked': checked && type === 'button', 'layout-disabled': layout === 'disabled'}"
18
27
  >
19
- <i v-if="icon" class="psui-el-chips-icon psui-el-chips-icon-prepend">{{ icon }}</i>
28
+ <i
29
+ v-if="icon"
30
+ class="psui-el-chips-icon psui-el-chips-icon-prepend"
31
+ >{{ icon }}</i>
20
32
  {{ label }}
21
- <button
22
- @click="onClose"
23
- v-if="layout === 'rich'"
33
+ <button
34
+ @click="onClose"
35
+ v-if="layout === 'rich'"
24
36
  class="psui-el-chips-close"
25
37
  >
26
38
  <span class="psui-el-chips-icon">close</span>
@@ -29,105 +41,108 @@
29
41
  </div>
30
42
  </template>
31
43
 
32
- <script>
33
- export const type = ['radio', 'checkbox', 'button']
34
- import { randomString } from '../../util/GeneralFunctions'
44
+ <script setup>
45
+ import { computed, useAttrs, ref } from 'vue'
46
+
47
+ import { randomString } from '../../util/GeneralFunctions.js'
48
+
49
+ const emit = defineEmits(['click', 'change', 'update:checked', 'close'])
50
+
51
+ const attrs = useAttrs()
35
52
 
36
- export default {
37
- name: 'PsChips',
38
- props: {
39
- /**
40
- * It sets the label of the chips button.
41
- */
42
- label: {
43
- type: String,
44
- default: '',
45
- },
46
- /**
47
- * It sets the type of the chips button. eg: radio, checkbox, button.
48
- */
49
- type: {
50
- type: String,
51
- required: true,
52
- default: 'button',
53
- validator: (type) => ['radio', 'checkbox', 'button'].includes(type)
54
- },
55
- /**
56
- * It sets the layout of the chipsbutton. eg: simple, with-icon, rich.
57
- */
58
- layout: {
59
- type: String,
60
- default: 'simple',
61
- validator: (value) => ['simple', 'with-icon', 'rich'].includes(value)
62
- },
63
- /**
64
- * It sets the text key which will retrieve a icon from Google Fonts. Make sure to get the right description of your icon on https://fonts.google.com/.
65
- */
66
- icon: {
67
- type: String,
68
- default: '',
69
- },
70
- /**
71
- * It sets if the button was checked or not checked.
72
- */
73
- checked: {
74
- type: Boolean,
75
- default: false
76
- },
77
- /**
78
- * It disables the chips button.
79
- */
80
- disabled: {
81
- type: Boolean,
82
- default: false
83
- },
84
- /**
85
- * It sets if the button is active or not.
86
- */
87
- active: {
88
- type: Boolean,
89
- default: false
90
- },
91
- /**
92
- * Add html attributes to the element input
93
- */
94
- inputAttrs: {
95
- type: Object,
96
- default: () => ({})
97
- },
53
+ const props = defineProps({
54
+ /**
55
+ * It sets the label of the chips button.
56
+ */
57
+ label: {
58
+ type: String,
59
+ default: '',
60
+ },
61
+ type: {
62
+ type: String,
63
+ required: true,
64
+ default: 'button',
65
+ validator: (type) => ['radio', 'checkbox', 'button'].includes(type),
66
+ },
67
+ /**
68
+ * It sets the layout of the chipsbutton. eg: simple, with-icon, rich.
69
+ */
70
+ layout: {
71
+ type: String,
72
+ default: 'simple',
73
+ validator: (value) => ['simple', 'with-icon', 'rich', 'disabled'].includes(value),
74
+ },
75
+ /**
76
+ * 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/.
77
+ */
78
+ icon: {
79
+ type: String,
80
+ default: '',
81
+ },
82
+ /**
83
+ * It sets if the button was checked or not checked.
84
+ */
85
+ checked: {
86
+ type: Boolean,
87
+ default: false,
98
88
  },
99
- emits: ['click', 'change'],
100
- computed: {
101
- getComponentClass() {
102
- if (this.disabled) {
103
- return 'status-disabled'
104
- } else {
105
- return 'status-resting'
106
- }
107
- },
108
- getInputId() {
109
- if (this?.inputAttrs?.id) {
110
- return this.inputAttrs.id
111
- } else if (this?.$attrs?.id) {
112
- return this.$attrs.id
113
- } else {
114
- return randomString(16)
115
- }
116
- },
89
+ /**
90
+ * It disables the chips button.
91
+ */
92
+ disabled: {
93
+ type: Boolean,
94
+ default: false,
117
95
  },
118
- methods: {
119
- onClick() {
120
- this.$emit('click')
121
- },
122
- onChange(event) {
123
- this.$emit('update:checked', event.target.checked)
124
- this.$emit('change', event)
125
- },
126
- onClose() {
127
- this.$emit('close')
128
- },
96
+ /**
97
+ * It sets if the button is active or not.
98
+ */
99
+ active: {
100
+ type: Boolean,
101
+ default: false,
129
102
  },
103
+ /**
104
+ * Add html attributes to the element input
105
+ */
106
+ inputAttrs: {
107
+ type: Object,
108
+ default: () => ({}),
109
+ },
110
+ disabledText: {
111
+ type: String,
112
+ default: '',
113
+ }
114
+ })
115
+
116
+ const isHovering = ref(false)
117
+
118
+ const getComponentClass = computed(() => {
119
+ if (props.disabled) {
120
+ return 'status-disabled'
121
+ } else {
122
+ return 'status-resting'
123
+ }
124
+ })
125
+
126
+ const getInputId = computed(() => {
127
+ if (props?.inputAttrs?.id) {
128
+ return props.inputAttrs.id
129
+ } else if (attrs?.id) {
130
+ return attrs.id
131
+ } else {
132
+ return randomString(16)
133
+ }
134
+ })
135
+
136
+ const onChange = (event) => {
137
+ emit('update:checked', event.target.checked)
138
+ emit('change', event)
139
+ }
140
+
141
+ const onClose = () => {
142
+ emit('close')
130
143
  }
131
144
  </script>
132
145
 
133
- <style> /* Please, use the file src/assets/scss/components/PsChips.scss */</style>
146
+ <style>
147
+ /* Please, use the file src/assets/scss/components/PsChips.scss */
148
+ </style>