@policystudio/policy-studio-ui-vue 1.1.90-beta.4 → 1.1.90-beta.40
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.
- package/.eslintrc.js +2 -8
- package/.github/workflows/deploy-storybook.yml +4 -4
- package/.nvmrc +1 -0
- package/dist/css/psui_styles_output.css +6607 -0
- package/dist/index.d.ts +51 -0
- package/dist/index.js +106 -0
- package/dist/index.js.map +1 -0
- package/dist/util/GeneralFunctions.d.ts +3 -0
- package/dist/util/GeneralFunctions.js +35 -0
- package/dist/util/GeneralFunctions.js.map +1 -0
- package/dist/util/directives.d.ts +1 -0
- package/dist/util/directives.js +22 -0
- package/dist/util/directives.js.map +1 -0
- package/dist/util/imageLoader.d.ts +6 -0
- package/dist/util/imageLoader.js +52 -0
- package/dist/util/imageLoader.js.map +1 -0
- package/doc/.nvmrc +1 -0
- package/{.storybook → doc/.storybook}/main.ts +8 -2
- package/{.storybook → doc/.storybook}/preview.ts +2 -3
- package/doc/package-lock.json +22653 -0
- package/doc/package.json +71 -0
- package/{src → doc}/shims-vue.d.ts +0 -5
- package/{src → doc/src}/stories/Accordion.stories.ts +2 -3
- package/{src → doc/src}/stories/BadgeWithIcon.stories.ts +1 -1
- package/{src → doc/src}/stories/BarChart.stories.ts +1 -1
- package/{src → doc/src}/stories/Breadcrumb.stories.ts +1 -1
- package/doc/src/stories/Button.stories.ts +130 -0
- package/{src → doc/src}/stories/CardInfos.stories.ts +1 -1
- package/{src → doc/src}/stories/ChartLegend.stories.ts +1 -1
- package/{src → doc/src}/stories/Checkbox.stories.ts +1 -1
- package/{src → doc/src}/stories/CheckboxSimple.stories.ts +1 -1
- package/{src → doc/src}/stories/Chips.stories.ts +1 -4
- package/{src → doc/src}/stories/ClimateZoneBadge.stories.ts +2 -1
- package/doc/src/stories/Collapse.stories.ts +46 -0
- package/{src → doc/src}/stories/CostEffectBar.stories.ts +2 -1
- package/{src → doc/src}/stories/Datatable.stories.ts +5 -2
- package/{src → doc/src}/stories/DateCardInfo.stories.ts +1 -1
- package/{src → doc/src}/stories/Dialog.stories.ts +2 -2
- package/{src → doc/src}/stories/Draggable.stories.ts +3 -2
- package/{src → doc/src}/stories/Dropdown.stories.ts +4 -3
- package/{src → doc/src}/stories/DropdownList.stories.ts +4 -2
- package/{src → doc/src}/stories/HighlightRippleDot.stories.ts +3 -2
- package/{src → doc/src}/stories/Icon.stories.ts +3 -1
- package/{src → doc/src}/stories/InlineSelector.stories.ts +1 -1
- package/{src → doc/src}/stories/Input.stories.ts +7 -4
- package/{src → doc/src}/stories/InputSelect.stories.ts +3 -2
- package/{src → doc/src}/stories/InputTextArea.stories.ts +1 -1
- package/{src → doc/src}/stories/MiniTag.stories.ts +9 -2
- package/{src → doc/src}/stories/ProgressBar.stories.ts +3 -2
- package/{src → doc/src}/stories/RadioButton.stories.ts +2 -2
- package/{src → doc/src}/stories/RadioButtonSimple.stories.ts +1 -1
- package/{src → doc/src}/stories/SimpleAlert.stories.ts +3 -2
- package/{src → doc/src}/stories/Slider.stories.ts +6 -2
- package/{src → doc/src}/stories/Switch.stories.ts +2 -2
- package/{src → doc/src}/stories/TabHeader.stories.ts +6 -1
- package/{src → doc/src}/stories/TableResults.stories.ts +11 -7
- package/{src → doc/src}/stories/TagScope.stories.ts +3 -2
- package/{src → doc/src}/stories/TestimonialCard.stories.ts +3 -3
- package/{src → doc/src}/stories/Toast.stories.ts +2 -2
- package/{src → doc/src}/stories/Toggle.stories.ts +6 -3
- package/{src → doc/src}/stories/Tooltip.stories.ts +3 -3
- package/doc/tsconfig.json +17 -0
- package/package.json +13 -28
- package/scripts/gulp.js +11 -0
- package/src/assets/scss/base.scss +3 -34
- package/src/assets/scss/components/PsAccordion.scss +1 -1
- package/src/assets/scss/components/PsCollapse.scss +74 -0
- package/src/assets/scss/components/PsDataTable.scss +1 -1
- package/src/assets/scss/components/PsDropdownList.scss +1 -1
- package/src/assets/scss/components/PsTooltip.scss +2 -1
- package/src/components/accordion/PsAccordionItem.vue +88 -74
- package/src/components/badges-and-tags/PsBadgeWithIcon.vue +31 -34
- package/src/components/badges-and-tags/PsCardInfos.vue +39 -41
- package/src/components/badges-and-tags/PsChartLegend.vue +46 -51
- package/src/components/badges-and-tags/PsClimateZoneBadge.vue +13 -19
- package/src/components/badges-and-tags/PsCostEffectBar.vue +24 -56
- package/src/components/badges-and-tags/PsDateCardInfo.vue +17 -18
- package/src/components/badges-and-tags/PsHighlightRippleDot.vue +3 -2
- package/src/components/badges-and-tags/PsMiniTag.vue +39 -41
- package/src/components/badges-and-tags/PsProgressBar.vue +72 -68
- package/src/components/badges-and-tags/PsTagScope.vue +17 -22
- package/src/components/badges-and-tags/PsTestimonialCard.vue +19 -26
- package/src/components/buttons/PsButton.vue +61 -62
- package/src/components/chips/PsChips.vue +98 -101
- package/src/components/collapse/PsCollapse.vue +124 -0
- package/src/components/controls/PsCheckbox.vue +84 -84
- package/src/components/controls/PsCheckboxSimple.vue +95 -95
- package/src/components/controls/PsDraggable.vue +53 -55
- package/src/components/controls/PsInlineSelector.vue +98 -99
- package/src/components/controls/PsRadioButton.vue +65 -58
- package/src/components/controls/PsRadioButtonSimple.vue +79 -75
- package/src/components/controls/PsSlider.vue +185 -176
- package/src/components/controls/PsSwitch.vue +51 -52
- package/src/components/controls/PsToggle.vue +52 -50
- package/src/components/data-graphics/PsBarChart.vue +18 -21
- package/src/components/datatable/PsDataTable.vue +56 -60
- package/src/components/datatable/PsDataTableItem.vue +13 -28
- package/src/components/forms/PsDropdown.vue +166 -162
- package/src/components/forms/PsDropdownList.vue +133 -130
- package/src/components/forms/PsInput.vue +154 -153
- package/src/components/forms/PsInputSelect.vue +91 -92
- package/src/components/forms/PsInputTextArea.vue +70 -71
- package/src/components/navigations/PsBreadcrumb.vue +25 -34
- package/src/components/notifications/PsDialog.vue +57 -56
- package/src/components/notifications/PsSimpleAlert.vue +27 -29
- package/src/components/notifications/PsToast.vue +40 -39
- package/src/components/table-results/PsTableResults.vue +461 -468
- package/src/components/table-results/PsTableResultsBody.vue +66 -67
- package/src/components/table-results/PsTableResultsHead.vue +67 -61
- package/src/components/table-results/PsTableResultsHeadComparison.vue +62 -56
- package/src/components/table-results/PsTableResultsHeadFlexible.vue +68 -61
- package/src/components/table-results/PsTableResultsRow.vue +55 -56
- package/src/components/tabs/PsTabHeader.vue +106 -100
- package/src/components/tooltip/PsDialogTooltip.vue +96 -101
- package/src/components/tooltip/PsRichTooltip.vue +41 -45
- package/src/components/tooltip/PsTooltip.vue +111 -116
- package/src/components/ui/PsDotLoader.vue +1 -5
- package/src/components/ui/PsIcon.vue +128 -129
- package/src/index.ts +60 -67
- package/src/tsconfig.json +12 -0
- package/src/types/index.d.ts +6 -0
- package/src/util/{GeneralFunctions.ts → GeneralFunctions.js} +12 -3
- package/src/util/directives.ts +24 -0
- package/src/util/{imageLoader.ts → imageLoader.js} +7 -0
- package/tailwind.config.js +1 -1
- package/tsconfig.json +19 -14
- package/.storybook/eventBus.ts +0 -26
- package/babel.config.js +0 -17
- package/dist/css/psui_styles.css +0 -4647
- package/postcss.config.js +0 -8
- package/src/components/playground/PsScrollBar.vue +0 -320
- package/src/stories/Button.stories.ts +0 -48
- package/src/stories/Button.vue +0 -59
- package/src/stories/Header.stories.ts +0 -41
- package/src/stories/Header.vue +0 -77
- package/src/stories/Playground.stories.ts +0 -16
- package/src/stories/button.css +0 -30
- package/src/stories/header.css +0 -32
- package/webpack.config.js +0 -22
- /package/{.storybook → doc/.storybook}/PolicyStudio.ts +0 -0
- /package/{.storybook → doc/.storybook}/manager.ts +0 -0
- /package/{src → doc/src}/assets/images/multifamily-units.svg +0 -0
- /package/{src → doc/src}/assets/images/policy-studio.svg +0 -0
- /package/{src → doc/src}/contents/ComparisonData.ts +0 -0
- /package/{src → doc/src}/contents/FlexibleData.ts +0 -0
- /package/{src → doc/src}/contents/ResultsData.ts +0 -0
- /package/{src → doc/src}/stories/Colors.mdx +0 -0
- /package/{src → doc/src}/stories/ElevationSystem.mdx +0 -0
- /package/{src → doc/src}/stories/Introduction.mdx +0 -0
- /package/{src → doc/src}/stories/Typography.mdx +0 -0
- /package/{src → doc/src}/stories/assets/code-brackets.svg +0 -0
- /package/{src → doc/src}/stories/assets/colors.svg +0 -0
- /package/{src → doc/src}/stories/assets/comments.svg +0 -0
- /package/{src → doc/src}/stories/assets/direction.svg +0 -0
- /package/{src → doc/src}/stories/assets/flow.svg +0 -0
- /package/{src → doc/src}/stories/assets/plugin.svg +0 -0
- /package/{src → doc/src}/stories/assets/repo.svg +0 -0
- /package/{src → doc/src}/stories/assets/stackalt.svg +0 -0
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<ul
|
|
2
|
+
<ul
|
|
3
3
|
class="psui-el-dropdown-menu-list"
|
|
4
4
|
:class="`layout-${layout}`"
|
|
5
5
|
>
|
|
6
|
-
<li
|
|
7
|
-
v-for="(item, index) in getItems"
|
|
6
|
+
<li
|
|
7
|
+
v-for="(item, index) in getItems"
|
|
8
8
|
:key="`${index}-${getKeyValue(item)}`"
|
|
9
9
|
:id="`${index}-${getKeyValue(item)}`"
|
|
10
|
-
:class="{ 'is-selected psui-bg-blue-10 psui-text-blue-60 hover:psui-bg-blue-10 hover:psui-text-blue-60'
|
|
10
|
+
:class="{ 'is-selected psui-bg-blue-10 psui-text-blue-60 hover:psui-bg-blue-10 hover:psui-text-blue-60': getSelected === getKeyValue(item) }"
|
|
11
11
|
class="psui-el-dropdown-menu-list-item"
|
|
12
|
-
@mouseover="isHovering = index"
|
|
12
|
+
@mouseover="isHovering = index"
|
|
13
13
|
@mouseout="isHovering = false"
|
|
14
14
|
@click="selectItem(item)"
|
|
15
15
|
>
|
|
16
16
|
<div class="psui-el-dropdown-menu-list-item-left-label">
|
|
17
17
|
{{ getLeftLabel(item) }}
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
<div
|
|
20
20
|
v-if="item.description"
|
|
21
21
|
class="psui-font-normal psui-text-gray-50 psui-ml-1"
|
|
22
|
-
:class="{ 'psui-text-blue-60'
|
|
22
|
+
:class="{ 'psui-text-blue-60': item.key == getItems.key }"
|
|
23
23
|
>
|
|
24
24
|
{{ item.description }}
|
|
25
25
|
</div>
|
|
@@ -29,19 +29,19 @@
|
|
|
29
29
|
size="20"
|
|
30
30
|
class="psui-text-blue-60 psui-opacity-0 psui-transition psui-leading-none psui-cursor-pointer psui-ml-1"
|
|
31
31
|
:display="item.key == getItems.key || isHovering == index ? 'flex' : 'none'"
|
|
32
|
-
@click.stop="
|
|
32
|
+
@click.stop="emit('openDescriptionModal', { type: item.hasHelper.type, id: item.hasHelper.id, slug: item.hasHelper.slug })"
|
|
33
33
|
/>
|
|
34
34
|
</div>
|
|
35
35
|
|
|
36
36
|
<template v-if="layout == 'rich'">
|
|
37
37
|
<div class="psui-el-dropdown-menu-list-item-line" />
|
|
38
|
-
<div
|
|
38
|
+
<div
|
|
39
39
|
v-if="rightLabelFormatter"
|
|
40
40
|
class="psui-el-dropdown-menu-list-item-rigth-label"
|
|
41
41
|
>
|
|
42
42
|
{{ rightLabelFormatter(item.key, getStudyDataLevel[item.key], getStudyDataLevel) }}
|
|
43
43
|
</div>
|
|
44
|
-
<div
|
|
44
|
+
<div
|
|
45
45
|
v-else
|
|
46
46
|
class="psui-el-dropdown-menu-list-item-rigth-label"
|
|
47
47
|
>
|
|
@@ -49,132 +49,135 @@
|
|
|
49
49
|
</div>
|
|
50
50
|
</template>
|
|
51
51
|
</li>
|
|
52
|
-
</ul>
|
|
52
|
+
</ul>
|
|
53
53
|
</template>
|
|
54
54
|
|
|
55
|
-
<script>
|
|
55
|
+
<script setup>
|
|
56
56
|
import PsIcon from '../ui/PsIcon.vue'
|
|
57
|
-
|
|
57
|
+
import { ref, computed } from 'vue'
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
default: 'onlytext',
|
|
69
|
-
validator: (value) => {
|
|
70
|
-
return itemStyle.indexOf(value) !== -1
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
/**
|
|
74
|
-
* 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/.
|
|
75
|
-
*/
|
|
76
|
-
icon: {
|
|
77
|
-
type: String,
|
|
78
|
-
},
|
|
79
|
-
/**
|
|
80
|
-
* It sets the items which will be displayed on the dropdown menu.
|
|
81
|
-
*/
|
|
82
|
-
items: {
|
|
83
|
-
type: [Array, Object],
|
|
84
|
-
required: true
|
|
85
|
-
},
|
|
86
|
-
/**
|
|
87
|
-
* It sets the left key label of your items if needed.
|
|
88
|
-
*/
|
|
89
|
-
leftLabel: {
|
|
90
|
-
type: [String, Function],
|
|
91
|
-
default: 'left_label'
|
|
92
|
-
},
|
|
93
|
-
/**
|
|
94
|
-
* It sets the right key label of your items if needed.
|
|
95
|
-
*/
|
|
96
|
-
rightLabel: {
|
|
97
|
-
type: [String, Function],
|
|
98
|
-
default: 'right_label'
|
|
99
|
-
},
|
|
100
|
-
/**
|
|
101
|
-
* It sets the key label of your items if needed.
|
|
102
|
-
*/
|
|
103
|
-
label: {
|
|
104
|
-
type: [String, Function],
|
|
105
|
-
default: 'label'
|
|
106
|
-
},
|
|
107
|
-
/**
|
|
108
|
-
* It sets the key value of your items if needed.
|
|
109
|
-
*/
|
|
110
|
-
keyValue: {
|
|
111
|
-
type: [String, Function],
|
|
112
|
-
default: 'value'
|
|
113
|
-
},
|
|
114
|
-
/**
|
|
115
|
-
* It sets the format function to display values.
|
|
116
|
-
*/
|
|
117
|
-
rightLabelFormatter: {
|
|
118
|
-
type: Function
|
|
59
|
+
const props = defineProps({
|
|
60
|
+
/**
|
|
61
|
+
* It sets the style of items
|
|
62
|
+
*/
|
|
63
|
+
layout: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: 'onlytext',
|
|
66
|
+
validator: (value) => {
|
|
67
|
+
return ['onlytext', 'radio', 'icon', 'checkbox', 'switch', 'rich'].indexOf(value) !== -1
|
|
119
68
|
},
|
|
120
|
-
/**
|
|
121
|
-
* It sets the format function to display values.
|
|
122
|
-
*/
|
|
123
|
-
studyData: {
|
|
124
|
-
type: [String, Object]
|
|
125
|
-
},
|
|
126
|
-
/**
|
|
127
|
-
* It sets the item selected on the dropdown menu.
|
|
128
|
-
*/
|
|
129
|
-
selected: {},
|
|
130
69
|
},
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
if (typeof this.selected === 'object' && this.selected[this.keyValue] ) {
|
|
138
|
-
return this.selected[this.keyValue]
|
|
139
|
-
} else {
|
|
140
|
-
return this.selected
|
|
141
|
-
}
|
|
142
|
-
} else {
|
|
143
|
-
return false
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
getItems() {
|
|
147
|
-
return this.items
|
|
148
|
-
},
|
|
149
|
-
getStudyDataLevel() {
|
|
150
|
-
return this.studyData?.data || this.studyData
|
|
151
|
-
},
|
|
70
|
+
/**
|
|
71
|
+
* 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/.
|
|
72
|
+
*/
|
|
73
|
+
icon: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: '',
|
|
152
76
|
},
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
77
|
+
/**
|
|
78
|
+
* It sets the items which will be displayed on the dropdown menu.
|
|
79
|
+
*/
|
|
80
|
+
items: {
|
|
81
|
+
type: [Array, Object],
|
|
82
|
+
required: true,
|
|
83
|
+
},
|
|
84
|
+
/**
|
|
85
|
+
* It sets the left key label of your items if needed.
|
|
86
|
+
*/
|
|
87
|
+
leftLabel: {
|
|
88
|
+
type: [String, Function],
|
|
89
|
+
default: 'left_label',
|
|
90
|
+
},
|
|
91
|
+
/**
|
|
92
|
+
* It sets the right key label of your items if needed.
|
|
93
|
+
*/
|
|
94
|
+
rightLabel: {
|
|
95
|
+
type: [String, Function],
|
|
96
|
+
default: 'right_label',
|
|
97
|
+
},
|
|
98
|
+
/**
|
|
99
|
+
* It sets the key label of your items if needed.
|
|
100
|
+
*/
|
|
101
|
+
label: {
|
|
102
|
+
type: [String, Function],
|
|
103
|
+
default: 'label',
|
|
104
|
+
},
|
|
105
|
+
/**
|
|
106
|
+
* It sets the key value of your items if needed.
|
|
107
|
+
*/
|
|
108
|
+
keyValue: {
|
|
109
|
+
type: [String, Function],
|
|
110
|
+
default: 'value',
|
|
111
|
+
},
|
|
112
|
+
/**
|
|
113
|
+
* It sets the format function to display values.
|
|
114
|
+
*/
|
|
115
|
+
rightLabelFormatter: {
|
|
116
|
+
type: Function,
|
|
117
|
+
default: () => '',
|
|
118
|
+
},
|
|
119
|
+
/**
|
|
120
|
+
* It sets the format function to display values.
|
|
121
|
+
*/
|
|
122
|
+
studyData: {
|
|
123
|
+
type: [String, Object],
|
|
124
|
+
default: '',
|
|
125
|
+
},
|
|
126
|
+
/**
|
|
127
|
+
* It sets the item selected on the dropdown menu.
|
|
128
|
+
*/
|
|
129
|
+
selected: {},
|
|
130
|
+
})
|
|
131
|
+
const emit = defineEmits(['update:selected', 'change','openDescriptionModal'])
|
|
132
|
+
|
|
133
|
+
const isHovering = ref(false)
|
|
134
|
+
|
|
135
|
+
const getSelected = computed(() => {
|
|
136
|
+
if (props.selected !== undefined) {
|
|
137
|
+
if (typeof props.selected === 'object' && props.selected[props.keyValue]) {
|
|
138
|
+
return props.selected[props.keyValue]
|
|
139
|
+
} else {
|
|
140
|
+
return props.selected
|
|
141
|
+
}
|
|
142
|
+
} else {
|
|
143
|
+
return false
|
|
178
144
|
}
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
const getItems = computed(() => {
|
|
148
|
+
return props.items
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
const getStudyDataLevel = computed(() => {
|
|
152
|
+
return props.studyData?.data || props.studyData
|
|
153
|
+
})
|
|
154
|
+
|
|
155
|
+
const selectItem = (item) => {
|
|
156
|
+
emit('update:selected', getKeyValue(item))
|
|
157
|
+
emit('change', item)
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const getLeftLabel = (item) => {
|
|
161
|
+
if (typeof props.leftLabel == 'function') return props.leftLabel(item)
|
|
162
|
+
if (typeof item === 'string') return item
|
|
163
|
+
return item[props.leftLabel]
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const getRightLabel = (item) => {
|
|
167
|
+
if (typeof props.rightLabel == 'function') return props.rightLabel(item)
|
|
168
|
+
if (typeof item === 'string') return item
|
|
169
|
+
return item[props.rightLabel]
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// const getLabel = (item) => {
|
|
173
|
+
// if(typeof props.label == 'function') return props.label(item)
|
|
174
|
+
// if(typeof item === 'string') return item
|
|
175
|
+
// return item[props.label]
|
|
176
|
+
// }
|
|
177
|
+
|
|
178
|
+
const getKeyValue = (item) => {
|
|
179
|
+
if (typeof props.keyValue == 'function') return props.keyValue(item)
|
|
180
|
+
if (typeof item === 'string') return item
|
|
181
|
+
return item[props.keyValue]
|
|
179
182
|
}
|
|
180
|
-
</script>
|
|
183
|
+
</script>
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="psui-el-input"
|
|
4
|
-
:class="[getComponentClass, `layout-${layout}`]"
|
|
5
|
-
>
|
|
2
|
+
<div
|
|
3
|
+
class="psui-el-input"
|
|
4
|
+
:class="[getComponentClass, `layout-${layout}`]"
|
|
5
|
+
>
|
|
6
6
|
<label v-if="label"> {{ label }} </label>
|
|
7
7
|
|
|
8
|
-
<div
|
|
8
|
+
<div
|
|
9
9
|
class="psui-el-input-wrapper"
|
|
10
|
-
@mouseenter="
|
|
11
|
-
@mouseleave="
|
|
10
|
+
@mouseenter="emit('mouseenter', $event)"
|
|
11
|
+
@mouseleave="emit('mouseleave', $event)"
|
|
12
12
|
>
|
|
13
|
-
<div
|
|
14
|
-
v-if="$slots.prepend"
|
|
15
|
-
class="psui-el-input-prepend"
|
|
13
|
+
<div
|
|
14
|
+
v-if="$slots.prepend"
|
|
15
|
+
class="psui-el-input-prepend"
|
|
16
16
|
>
|
|
17
17
|
<slot name="prepend" />
|
|
18
18
|
</div>
|
|
19
|
-
<PsRichTooltip
|
|
19
|
+
<PsRichTooltip
|
|
20
20
|
class="psui-w-full"
|
|
21
21
|
css-class="psui-w-48"
|
|
22
22
|
:ignore-dialog="!showTooltip"
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
:max="maxValue"
|
|
34
34
|
@focus="onInputFocus"
|
|
35
35
|
@blur="onInputBlur"
|
|
36
|
-
@input="
|
|
37
|
-
@keydown="
|
|
38
|
-
@change="
|
|
36
|
+
@input="emit('input', $event)"
|
|
37
|
+
@keydown="emit('keydown', $event)"
|
|
38
|
+
@change="emit('change', $event)"
|
|
39
39
|
v-bind="getAttrs"
|
|
40
|
-
:class="{
|
|
40
|
+
:class="{ focus: isFocus }"
|
|
41
41
|
>
|
|
42
42
|
</template>
|
|
43
43
|
<template #content>
|
|
@@ -46,160 +46,161 @@
|
|
|
46
46
|
</div>
|
|
47
47
|
</template>
|
|
48
48
|
</PsRichTooltip>
|
|
49
|
-
<div
|
|
50
|
-
v-if="$slots.append || hasError"
|
|
51
|
-
class="psui-el-input-append"
|
|
49
|
+
<div
|
|
50
|
+
v-if="$slots.append || hasError"
|
|
51
|
+
class="psui-el-input-append"
|
|
52
52
|
>
|
|
53
|
-
<span
|
|
54
|
-
v-if="hasError"
|
|
55
|
-
class="material-icons psui-text-red-20 material-icons-sharp"
|
|
53
|
+
<span
|
|
54
|
+
v-if="hasError"
|
|
55
|
+
class="material-icons psui-text-red-20 material-icons-sharp"
|
|
56
56
|
>error</span>
|
|
57
|
-
<slot
|
|
58
|
-
|
|
59
|
-
name="append"
|
|
57
|
+
<slot
|
|
58
|
+
name="append"
|
|
60
59
|
/>
|
|
61
60
|
</div>
|
|
62
61
|
</div>
|
|
63
62
|
|
|
64
|
-
<p
|
|
65
|
-
v-if="hint || (hasError && typeof hasError === 'string')"
|
|
66
|
-
class="psui-el-input-hint"
|
|
63
|
+
<p
|
|
64
|
+
v-if="hint || (hasError && typeof hasError === 'string')"
|
|
65
|
+
class="psui-el-input-hint"
|
|
67
66
|
>
|
|
68
67
|
{{ typeof hasError === 'string' ? hasError : hint }}
|
|
69
|
-
</p>
|
|
68
|
+
</p>
|
|
70
69
|
</div>
|
|
71
70
|
</template>
|
|
72
71
|
|
|
73
|
-
<script>
|
|
72
|
+
<script setup>
|
|
74
73
|
import PsRichTooltip from '../tooltip/PsRichTooltip.vue'
|
|
74
|
+
import { ref, computed, useAttrs } from 'vue'
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
const props = defineProps({
|
|
77
|
+
/**
|
|
78
|
+
* It set the title and also its tooltip default behavior
|
|
79
|
+
*/
|
|
80
|
+
title: {
|
|
81
|
+
type: String,
|
|
82
|
+
default: '',
|
|
80
83
|
},
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
default: ''
|
|
88
|
-
},
|
|
89
|
-
/**
|
|
90
|
-
* It sets the type of your button. default: text.
|
|
91
|
-
*/
|
|
92
|
-
type: {
|
|
93
|
-
type: String,
|
|
94
|
-
default: 'text'
|
|
95
|
-
},
|
|
96
|
-
/**
|
|
97
|
-
* It sets a placeholder for your button if needed.
|
|
98
|
-
*/
|
|
99
|
-
placeholder: {
|
|
100
|
-
type: String
|
|
101
|
-
},
|
|
102
|
-
/**
|
|
103
|
-
* It sets the label of the input if needed.
|
|
104
|
-
*/
|
|
105
|
-
label: {
|
|
106
|
-
type: String
|
|
107
|
-
},
|
|
108
|
-
/**
|
|
109
|
-
* It sets a text below the input. See Figma Text fileds & Forms.
|
|
110
|
-
*/
|
|
111
|
-
hint: {
|
|
112
|
-
type: String
|
|
113
|
-
},
|
|
114
|
-
/**
|
|
115
|
-
* It sets the layout of your button. eg: mini and default.
|
|
116
|
-
*/
|
|
117
|
-
layout: {
|
|
118
|
-
type: String,
|
|
119
|
-
default: 'default',
|
|
120
|
-
validator: (value) => ['default', 'mini'].includes(value)
|
|
121
|
-
},
|
|
122
|
-
/**
|
|
123
|
-
* It sets the value of the button.
|
|
124
|
-
*/
|
|
125
|
-
value: {
|
|
126
|
-
required: true,
|
|
127
|
-
},
|
|
128
|
-
/**
|
|
129
|
-
* It disables the input. All mouse events are disabled.
|
|
130
|
-
*/
|
|
131
|
-
disabled: {
|
|
132
|
-
type: Boolean,
|
|
133
|
-
default: false
|
|
134
|
-
},
|
|
135
|
-
/**
|
|
136
|
-
* It sets if the input found any error.
|
|
137
|
-
*/
|
|
138
|
-
hasError: {
|
|
139
|
-
type: [String, Boolean],
|
|
140
|
-
default: false
|
|
141
|
-
},
|
|
142
|
-
/**
|
|
143
|
-
* It sets a active css class based on a boolean property.
|
|
144
|
-
*/
|
|
145
|
-
active: {
|
|
146
|
-
type: Boolean,
|
|
147
|
-
default: false
|
|
148
|
-
},
|
|
149
|
-
minValue: {
|
|
150
|
-
type: null
|
|
151
|
-
},
|
|
152
|
-
maxValue: {
|
|
153
|
-
type: null
|
|
154
|
-
},
|
|
155
|
-
step:{
|
|
156
|
-
type: null
|
|
157
|
-
},
|
|
158
|
-
showTooltip: {
|
|
159
|
-
type: Boolean,
|
|
160
|
-
default: false,
|
|
161
|
-
},
|
|
162
|
-
tooltipText: {
|
|
163
|
-
type: String,
|
|
164
|
-
default: '',
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
data: () => ({
|
|
168
|
-
isFocus: false,
|
|
169
|
-
}),
|
|
170
|
-
computed: {
|
|
171
|
-
getAttrs() {
|
|
172
|
-
const defaultAttrs = {
|
|
173
|
-
autocapitalize: 'sentences',
|
|
174
|
-
autocomplete: 'chrome-off',
|
|
175
|
-
autocorrect: 'off',
|
|
176
|
-
spellcheck: 'spellcheck'
|
|
177
|
-
}
|
|
178
|
-
return { ...defaultAttrs, ...this.$attrs }
|
|
179
|
-
},
|
|
180
|
-
getComponentClass() {
|
|
181
|
-
if (this.disabled) {
|
|
182
|
-
return 'status-disabled'
|
|
183
|
-
} else if (this.hasError) {
|
|
184
|
-
return 'status-error'
|
|
185
|
-
} else if (this.isFocus || this.isTyping || this.active ) {
|
|
186
|
-
return 'status-active'
|
|
187
|
-
} else {
|
|
188
|
-
return 'status-resting'
|
|
189
|
-
}
|
|
190
|
-
},
|
|
84
|
+
/**
|
|
85
|
+
* It sets the type of your button. default: text.
|
|
86
|
+
*/
|
|
87
|
+
type: {
|
|
88
|
+
type: String,
|
|
89
|
+
default: 'text',
|
|
191
90
|
},
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
91
|
+
/**
|
|
92
|
+
* It sets a placeholder for your button if needed.
|
|
93
|
+
*/
|
|
94
|
+
placeholder: {
|
|
95
|
+
type: String,
|
|
96
|
+
default: '',
|
|
97
|
+
},
|
|
98
|
+
/**
|
|
99
|
+
* It sets the label of the input if needed.
|
|
100
|
+
*/
|
|
101
|
+
label: {
|
|
102
|
+
type: String,
|
|
103
|
+
default: '',
|
|
104
|
+
},
|
|
105
|
+
/**
|
|
106
|
+
* It sets a text below the input. See Figma Text fileds & Forms.
|
|
107
|
+
*/
|
|
108
|
+
hint: {
|
|
109
|
+
type: String,
|
|
110
|
+
default: '',
|
|
111
|
+
},
|
|
112
|
+
/**
|
|
113
|
+
* It sets the layout of your button. eg: mini and default.
|
|
114
|
+
*/
|
|
115
|
+
layout: {
|
|
116
|
+
type: String,
|
|
117
|
+
default: 'default',
|
|
118
|
+
validator: (value) => ['default', 'mini'].includes(value),
|
|
119
|
+
},
|
|
120
|
+
/**
|
|
121
|
+
* It sets the value of the button.
|
|
122
|
+
*/
|
|
123
|
+
value: {
|
|
124
|
+
required: true,
|
|
125
|
+
},
|
|
126
|
+
/**
|
|
127
|
+
* It disables the input. All mouse events are disabled.
|
|
128
|
+
*/
|
|
129
|
+
disabled: {
|
|
130
|
+
type: Boolean,
|
|
131
|
+
default: false,
|
|
132
|
+
},
|
|
133
|
+
/**
|
|
134
|
+
* It sets if the input found any error.
|
|
135
|
+
*/
|
|
136
|
+
hasError: {
|
|
137
|
+
type: [String, Boolean],
|
|
138
|
+
default: false,
|
|
139
|
+
},
|
|
140
|
+
/**
|
|
141
|
+
* It sets a active css class based on a boolean property.
|
|
142
|
+
*/
|
|
143
|
+
active: {
|
|
144
|
+
type: Boolean,
|
|
145
|
+
default: false,
|
|
146
|
+
},
|
|
147
|
+
minValue: {
|
|
148
|
+
type: null,
|
|
149
|
+
},
|
|
150
|
+
maxValue: {
|
|
151
|
+
type: null,
|
|
152
|
+
},
|
|
153
|
+
step: {
|
|
154
|
+
type: null,
|
|
155
|
+
},
|
|
156
|
+
showTooltip: {
|
|
157
|
+
type: Boolean,
|
|
158
|
+
default: false,
|
|
159
|
+
},
|
|
160
|
+
tooltipText: {
|
|
161
|
+
type: String,
|
|
162
|
+
default: '',
|
|
163
|
+
},
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
const emit = defineEmits(['focus', 'blur', 'mouseenter', 'mouseleave', 'input', 'keydown', 'change'])
|
|
167
|
+
|
|
168
|
+
const isFocus = ref(false)
|
|
169
|
+
const attrs = useAttrs()
|
|
170
|
+
|
|
171
|
+
const getAttrs = computed(() => {
|
|
172
|
+
const defaultAttrs = {
|
|
173
|
+
autocapitalize: 'sentences',
|
|
174
|
+
autocomplete: 'chrome-off',
|
|
175
|
+
autocorrect: 'off',
|
|
176
|
+
spellcheck: 'spellcheck',
|
|
201
177
|
}
|
|
178
|
+
return { ...defaultAttrs, ...attrs }
|
|
179
|
+
})
|
|
180
|
+
|
|
181
|
+
const getComponentClass = computed(() => {
|
|
182
|
+
if (props.disabled) {
|
|
183
|
+
return 'status-disabled'
|
|
184
|
+
} else if (props.hasError) {
|
|
185
|
+
return 'status-error'
|
|
186
|
+
} else if (isFocus.value || props.active) {
|
|
187
|
+
return 'status-active'
|
|
188
|
+
} else {
|
|
189
|
+
return 'status-resting'
|
|
190
|
+
}
|
|
191
|
+
})
|
|
192
|
+
|
|
193
|
+
const onInputFocus = ($event) => {
|
|
194
|
+
isFocus.value = true
|
|
195
|
+
emit('focus', $event)
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const onInputBlur = ($event) => {
|
|
199
|
+
isFocus.value = false
|
|
200
|
+
emit('blur', $event)
|
|
202
201
|
}
|
|
203
202
|
</script>
|
|
204
203
|
|
|
205
|
-
<style>
|
|
204
|
+
<style>
|
|
205
|
+
/* Please, use the file src/assets/scss/components/PsInput.scss */
|
|
206
|
+
</style>
|