@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.
- package/.eslintignore +1 -0
- package/.eslintrc.js +75 -67
- package/.github/workflows/deploy-storybook.yml +5 -5
- package/.nvmrc +1 -0
- package/dist/css/psui_styles_output.css +6638 -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/doc/.storybook/PolicyStudio.ts +11 -0
- package/doc/.storybook/main.ts +27 -0
- package/doc/.storybook/manager.ts +7 -0
- package/{.storybook/preview.js → doc/.storybook/preview.ts} +2 -3
- package/doc/package-lock.json +22653 -0
- package/doc/package.json +71 -0
- package/doc/shims-vue.d.ts +6 -0
- package/{src/stories/Accordion.stories.js → doc/src/stories/Accordion.stories.ts} +4 -5
- package/{src/stories/BadgeWithIcon.stories.js → doc/src/stories/BadgeWithIcon.stories.ts} +2 -2
- package/{src/stories/BarChart.stories.js → doc/src/stories/BarChart.stories.ts} +2 -2
- package/{src/stories/Breadcrumb.stories.js → doc/src/stories/Breadcrumb.stories.ts} +2 -5
- package/{src/stories/Button.stories.js → doc/src/stories/Button.stories.ts} +130 -130
- package/{src/stories/CardInfos.stories.js → doc/src/stories/CardInfos.stories.ts} +2 -3
- package/{src/stories/ChartLegend.stories.js → doc/src/stories/ChartLegend.stories.ts} +2 -3
- package/{src/stories/Checkbox.stories.js → doc/src/stories/Checkbox.stories.ts} +2 -2
- package/{src/stories/CheckboxSimple.stories.js → doc/src/stories/CheckboxSimple.stories.ts} +2 -2
- package/{src/stories/Chips.stories.js → doc/src/stories/Chips.stories.ts} +22 -23
- package/{src/stories/ClimateZoneBadge.stories.js → doc/src/stories/ClimateZoneBadge.stories.ts} +3 -2
- package/doc/src/stories/Collapse.stories.ts +46 -0
- package/{src/stories/CostEffectBar.stories.js → doc/src/stories/CostEffectBar.stories.ts} +3 -2
- package/{src/stories/Datatable.stories.js → doc/src/stories/Datatable.stories.ts} +7 -4
- package/{src/stories/DateCardInfo.stories.js → doc/src/stories/DateCardInfo.stories.ts} +2 -6
- package/{src/stories/Dialog.stories.js → doc/src/stories/Dialog.stories.ts} +2 -2
- package/{src/stories/Draggable.stories.js → doc/src/stories/Draggable.stories.ts} +3 -2
- package/{src/stories/Dropdown.stories.js → doc/src/stories/Dropdown.stories.ts} +4 -3
- package/{src/stories/DropdownList.stories.js → doc/src/stories/DropdownList.stories.ts} +4 -2
- package/{src/stories/ElevationSystem.stories.mdx → doc/src/stories/ElevationSystem.mdx} +1 -1
- package/{src/stories/HighlightRippleDot.stories.js → doc/src/stories/HighlightRippleDot.stories.ts} +3 -2
- package/{src/stories/Icon.stories.js → doc/src/stories/Icon.stories.ts} +3 -1
- package/{src/stories/InlineSelector.stories.js → doc/src/stories/InlineSelector.stories.ts} +2 -2
- package/{src/stories/Input.stories.js → doc/src/stories/Input.stories.ts} +7 -4
- package/{src/stories/InputSelect.stories.js → doc/src/stories/InputSelect.stories.ts} +3 -2
- package/{src/stories/InputTextArea.stories.js → doc/src/stories/InputTextArea.stories.ts} +2 -2
- package/{src/stories/Introduction.stories.mdx → doc/src/stories/Introduction.mdx} +101 -101
- package/{src/stories/MiniTag.stories.js → doc/src/stories/MiniTag.stories.ts} +9 -2
- package/{src/stories/ProgressBar.stories.js → doc/src/stories/ProgressBar.stories.ts} +3 -2
- package/{src/stories/RadioButton.stories.js → doc/src/stories/RadioButton.stories.ts} +2 -2
- package/{src/stories/RadioButtonSimple.stories.js → doc/src/stories/RadioButtonSimple.stories.ts} +2 -2
- package/{src/stories/SimpleAlert.stories.js → doc/src/stories/SimpleAlert.stories.ts} +3 -2
- package/{src/stories/Slider.stories.js → doc/src/stories/Slider.stories.ts} +6 -2
- package/{src/stories/Switch.stories.js → doc/src/stories/Switch.stories.ts} +2 -2
- package/{src/stories/TabHeader.stories.js → doc/src/stories/TabHeader.stories.ts} +6 -1
- package/{src/stories/TableResults.stories.js → doc/src/stories/TableResults.stories.ts} +11 -7
- package/{src/stories/TagScope.stories.js → doc/src/stories/TagScope.stories.ts} +3 -2
- package/{src/stories/TestimonialCard.stories.js → doc/src/stories/TestimonialCard.stories.ts} +3 -3
- package/{src/stories/Toast.stories.js → doc/src/stories/Toast.stories.ts} +2 -2
- package/{src/stories/Toggle.stories.js → doc/src/stories/Toggle.stories.ts} +7 -4
- package/{src/stories/Tooltip.stories.js → doc/src/stories/Tooltip.stories.ts} +6 -6
- package/{src/stories/Typography.stories.mdx → doc/src/stories/Typography.mdx} +107 -105
- package/doc/tsconfig.json +17 -0
- package/package.json +43 -39
- package/scripts/gulp.js +11 -0
- package/scripts/kill-port.sh +12 -0
- package/src/App.vue +30 -0
- package/src/assets/scss/base.scss +3 -30
- package/src/assets/scss/components/PsAccordion.scss +12 -2
- package/src/assets/scss/components/PsButton.scss +7 -1
- package/src/assets/scss/components/PsChips.scss +12 -7
- package/src/assets/scss/components/PsCollapse.scss +71 -0
- package/src/assets/scss/components/PsCostEffectBar.scss +4 -4
- package/src/assets/scss/components/PsDataTable.scss +1 -1
- package/src/assets/scss/components/PsDateCardInfo.scss +4 -5
- package/src/assets/scss/components/PsDialog.scss +7 -0
- package/src/assets/scss/components/PsDropdownList.scss +1 -1
- package/src/assets/scss/components/PsInput.scss +10 -0
- package/src/assets/scss/components/PsProgressBar.scss +4 -4
- package/src/assets/scss/components/PsSwitch.scss +10 -0
- package/src/assets/scss/components/PsTabHeader.scss +64 -2
- package/src/assets/scss/components/PsTableResults.scss +51 -82
- package/src/assets/scss/components/PsTestimonialCard.scss +1 -1
- package/src/assets/scss/components/PsTooltip.scss +149 -145
- package/src/components/accordion/PsAccordion.vue +20 -21
- package/src/components/accordion/PsAccordionItem.vue +122 -81
- package/src/components/badges-and-tags/PsBadgeWithIcon.vue +37 -36
- package/src/components/badges-and-tags/PsCardInfos.vue +40 -40
- package/src/components/badges-and-tags/PsChartLegend.vue +50 -41
- package/src/components/badges-and-tags/PsClimateZoneBadge.vue +13 -19
- package/src/components/badges-and-tags/PsCostEffectBar.vue +28 -61
- package/src/components/badges-and-tags/PsDateCardInfo.vue +17 -18
- package/src/components/badges-and-tags/PsHighlightRippleDot.vue +4 -3
- 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 +25 -30
- package/src/components/buttons/PsButton.vue +90 -98
- package/src/components/chips/PsChips.vue +118 -103
- package/src/components/collapse/PsCollapse.vue +124 -0
- package/src/components/controls/PsCheckbox.vue +86 -83
- package/src/components/controls/PsCheckboxSimple.vue +97 -97
- package/src/components/controls/PsDraggable.vue +100 -99
- package/src/components/controls/PsInlineSelector.vue +111 -113
- package/src/components/controls/PsRadioButton.vue +72 -60
- package/src/components/controls/PsRadioButtonSimple.vue +81 -77
- package/src/components/controls/PsSlider.vue +190 -181
- package/src/components/controls/PsSwitch.vue +64 -54
- package/src/components/controls/PsToggle.vue +62 -57
- package/src/components/data-graphics/PsBarChart.vue +22 -23
- package/src/components/datatable/PsDataTable.vue +70 -65
- package/src/components/datatable/PsDataTableItem.vue +30 -32
- package/src/components/forms/PsDropdown.vue +173 -166
- package/src/components/forms/PsDropdownList.vue +133 -130
- package/src/components/forms/PsInput.vue +163 -146
- package/src/components/forms/PsInputSelect.vue +121 -100
- package/src/components/forms/PsInputTextArea.vue +84 -74
- package/src/components/navigations/PsBreadcrumb.vue +25 -34
- package/src/components/notifications/PsDialog.vue +67 -60
- package/src/components/notifications/PsSimpleAlert.vue +47 -37
- package/src/components/notifications/PsToast.vue +48 -42
- package/src/components/table-results/PsTableResults.vue +527 -504
- package/src/components/table-results/PsTableResultsBody.vue +69 -68
- package/src/components/table-results/PsTableResultsHead.vue +108 -69
- package/src/components/table-results/PsTableResultsHeadComparison.vue +88 -69
- package/src/components/table-results/PsTableResultsHeadFlexible.vue +112 -72
- package/src/components/table-results/PsTableResultsRow.vue +61 -58
- package/src/components/tabs/PsTabHeader.vue +138 -116
- package/src/components/tooltip/PsDialogTooltip.vue +112 -107
- package/src/components/tooltip/PsRichTooltip.vue +46 -43
- package/src/components/tooltip/PsTooltip.vue +126 -122
- package/src/components/ui/PsDotLoader.vue +6 -10
- package/src/components/ui/PsIcon.vue +149 -134
- package/src/index.ts +159 -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 +12 -3
- package/tsconfig.json +47 -0
- package/.storybook/PolicyStudio.js +0 -10
- package/.storybook/eventBus.js +0 -3
- package/.storybook/main.js +0 -25
- package/.storybook/manager.js +0 -6
- package/babel.config.js +0 -3
- package/backup-package-lock.json +0 -37194
- package/dist/css/psui_styles.css +0 -110965
- package/postcss.config.js +0 -8
- package/src/components/playground/PsScrollBar.vue +0 -248
- package/src/index.js +0 -167
- package/src/stories/Playground.stories.js +0 -16
- /package/{src → doc/src}/assets/images/multifamily-units.svg +0 -0
- /package/{src → doc/src}/assets/images/policy-studio.svg +0 -0
- /package/{src/contents/ComparisonData.js → doc/src/contents/ComparisonData.ts} +0 -0
- /package/{src/contents/FlexibleData.js → doc/src/contents/FlexibleData.ts} +0 -0
- /package/{src/contents/ResultsData.js → doc/src/contents/ResultsData.ts} +0 -0
- /package/{src/stories/Colors.stories.mdx → doc/src/stories/Colors.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
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="psui-el-collapse"
|
|
4
|
+
:class="{ 'status-opened': isOpen, 'disabled': disabled }"
|
|
5
|
+
>
|
|
6
|
+
<div
|
|
7
|
+
class="psui-el-collapse-item-header"
|
|
8
|
+
@click="toggle"
|
|
9
|
+
>
|
|
10
|
+
<i
|
|
11
|
+
class="psui-el-collapse-item-icon psui-icon"
|
|
12
|
+
:class="{'psui-rotate-90':isOpen}"
|
|
13
|
+
>chevron_right</i>
|
|
14
|
+
<slot
|
|
15
|
+
name="header"
|
|
16
|
+
:is-open="isOpen"
|
|
17
|
+
>
|
|
18
|
+
<div
|
|
19
|
+
class="psui-el-collapse-item-header-wrapper"
|
|
20
|
+
|
|
21
|
+
v-if="!hasCustomHeader"
|
|
22
|
+
>
|
|
23
|
+
<span
|
|
24
|
+
v-if="title"
|
|
25
|
+
class="psui-el-collapse-item-title"
|
|
26
|
+
:class="[
|
|
27
|
+
{ 'disabled': disabled },
|
|
28
|
+
]"
|
|
29
|
+
>
|
|
30
|
+
{{ title }}
|
|
31
|
+
</span>
|
|
32
|
+
<div class="psui-el-collapse-item-header-action">
|
|
33
|
+
<slot name="header-action" />
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
</slot>
|
|
37
|
+
</div>
|
|
38
|
+
<transition
|
|
39
|
+
name="collapse-fade"
|
|
40
|
+
@enter="start"
|
|
41
|
+
@after-enter="end"
|
|
42
|
+
@before-leave="start"
|
|
43
|
+
@after-leave="end"
|
|
44
|
+
>
|
|
45
|
+
<div
|
|
46
|
+
v-if="isOpen"
|
|
47
|
+
class="psui-el-collapse-item-content"
|
|
48
|
+
>
|
|
49
|
+
<slot name="content" />
|
|
50
|
+
</div>
|
|
51
|
+
</transition>
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<script setup>
|
|
56
|
+
import { ref, computed } from 'vue'
|
|
57
|
+
|
|
58
|
+
const localOpened = ref(null)
|
|
59
|
+
|
|
60
|
+
const props = defineProps({
|
|
61
|
+
/**
|
|
62
|
+
* It sets the title of the accordion item.
|
|
63
|
+
*/
|
|
64
|
+
title: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: '',
|
|
67
|
+
},
|
|
68
|
+
/**
|
|
69
|
+
* It sets the status of the accordion item when mounted.
|
|
70
|
+
*/
|
|
71
|
+
opened: {
|
|
72
|
+
type: [Boolean],
|
|
73
|
+
default: false,
|
|
74
|
+
},
|
|
75
|
+
/**
|
|
76
|
+
* It sets the text key to get the svg icon in Google Fonts. Make sure to get the correct description of your icon on https://fonts.google.com/.
|
|
77
|
+
*/
|
|
78
|
+
icon: {
|
|
79
|
+
type: String,
|
|
80
|
+
default: '',
|
|
81
|
+
},
|
|
82
|
+
/**
|
|
83
|
+
* It sets if it has a custom header.
|
|
84
|
+
*/
|
|
85
|
+
hasCustomHeader: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
default: false,
|
|
88
|
+
},
|
|
89
|
+
/**
|
|
90
|
+
* It sets the disabled status.
|
|
91
|
+
*/
|
|
92
|
+
disabled: {
|
|
93
|
+
type: Boolean,
|
|
94
|
+
default: false,
|
|
95
|
+
},
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
const isOpen = computed(() => {
|
|
99
|
+
return localOpened.value !== null ? localOpened.value : props.opened
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
const toggle = () => {
|
|
103
|
+
if (localOpened.value === null) {
|
|
104
|
+
localOpened.value = !props.opened
|
|
105
|
+
} else {
|
|
106
|
+
localOpened.value = !localOpened.value
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const start = (el) => {
|
|
110
|
+
el.style.height = el.scrollHeight + 'px'
|
|
111
|
+
el.style.padding = el.srcollPaddingBottom + 'px'
|
|
112
|
+
}
|
|
113
|
+
const end = (el) => {
|
|
114
|
+
el.style.height = ''
|
|
115
|
+
el.style.padding = ''
|
|
116
|
+
}
|
|
117
|
+
</script>
|
|
118
|
+
|
|
119
|
+
<style>
|
|
120
|
+
/* Please, use the file src/assets/scss/components/PsCollapse.scss */
|
|
121
|
+
</style>
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
@@ -1,97 +1,100 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
<div
|
|
3
|
+
class="psui-el-checkbox"
|
|
4
|
+
:class="[getComponentClass, { disabled: disabled }]"
|
|
5
|
+
>
|
|
6
|
+
<input
|
|
7
|
+
:id="getInputId"
|
|
8
|
+
type="checkbox"
|
|
6
9
|
:value="inputValue"
|
|
7
10
|
v-model="model"
|
|
8
|
-
:disabled="disabled"
|
|
9
|
-
|
|
10
|
-
<label
|
|
11
|
-
:for="getInputId"
|
|
11
|
+
:disabled="disabled"
|
|
12
|
+
>
|
|
13
|
+
<label
|
|
14
|
+
:for="getInputId"
|
|
12
15
|
class="psui-el-checkmark"
|
|
13
16
|
:class="[labelClasses, 'psui-el-checkmark']"
|
|
14
17
|
>
|
|
15
18
|
<span>{{ label }}</span>
|
|
16
|
-
</label>
|
|
19
|
+
</label>
|
|
17
20
|
</div>
|
|
18
21
|
</template>
|
|
19
22
|
|
|
20
|
-
<script>
|
|
21
|
-
|
|
22
|
-
import { randomString } from '../../util/GeneralFunctions'
|
|
23
|
+
<script setup>
|
|
24
|
+
import { computed } from 'vue'
|
|
25
|
+
import { randomString } from '../../util/GeneralFunctions.js'
|
|
26
|
+
|
|
27
|
+
const props = defineProps({
|
|
28
|
+
/**
|
|
29
|
+
* It sets the label of the checkbox input.
|
|
30
|
+
*/
|
|
31
|
+
label: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: '',
|
|
34
|
+
},
|
|
35
|
+
/**
|
|
36
|
+
* It sets the label classes.
|
|
37
|
+
*/
|
|
38
|
+
labelClasses: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: '',
|
|
41
|
+
},
|
|
42
|
+
/**
|
|
43
|
+
* It sets the value which should be monitored.
|
|
44
|
+
*/
|
|
45
|
+
inputValue: {
|
|
46
|
+
type: [String, Boolean],
|
|
47
|
+
default: '',
|
|
48
|
+
},
|
|
49
|
+
value: {
|
|
50
|
+
type: [Array, Boolean],
|
|
51
|
+
default: false,
|
|
52
|
+
},
|
|
53
|
+
/**
|
|
54
|
+
* It disables the checkbox input.
|
|
55
|
+
*/
|
|
56
|
+
disabled: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
default: false,
|
|
59
|
+
},
|
|
60
|
+
/**
|
|
61
|
+
* It set the of the checkbox input. eg: big and small.
|
|
62
|
+
*/
|
|
63
|
+
size: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: 'big',
|
|
66
|
+
validator: (value) => ['big', 'small'].includes(value),
|
|
67
|
+
},
|
|
68
|
+
/**
|
|
69
|
+
* It set the layout of the checkbox input. eg: default and mixed.
|
|
70
|
+
*/
|
|
71
|
+
layout: {
|
|
72
|
+
type: String,
|
|
73
|
+
default: 'default',
|
|
74
|
+
validator: (value) => ['default', 'mixed'].includes(value),
|
|
75
|
+
},
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
const emit = defineEmits(['input'])
|
|
79
|
+
|
|
80
|
+
const getInputId = computed(() => {
|
|
81
|
+
if (props.inputAttrs?.id) {
|
|
82
|
+
return props.inputAttrs.id
|
|
83
|
+
} else if (props.$attrs?.id) {
|
|
84
|
+
return props.$attrs.id
|
|
85
|
+
} else {
|
|
86
|
+
return randomString(16)
|
|
87
|
+
}
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
const getComponentClass = computed(() => `size-${props.size} layout-${props.layout}`)
|
|
23
91
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* It sets the label of the checkbox input.
|
|
29
|
-
*/
|
|
30
|
-
label: {
|
|
31
|
-
type: String,
|
|
32
|
-
default: '',
|
|
33
|
-
},
|
|
34
|
-
/**
|
|
35
|
-
* It sets the label classes.
|
|
36
|
-
*/
|
|
37
|
-
labelClasses: {
|
|
38
|
-
type: String,
|
|
39
|
-
default: ''
|
|
40
|
-
},
|
|
41
|
-
/**
|
|
42
|
-
* It sets the value which should be monitored.
|
|
43
|
-
*/
|
|
44
|
-
inputValue: {
|
|
45
|
-
type: [String, Boolean],
|
|
46
|
-
},
|
|
47
|
-
value:{
|
|
48
|
-
type: [Array, Boolean]
|
|
49
|
-
},
|
|
50
|
-
/**
|
|
51
|
-
* It disables the checkbox input.
|
|
52
|
-
*/
|
|
53
|
-
disabled: {
|
|
54
|
-
type: Boolean,
|
|
55
|
-
default: false,
|
|
56
|
-
},
|
|
57
|
-
/**
|
|
58
|
-
* It set the of the checkbox input. eg: big and small.
|
|
59
|
-
*/
|
|
60
|
-
size: {
|
|
61
|
-
type: String,
|
|
62
|
-
default: 'big',
|
|
63
|
-
validator: (value)=> ['big', 'small'].includes(value)
|
|
64
|
-
},
|
|
65
|
-
/**
|
|
66
|
-
* It set the layout of the checkbox input. eg: default and mixed.
|
|
67
|
-
*/
|
|
68
|
-
layout:{
|
|
69
|
-
type: String,
|
|
70
|
-
default: 'default',
|
|
71
|
-
validator: (value)=> ['default','mixed'].includes(value)
|
|
72
|
-
}
|
|
92
|
+
const model = computed({
|
|
93
|
+
get() {
|
|
94
|
+
return props.value
|
|
73
95
|
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return `size-${this.size} layout-${this.layout}`
|
|
77
|
-
},
|
|
78
|
-
getInputId() {
|
|
79
|
-
if (this?.inputAttrs?.id) {
|
|
80
|
-
return this.inputAttrs.id
|
|
81
|
-
} else if (this?.$attrs?.id) {
|
|
82
|
-
return this.$attrs.id
|
|
83
|
-
} else {
|
|
84
|
-
return randomString(16)
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
model: {
|
|
88
|
-
get(){
|
|
89
|
-
return this.value
|
|
90
|
-
},
|
|
91
|
-
set(value){
|
|
92
|
-
this.$emit('input', value)
|
|
93
|
-
}
|
|
94
|
-
}
|
|
96
|
+
set(newValue) {
|
|
97
|
+
emit('input', newValue)
|
|
95
98
|
},
|
|
96
|
-
}
|
|
99
|
+
})
|
|
97
100
|
</script>
|
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
3
|
v-if="withPrevent"
|
|
4
|
-
class=
|
|
5
|
-
:class="[getComponentClass, {
|
|
4
|
+
class="psui-el-checkbox"
|
|
5
|
+
:class="[getComponentClass, { disabled: disabled }]"
|
|
6
6
|
v-bind="getComponentAttrs"
|
|
7
|
-
@click.prevent="
|
|
7
|
+
@click.prevent="emit('click', $event)"
|
|
8
8
|
>
|
|
9
|
-
<input
|
|
10
|
-
type="checkbox"
|
|
11
|
-
:checked="checked"
|
|
9
|
+
<input
|
|
10
|
+
type="checkbox"
|
|
11
|
+
:checked="checked"
|
|
12
12
|
:disabled="disabled"
|
|
13
13
|
:name="label"
|
|
14
14
|
:id="getInputId"
|
|
15
15
|
v-bind="inputAttrs"
|
|
16
|
-
@change="
|
|
17
|
-
|
|
18
|
-
<label
|
|
16
|
+
@change="emit('change', $event)"
|
|
17
|
+
>
|
|
18
|
+
<label
|
|
19
19
|
:for="getInputId"
|
|
20
20
|
class="psui-el-checkmark"
|
|
21
21
|
>
|
|
22
22
|
<slot name="content">
|
|
23
23
|
<span>{{ label }}</span>
|
|
24
24
|
</slot>
|
|
25
|
-
</label>
|
|
25
|
+
</label>
|
|
26
26
|
</div>
|
|
27
|
-
<div
|
|
27
|
+
<div
|
|
28
28
|
v-else
|
|
29
|
-
class=
|
|
30
|
-
:class="[getComponentClass, {
|
|
29
|
+
class="psui-el-checkbox"
|
|
30
|
+
:class="[getComponentClass, { disabled: disabled }]"
|
|
31
31
|
v-bind="getComponentAttrs"
|
|
32
32
|
>
|
|
33
|
-
<input
|
|
34
|
-
type="checkbox"
|
|
35
|
-
:checked="checked"
|
|
33
|
+
<input
|
|
34
|
+
type="checkbox"
|
|
35
|
+
:checked="checked"
|
|
36
36
|
:disabled="disabled"
|
|
37
37
|
:name="label"
|
|
38
38
|
:id="getInputId"
|
|
39
39
|
v-bind="inputAttrs"
|
|
40
|
-
@change="
|
|
41
|
-
|
|
42
|
-
<label
|
|
40
|
+
@change="emit('change', $event)"
|
|
41
|
+
>
|
|
42
|
+
<label
|
|
43
43
|
:for="getInputId"
|
|
44
44
|
class="psui-el-checkmark"
|
|
45
45
|
:title="showLabelTitle ? label : ''"
|
|
@@ -47,89 +47,89 @@
|
|
|
47
47
|
<slot name="content">
|
|
48
48
|
<span>{{ label }}</span>
|
|
49
49
|
</slot>
|
|
50
|
-
</label>
|
|
50
|
+
</label>
|
|
51
51
|
</div>
|
|
52
52
|
</template>
|
|
53
53
|
|
|
54
|
-
<script>
|
|
54
|
+
<script setup>
|
|
55
55
|
//FIGMA CONTROLS & SELECTORS https://www.figma.com/file/Tto8hrNlSfuPcwd1pfqogF/%E2%9A%A1%EF%B8%8F-Design-System?node-id=1768%3A64852
|
|
56
|
-
import { randomString } from '../../util/GeneralFunctions'
|
|
56
|
+
import { randomString } from '../../util/GeneralFunctions.js'
|
|
57
|
+
import { computed, useAttrs } from 'vue'
|
|
57
58
|
|
|
58
|
-
|
|
59
|
-
name: 'PsCheckboxSimple',
|
|
60
|
-
props: {
|
|
61
|
-
/**
|
|
62
|
-
* It sets the label of the checkbox input.
|
|
63
|
-
*/
|
|
64
|
-
label: {
|
|
65
|
-
type: String,
|
|
66
|
-
},
|
|
67
|
-
/**
|
|
68
|
-
* It disables the checkbox input.
|
|
69
|
-
*/
|
|
70
|
-
withPrevent: {
|
|
71
|
-
type: Boolean,
|
|
72
|
-
default: false,
|
|
73
|
-
},
|
|
59
|
+
const emit = defineEmits(['change', 'click'])
|
|
74
60
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
type: String,
|
|
106
|
-
default: 'default',
|
|
107
|
-
validator: (value)=> ['default','mixed'].includes(value)
|
|
108
|
-
},
|
|
109
|
-
showLabelTitle: {
|
|
110
|
-
type: Boolean,
|
|
111
|
-
default: true
|
|
112
|
-
}
|
|
61
|
+
const props = defineProps({
|
|
62
|
+
label: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: '',
|
|
65
|
+
},
|
|
66
|
+
/**
|
|
67
|
+
* It disables the checkbox input.
|
|
68
|
+
*/
|
|
69
|
+
withPrevent: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
default: false,
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
disabled: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
default: false,
|
|
77
|
+
},
|
|
78
|
+
/**
|
|
79
|
+
* Sets the input as checked
|
|
80
|
+
*/
|
|
81
|
+
checked: {
|
|
82
|
+
type: Boolean,
|
|
83
|
+
default: false,
|
|
84
|
+
},
|
|
85
|
+
/**
|
|
86
|
+
* Add html attributes to the element input
|
|
87
|
+
*/
|
|
88
|
+
inputAttrs: {
|
|
89
|
+
type: Object,
|
|
90
|
+
default: () => ({}),
|
|
113
91
|
},
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
return this.inputAttrs.id
|
|
122
|
-
} else if (this?.$attrs?.id) {
|
|
123
|
-
return this.$attrs.id
|
|
124
|
-
} else {
|
|
125
|
-
return randomString(16)
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
getComponentAttrs() {
|
|
129
|
-
let componentAttrs = { ... this.$attrs }
|
|
130
|
-
delete componentAttrs.id
|
|
131
|
-
return componentAttrs
|
|
132
|
-
}
|
|
92
|
+
/**
|
|
93
|
+
* It set the of the checkbox input. eg: big and small.
|
|
94
|
+
*/
|
|
95
|
+
size: {
|
|
96
|
+
type: String,
|
|
97
|
+
default: 'big',
|
|
98
|
+
validator: (value) => ['big', 'small'].includes(value),
|
|
133
99
|
},
|
|
134
|
-
|
|
100
|
+
/**
|
|
101
|
+
* It set the layout of the checkbox input. eg: default and mixed.
|
|
102
|
+
*/
|
|
103
|
+
layout: {
|
|
104
|
+
type: String,
|
|
105
|
+
default: 'default',
|
|
106
|
+
validator: (value) => ['default', 'mixed'].includes(value),
|
|
107
|
+
},
|
|
108
|
+
showLabelTitle: {
|
|
109
|
+
type: Boolean,
|
|
110
|
+
default: true,
|
|
111
|
+
},
|
|
112
|
+
})
|
|
113
|
+
const attrs = useAttrs()
|
|
114
|
+
|
|
115
|
+
const getComponentClass = computed(() => {
|
|
116
|
+
return `size-${props.size} layout-${props.layout}`
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
const getInputId = computed(() => {
|
|
121
|
+
if (props?.inputAttrs?.id) {
|
|
122
|
+
return props.inputAttrs.id
|
|
123
|
+
} else if (attrs?.id) {
|
|
124
|
+
return attrs.id
|
|
125
|
+
} else {
|
|
126
|
+
return randomString(16)
|
|
127
|
+
}
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
const getComponentAttrs = computed(() => {
|
|
131
|
+
let componentAttrs = { ...attrs }
|
|
132
|
+
delete componentAttrs.id
|
|
133
|
+
return componentAttrs
|
|
134
|
+
})
|
|
135
135
|
</script>
|