@policystudio/policy-studio-ui-vue 1.1.90-beta.3 → 1.1.90-beta.30
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 +13 -8
- package/.github/workflows/deploy-storybook.yml +4 -4
- package/.nvmrc +1 -0
- package/dist/css/psui_styles_output.css +6994 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +104 -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/package.json +24 -37
- package/src/App.vue +30 -0
- package/src/assets/scss/components/PsDataTable.scss +1 -1
- package/src/assets/scss/components/PsDropdownList.scss +1 -1
- package/src/components/accordion/PsAccordionItem.vue +88 -74
- package/src/components/badges-and-tags/PsBadgeWithIcon.vue +31 -33
- 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 +60 -61
- package/src/components/chips/PsChips.vue +98 -101
- 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 +59 -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 +165 -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 +456 -466
- 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 +131 -129
- package/src/index.ts +156 -0
- package/src/tsconfig.json +12 -0
- package/src/types/index.d.ts +6 -0
- package/src/util/GeneralFunctions.js +16 -7
- package/src/util/directives.ts +24 -0
- package/src/util/imageLoader.js +14 -7
- package/tailwind.config.js +1 -1
- package/tsconfig.json +47 -0
- package/.storybook/PolicyStudio.js +0 -10
- package/.storybook/eventBus.js +0 -26
- package/.storybook/main.js +0 -21
- package/.storybook/manager.js +0 -6
- package/.storybook/preview.js +0 -17
- package/babel.config.js +0 -17
- package/dist/css/psui_styles.css +0 -4647
- package/postcss.config.js +0 -8
- package/src/assets/images/multifamily-units.svg +0 -10
- package/src/assets/images/policy-studio.svg +0 -15
- package/src/components/playground/PsScrollBar.vue +0 -320
- package/src/contents/ComparisonData.js +0 -378
- package/src/contents/FlexibleData.js +0 -502
- package/src/contents/ResultsData.js +0 -531
- package/src/index.js +0 -166
- package/src/stories/Accordion.stories.js +0 -59
- package/src/stories/BadgeWithIcon.stories.js +0 -31
- package/src/stories/BarChart.stories.js +0 -17
- package/src/stories/Breadcrumb.stories.js +0 -25
- package/src/stories/Button.stories.js +0 -48
- package/src/stories/Button.vue +0 -59
- package/src/stories/CardInfos.stories.js +0 -16
- package/src/stories/ChartLegend.stories.js +0 -16
- package/src/stories/Checkbox.stories.js +0 -45
- package/src/stories/CheckboxSimple.stories.js +0 -49
- package/src/stories/Chips.stories.js +0 -31
- package/src/stories/ClimateZoneBadge.stories.js +0 -17
- package/src/stories/Colors.mdx +0 -70
- package/src/stories/CostEffectBar.stories.js +0 -23
- package/src/stories/Datatable.stories.js +0 -50
- package/src/stories/DateCardInfo.stories.js +0 -24
- package/src/stories/Dialog.stories.js +0 -131
- package/src/stories/Draggable.stories.js +0 -22
- package/src/stories/Dropdown.stories.js +0 -99
- package/src/stories/DropdownList.stories.js +0 -211
- package/src/stories/ElevationSystem.mdx +0 -41
- package/src/stories/Header.stories.js +0 -41
- package/src/stories/Header.vue +0 -77
- package/src/stories/HighlightRippleDot.stories.js +0 -15
- package/src/stories/Icon.stories.js +0 -21
- package/src/stories/InlineSelector.stories.js +0 -18
- package/src/stories/Input.stories.js +0 -240
- package/src/stories/InputSelect.stories.js +0 -30
- package/src/stories/InputTextArea.stories.js +0 -25
- package/src/stories/Introduction.mdx +0 -211
- package/src/stories/MiniTag.stories.js +0 -52
- package/src/stories/Playground.stories.js +0 -16
- package/src/stories/ProgressBar.stories.js +0 -23
- package/src/stories/RadioButton.stories.js +0 -40
- package/src/stories/RadioButtonSimple.stories.js +0 -43
- package/src/stories/SimpleAlert.stories.js +0 -21
- package/src/stories/Slider.stories.js +0 -75
- package/src/stories/Switch.stories.js +0 -39
- package/src/stories/TabHeader.stories.js +0 -52
- package/src/stories/TableResults.stories.js +0 -724
- package/src/stories/TagScope.stories.js +0 -17
- package/src/stories/TestimonialCard.stories.js +0 -27
- package/src/stories/Toast.stories.js +0 -52
- package/src/stories/Toggle.stories.js +0 -45
- package/src/stories/Tooltip.stories.js +0 -114
- package/src/stories/Typography.mdx +0 -212
- package/src/stories/assets/code-brackets.svg +0 -1
- package/src/stories/assets/colors.svg +0 -1
- package/src/stories/assets/comments.svg +0 -1
- package/src/stories/assets/direction.svg +0 -1
- package/src/stories/assets/flow.svg +0 -1
- package/src/stories/assets/plugin.svg +0 -1
- package/src/stories/assets/repo.svg +0 -1
- package/src/stories/assets/stackalt.svg +0 -1
- package/src/stories/button.css +0 -30
- package/src/stories/header.css +0 -32
- package/webpack.config.js +0 -22
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
3
|
class="psui-el-inline-selector"
|
|
4
|
-
@keydown.up="
|
|
5
|
-
@keydown.down="
|
|
6
|
-
@keydown.enter="
|
|
7
|
-
@keydown.tab="
|
|
8
|
-
@keydown.esc="
|
|
9
|
-
@mouseleave="
|
|
4
|
+
@keydown.up="emit('keydown-up', $event)"
|
|
5
|
+
@keydown.down="emit('keydown-down', $event)"
|
|
6
|
+
@keydown.enter="emit('keydown-enter', $event)"
|
|
7
|
+
@keydown.tab="emit('keydown-tab', $event)"
|
|
8
|
+
@keydown.esc="emit('keydown-esc', $event)"
|
|
9
|
+
@mouseleave="emit('mouse-leave', $event)"
|
|
10
10
|
>
|
|
11
11
|
<div class="psui-el-inline-selector-input-wrapper">
|
|
12
12
|
<span> {{ search ? search : placeholder }} </span>
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
ref="input"
|
|
15
15
|
:label="label"
|
|
16
16
|
:placeholder="placeholder"
|
|
17
|
-
@input="
|
|
18
|
-
@focus="
|
|
19
|
-
@blur="
|
|
17
|
+
@input="emit('input', $event)"
|
|
18
|
+
@focus="emit('focus', $event)"
|
|
19
|
+
@blur="emit('blur', $event)"
|
|
20
20
|
autocomplete="chrome-off"
|
|
21
21
|
autocorrect="off"
|
|
22
22
|
autocapitalize="off"
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
leave-class="opacity-100 scale-100"
|
|
32
32
|
leave-to-class="opacity-0 scale-95"
|
|
33
33
|
>
|
|
34
|
-
<div
|
|
34
|
+
<div
|
|
35
35
|
v-if="search"
|
|
36
|
-
role="menu"
|
|
36
|
+
role="menu"
|
|
37
37
|
aria-orientation="vertical"
|
|
38
38
|
class="psui-el-inline-selector-dropdown-wrapper"
|
|
39
39
|
>
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
v-for="(jurisdiction, index) in jurisdictions"
|
|
50
50
|
:key="`dropdown-jurisdiction-${jurisdiction.id}`"
|
|
51
51
|
:id="`jurisdiction-list-item-${index}`"
|
|
52
|
-
@click="
|
|
53
|
-
@mouseover="
|
|
52
|
+
@click="emit('click', $event)"
|
|
53
|
+
@mouseover="'mouse-over', $event"
|
|
54
54
|
>
|
|
55
55
|
<span>
|
|
56
56
|
<h3>{{ jurisdiction.title }}</h3>
|
|
@@ -64,89 +64,88 @@
|
|
|
64
64
|
</div>
|
|
65
65
|
</template>
|
|
66
66
|
|
|
67
|
-
<script>
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
props: {
|
|
71
|
-
/**
|
|
72
|
-
* It sets the default width of the inline selector.
|
|
73
|
-
*/
|
|
74
|
-
width: {
|
|
75
|
-
default: 244
|
|
76
|
-
},
|
|
77
|
-
/**
|
|
78
|
-
* It sets if it should receive focus or not when componented is mounted.
|
|
79
|
-
*/
|
|
80
|
-
focusOnMount: {
|
|
81
|
-
default: false
|
|
82
|
-
},
|
|
83
|
-
/**
|
|
84
|
-
* It sets if the component should be scrollable.
|
|
85
|
-
*/
|
|
86
|
-
shouldScroll: {
|
|
87
|
-
default: false
|
|
88
|
-
},
|
|
89
|
-
/**
|
|
90
|
-
* It sets the label of the component.
|
|
91
|
-
*/
|
|
92
|
-
label: {
|
|
93
|
-
type: String,
|
|
94
|
-
default: 'Type a City or County'
|
|
95
|
-
},
|
|
96
|
-
selectOnlyFirstClimateZone: {
|
|
97
|
-
type: Boolean,
|
|
98
|
-
default: false
|
|
99
|
-
},
|
|
100
|
-
/**
|
|
101
|
-
* It sets the jurisdiction selected.
|
|
102
|
-
*/
|
|
103
|
-
jurisdictionSelected: {
|
|
104
|
-
type: [ Object, Boolean ]
|
|
105
|
-
},
|
|
106
|
-
/**
|
|
107
|
-
* It gets and set the data that was written.
|
|
108
|
-
*/
|
|
109
|
-
search: {
|
|
110
|
-
type: String,
|
|
111
|
-
default: '',
|
|
112
|
-
required: true
|
|
113
|
-
},
|
|
114
|
-
/**
|
|
115
|
-
* It provides all the jurisdictions.
|
|
116
|
-
*/
|
|
117
|
-
jurisdictions: {
|
|
118
|
-
type: Array,
|
|
119
|
-
default: () => [],
|
|
120
|
-
required: true
|
|
121
|
-
},
|
|
122
|
-
/**
|
|
123
|
-
* It is a helper for checking if fetching data was successful.
|
|
124
|
-
*/
|
|
125
|
-
requestFetched: {
|
|
126
|
-
type: Boolean,
|
|
127
|
-
},
|
|
128
|
-
showDropDown:{
|
|
129
|
-
type: Boolean,
|
|
130
|
-
default: true,
|
|
131
|
-
},
|
|
132
|
-
currentSelected:{
|
|
133
|
-
type: Number,
|
|
134
|
-
default: 0,
|
|
135
|
-
},
|
|
136
|
-
/**
|
|
137
|
-
* It sets if the component is focused or not.
|
|
138
|
-
*/
|
|
139
|
-
isFocused:{
|
|
140
|
-
type: Boolean,
|
|
141
|
-
default: false,
|
|
142
|
-
},
|
|
143
|
-
/**
|
|
144
|
-
* It sets the placeholder of the component.
|
|
145
|
-
*/
|
|
146
|
-
placeholder:{
|
|
147
|
-
type: String,
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
</script>
|
|
67
|
+
<script setup>
|
|
68
|
+
|
|
69
|
+
const emit = defineEmits(['keydown-up', 'keydown-down', 'keydown-enter', 'keydown-tab', 'keydown-esc', 'mouse-leave', 'input', 'focus', 'blur', 'click'])
|
|
152
70
|
|
|
71
|
+
defineProps({
|
|
72
|
+
/**
|
|
73
|
+
* It sets the default width of the inline selector.
|
|
74
|
+
*/
|
|
75
|
+
width: {
|
|
76
|
+
default: 244,
|
|
77
|
+
},
|
|
78
|
+
/**
|
|
79
|
+
* It sets if it should receive focus or not when componented is mounted.
|
|
80
|
+
*/
|
|
81
|
+
focusOnMount: {
|
|
82
|
+
default: false,
|
|
83
|
+
},
|
|
84
|
+
/**
|
|
85
|
+
* It sets if the component should be scrollable.
|
|
86
|
+
*/
|
|
87
|
+
shouldScroll: {
|
|
88
|
+
default: false,
|
|
89
|
+
},
|
|
90
|
+
/**
|
|
91
|
+
* It sets the label of the component.
|
|
92
|
+
*/
|
|
93
|
+
label: {
|
|
94
|
+
type: String,
|
|
95
|
+
default: 'Type a City or County',
|
|
96
|
+
},
|
|
97
|
+
selectOnlyFirstClimateZone: {
|
|
98
|
+
type: Boolean,
|
|
99
|
+
default: false,
|
|
100
|
+
},
|
|
101
|
+
/**
|
|
102
|
+
* It sets the jurisdiction selected.
|
|
103
|
+
*/
|
|
104
|
+
jurisdictionSelected: {
|
|
105
|
+
type: [Object, Boolean],
|
|
106
|
+
},
|
|
107
|
+
/**
|
|
108
|
+
* It gets and set the data that was written.
|
|
109
|
+
*/
|
|
110
|
+
search: {
|
|
111
|
+
type: String,
|
|
112
|
+
default: '',
|
|
113
|
+
required: true,
|
|
114
|
+
},
|
|
115
|
+
/**
|
|
116
|
+
* It provides all the jurisdictions.
|
|
117
|
+
*/
|
|
118
|
+
jurisdictions: {
|
|
119
|
+
type: Array,
|
|
120
|
+
default: () => [],
|
|
121
|
+
required: true,
|
|
122
|
+
},
|
|
123
|
+
/**
|
|
124
|
+
* It is a helper for checking if fetching data was successful.
|
|
125
|
+
*/
|
|
126
|
+
requestFetched: {
|
|
127
|
+
type: Boolean,
|
|
128
|
+
},
|
|
129
|
+
showDropDown: {
|
|
130
|
+
type: Boolean,
|
|
131
|
+
default: true,
|
|
132
|
+
},
|
|
133
|
+
currentSelected: {
|
|
134
|
+
type: Number,
|
|
135
|
+
default: 0,
|
|
136
|
+
},
|
|
137
|
+
/**
|
|
138
|
+
* It sets if the component is focused or not.
|
|
139
|
+
*/
|
|
140
|
+
isFocused: {
|
|
141
|
+
type: Boolean,
|
|
142
|
+
default: false,
|
|
143
|
+
},
|
|
144
|
+
/**
|
|
145
|
+
* It sets the placeholder of the component.
|
|
146
|
+
*/
|
|
147
|
+
placeholder: {
|
|
148
|
+
type: String,
|
|
149
|
+
},
|
|
150
|
+
})
|
|
151
|
+
</script>
|
|
@@ -1,76 +1,77 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
3
|
class="psui-el-radio"
|
|
4
|
-
:class="[getComponentClass, {
|
|
4
|
+
:class="[getComponentClass, { disabled: disabled }]"
|
|
5
5
|
>
|
|
6
6
|
<input
|
|
7
7
|
:id="inputId"
|
|
8
8
|
type="radio"
|
|
9
9
|
:value="inputValue"
|
|
10
10
|
v-model="model"
|
|
11
|
-
:disabled="disabled"
|
|
11
|
+
:disabled="disabled"
|
|
12
12
|
>
|
|
13
13
|
<label
|
|
14
14
|
:for="inputId"
|
|
15
15
|
class="psui-el-checkmark"
|
|
16
|
-
><span>{{ label }}</span></label>
|
|
16
|
+
><span>{{ label }}</span></label>
|
|
17
17
|
</div>
|
|
18
18
|
</template>
|
|
19
|
-
|
|
20
|
-
<script>
|
|
19
|
+
|
|
20
|
+
<script setup>
|
|
21
21
|
//FIGMA CONTROLS & SELECTORS https://www.figma.com/file/Tto8hrNlSfuPcwd1pfqogF/%E2%9A%A1%EF%B8%8F-Design-System?node-id=1768%3A64852
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
default: ''
|
|
29
|
-
},
|
|
30
|
-
/**
|
|
31
|
-
* It sets the label of the radio button.
|
|
32
|
-
*/
|
|
33
|
-
label: {
|
|
34
|
-
type: String,
|
|
35
|
-
default: '',
|
|
36
|
-
},
|
|
37
|
-
/**
|
|
38
|
-
* It's the value of the checkbox
|
|
39
|
-
*/
|
|
40
|
-
inputValue:{
|
|
41
|
-
type: [String, Object],
|
|
42
|
-
},
|
|
43
|
-
value:{
|
|
44
|
-
type: [String, Object]
|
|
45
|
-
},
|
|
46
|
-
/**
|
|
47
|
-
* It disables the radio button. All mouse events are disabled.
|
|
48
|
-
*/
|
|
49
|
-
disabled: {
|
|
50
|
-
type: Boolean,
|
|
51
|
-
default: false
|
|
52
|
-
},
|
|
53
|
-
/**
|
|
54
|
-
* It sets the size of the radio button. eg: big and small.
|
|
55
|
-
*/
|
|
56
|
-
size: {
|
|
57
|
-
type: String,
|
|
58
|
-
default: 'big',
|
|
59
|
-
validator: (value) => ['big', 'small'].includes(value)
|
|
60
|
-
},
|
|
22
|
+
import { computed } from 'vue'
|
|
23
|
+
|
|
24
|
+
const props = defineProps({
|
|
25
|
+
inputId: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: '',
|
|
61
28
|
},
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return this.value
|
|
69
|
-
},
|
|
70
|
-
set(value){
|
|
71
|
-
this.$emit('input', value)
|
|
72
|
-
}
|
|
73
|
-
}
|
|
29
|
+
/**
|
|
30
|
+
* It sets the label of the radio button.
|
|
31
|
+
*/
|
|
32
|
+
label: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: '',
|
|
74
35
|
},
|
|
75
|
-
|
|
76
|
-
|
|
36
|
+
/**
|
|
37
|
+
* It's the value of the checkbox
|
|
38
|
+
*/
|
|
39
|
+
inputValue: {
|
|
40
|
+
type: [String, Object],
|
|
41
|
+
default: '',
|
|
42
|
+
},
|
|
43
|
+
value: {
|
|
44
|
+
type: [String, Object],
|
|
45
|
+
default: '',
|
|
46
|
+
},
|
|
47
|
+
/**
|
|
48
|
+
* It disables the radio button. All mouse events are disabled.
|
|
49
|
+
*/
|
|
50
|
+
disabled: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: false,
|
|
53
|
+
},
|
|
54
|
+
/**
|
|
55
|
+
* It sets the size of the radio button. eg: big and small.
|
|
56
|
+
*/
|
|
57
|
+
size: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: 'big',
|
|
60
|
+
validator: (value) => ['big', 'small'].includes(value),
|
|
61
|
+
},
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
const emit = defineEmits(['input'])
|
|
65
|
+
const getComponentClass = computed(() => {
|
|
66
|
+
return `size-${props.size}`
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
const model = computed({
|
|
70
|
+
get: () => {
|
|
71
|
+
return props.value
|
|
72
|
+
},
|
|
73
|
+
set: (value) => {
|
|
74
|
+
emit('input', value)
|
|
75
|
+
},
|
|
76
|
+
})
|
|
77
|
+
</script>
|
|
@@ -1,97 +1,101 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="psui-el-radio"
|
|
4
|
-
:class="[getComponentClass, {
|
|
2
|
+
<div
|
|
3
|
+
class="psui-el-radio"
|
|
4
|
+
:class="[getComponentClass, { disabled: disabled }]"
|
|
5
5
|
v-bind="getComponentAttrs"
|
|
6
6
|
>
|
|
7
|
-
<input
|
|
8
|
-
type="radio"
|
|
9
|
-
:checked="checked"
|
|
7
|
+
<input
|
|
8
|
+
type="radio"
|
|
9
|
+
:checked="checked"
|
|
10
10
|
:disabled="disabled"
|
|
11
11
|
:label="label"
|
|
12
12
|
:name="name"
|
|
13
13
|
:id="getInputId"
|
|
14
14
|
v-bind="inputAttrs"
|
|
15
|
-
@change="
|
|
15
|
+
@change="emit('change')"
|
|
16
16
|
>
|
|
17
|
-
<label
|
|
17
|
+
<label
|
|
18
18
|
:for="getInputId"
|
|
19
19
|
class="psui-el-checkmark"
|
|
20
20
|
>
|
|
21
21
|
<slot name="content">
|
|
22
22
|
<span>{{ label }}</span>
|
|
23
23
|
</slot>
|
|
24
|
-
</label>
|
|
24
|
+
</label>
|
|
25
25
|
</div>
|
|
26
26
|
</template>
|
|
27
27
|
|
|
28
|
-
<script>
|
|
29
|
-
import { randomString } from '../../util/GeneralFunctions'
|
|
28
|
+
<script setup>
|
|
29
|
+
import { randomString } from '../../util/GeneralFunctions.js'
|
|
30
|
+
import { computed, useAttrs } from 'vue'
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
* It set the of the checkbox input. eg: big and small.
|
|
66
|
-
*/
|
|
67
|
-
size: {
|
|
68
|
-
type: String,
|
|
69
|
-
default: 'big',
|
|
70
|
-
validator: (value)=> ['big', 'small'].includes(value)
|
|
71
|
-
},
|
|
72
|
-
/**
|
|
73
|
-
* It set the layout of the checkbox input. eg: default and mixed.
|
|
74
|
-
*/
|
|
32
|
+
const emit = defineEmits(['change'])
|
|
33
|
+
|
|
34
|
+
const props = defineProps({
|
|
35
|
+
/**
|
|
36
|
+
* It sets the label of the checkbox input.
|
|
37
|
+
*/
|
|
38
|
+
label: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: '',
|
|
41
|
+
},
|
|
42
|
+
name: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: '',
|
|
45
|
+
},
|
|
46
|
+
/**
|
|
47
|
+
* It disables the checkbox input.
|
|
48
|
+
*/
|
|
49
|
+
disabled: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: false,
|
|
52
|
+
},
|
|
53
|
+
/**
|
|
54
|
+
* Sets the input as checked
|
|
55
|
+
*/
|
|
56
|
+
checked: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
default: false,
|
|
59
|
+
},
|
|
60
|
+
/**
|
|
61
|
+
* Add html attributes to the element input
|
|
62
|
+
*/
|
|
63
|
+
inputAttrs: {
|
|
64
|
+
type: Object,
|
|
65
|
+
default: () => ({}),
|
|
75
66
|
},
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return this.inputAttrs.id
|
|
84
|
-
} else if (this?.$attrs?.id) {
|
|
85
|
-
return this.$attrs.id
|
|
86
|
-
} else {
|
|
87
|
-
return randomString(16)
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
getComponentAttrs() {
|
|
91
|
-
let componentAttrs = { ... this.$attrs }
|
|
92
|
-
delete componentAttrs.id
|
|
93
|
-
return componentAttrs
|
|
94
|
-
}
|
|
67
|
+
/**
|
|
68
|
+
* It set the of the checkbox input. eg: big and small.
|
|
69
|
+
*/
|
|
70
|
+
size: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: 'big',
|
|
73
|
+
validator: (value) => ['big', 'small'].includes(value),
|
|
95
74
|
},
|
|
96
|
-
|
|
75
|
+
/**
|
|
76
|
+
* It set the layout of the checkbox input. eg: default and mixed.
|
|
77
|
+
*/
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
const attrs = useAttrs()
|
|
81
|
+
|
|
82
|
+
const getComponentClass = computed(() => {
|
|
83
|
+
return `size-${props.size}`
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
const getInputId = computed(() => {
|
|
87
|
+
if (props?.inputAttrs?.id) {
|
|
88
|
+
return props.inputAttrs.id
|
|
89
|
+
} else if (attrs?.id) {
|
|
90
|
+
return attrs.id
|
|
91
|
+
} else {
|
|
92
|
+
return randomString(16)
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
const getComponentAttrs = computed(() => {
|
|
97
|
+
let componentAttrs = { ...attrs }
|
|
98
|
+
delete componentAttrs.id
|
|
99
|
+
return componentAttrs
|
|
100
|
+
})
|
|
97
101
|
</script>
|