@policystudio/policy-studio-ui-vue 1.1.90-beta.12 → 1.1.90-beta.17
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 -1
- package/.github/workflows/deploy-storybook.yml +4 -4
- package/.nvmrc +1 -0
- package/dist/css/psui_styles_output.css +6986 -0
- package/package.json +9 -23
- package/src/assets/scss/components/PsDataTable.scss +1 -1
- package/src/components/accordion/PsAccordionItem.vue +75 -75
- package/src/components/badges-and-tags/PsBadgeWithIcon.vue +31 -34
- package/src/components/badges-and-tags/PsCardInfos.vue +40 -41
- package/src/components/badges-and-tags/PsChartLegend.vue +47 -51
- package/src/components/badges-and-tags/PsClimateZoneBadge.vue +14 -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 +20 -26
- package/src/components/buttons/PsButton.vue +61 -62
- 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 +99 -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 +53 -50
- package/src/components/data-graphics/PsBarChart.vue +19 -21
- package/src/components/datatable/PsDataTable.vue +56 -60
- package/src/components/datatable/PsDataTableItem.vue +14 -28
- package/src/components/forms/PsDropdown.vue +164 -162
- package/src/components/forms/PsDropdownList.vue +132 -129
- package/src/components/forms/PsInput.vue +155 -153
- package/src/components/forms/PsInputSelect.vue +91 -92
- package/src/components/forms/PsInputTextArea.vue +71 -71
- package/src/components/navigations/PsBreadcrumb.vue +26 -34
- package/src/components/notifications/PsDialog.vue +57 -56
- package/src/components/notifications/PsSimpleAlert.vue +28 -29
- package/src/components/notifications/PsToast.vue +40 -39
- package/src/components/table-results/PsTableResults.vue +452 -458
- package/src/components/table-results/PsTableResultsBody.vue +66 -67
- package/src/components/table-results/PsTableResultsHead.vue +62 -56
- package/src/components/table-results/PsTableResultsHeadComparison.vue +62 -56
- package/src/components/table-results/PsTableResultsHeadFlexible.vue +63 -56
- 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 +42 -45
- package/src/components/tooltip/PsTooltip.vue +111 -116
- package/src/components/ui/PsDotLoader.vue +1 -5
- package/src/components/ui/PsIcon.vue +126 -129
- package/src/index.ts +57 -71
- package/src/tsconfig.json +12 -0
- package/src/{shims-vue.d.ts → types/index.d.ts} +0 -5
- package/src/util/{GeneralFunctions.ts → GeneralFunctions.js} +0 -3
- package/src/util/directives.ts +24 -0
- package/src/util/eventBus.js +10 -0
- package/src/util/{imageLoader.ts → imageLoader.js} +7 -8
- package/tailwind.config.js +1 -1
- package/tsconfig.json +15 -17
- package/.storybook/PolicyStudio.ts +0 -11
- package/.storybook/eventBus.ts +0 -26
- package/.storybook/main.ts +0 -21
- package/.storybook/manager.ts +0 -7
- package/.storybook/preview.ts +0 -17
- package/dist/contents/ComparisonData.js +0 -376
- package/dist/contents/ComparisonData.js.map +0 -1
- package/dist/contents/FlexibleData.js +0 -501
- package/dist/contents/FlexibleData.js.map +0 -1
- package/dist/contents/ResultsData.js +0 -530
- package/dist/contents/ResultsData.js.map +0 -1
- package/dist/css/psui_styles.css +0 -4647
- package/dist/index.js +0 -114
- package/dist/index.js.map +0 -1
- package/dist/stories/Accordion.stories.js +0 -56
- package/dist/stories/Accordion.stories.js.map +0 -1
- package/dist/stories/BadgeWithIcon.stories.js +0 -28
- package/dist/stories/BadgeWithIcon.stories.js.map +0 -1
- package/dist/stories/BarChart.stories.js +0 -16
- package/dist/stories/BarChart.stories.js.map +0 -1
- package/dist/stories/Breadcrumb.stories.js +0 -21
- package/dist/stories/Breadcrumb.stories.js.map +0 -1
- package/dist/stories/Button.stories.js +0 -44
- package/dist/stories/Button.stories.js.map +0 -1
- package/dist/stories/CardInfos.stories.js +0 -13
- package/dist/stories/CardInfos.stories.js.map +0 -1
- package/dist/stories/ChartLegend.stories.js +0 -13
- package/dist/stories/ChartLegend.stories.js.map +0 -1
- package/dist/stories/Checkbox.stories.js +0 -44
- package/dist/stories/Checkbox.stories.js.map +0 -1
- package/dist/stories/CheckboxSimple.stories.js +0 -48
- package/dist/stories/CheckboxSimple.stories.js.map +0 -1
- package/dist/stories/Chips.stories.js +0 -27
- package/dist/stories/Chips.stories.js.map +0 -1
- package/dist/stories/ClimateZoneBadge.stories.js +0 -15
- package/dist/stories/ClimateZoneBadge.stories.js.map +0 -1
- package/dist/stories/CostEffectBar.stories.js +0 -21
- package/dist/stories/CostEffectBar.stories.js.map +0 -1
- package/dist/stories/Datatable.stories.js +0 -45
- package/dist/stories/Datatable.stories.js.map +0 -1
- package/dist/stories/DateCardInfo.stories.js +0 -18
- package/dist/stories/DateCardInfo.stories.js.map +0 -1
- package/dist/stories/Dialog.stories.js +0 -127
- package/dist/stories/Dialog.stories.js.map +0 -1
- package/dist/stories/Draggable.stories.js +0 -20
- package/dist/stories/Draggable.stories.js.map +0 -1
- package/dist/stories/Dropdown.stories.js +0 -98
- package/dist/stories/Dropdown.stories.js.map +0 -1
- package/dist/stories/DropdownList.stories.js +0 -208
- package/dist/stories/DropdownList.stories.js.map +0 -1
- package/dist/stories/Header.stories.js +0 -39
- package/dist/stories/Header.stories.js.map +0 -1
- package/dist/stories/HighlightRippleDot.stories.js +0 -13
- package/dist/stories/HighlightRippleDot.stories.js.map +0 -1
- package/dist/stories/Icon.stories.js +0 -19
- package/dist/stories/Icon.stories.js.map +0 -1
- package/dist/stories/InlineSelector.stories.js +0 -16
- package/dist/stories/InlineSelector.stories.js.map +0 -1
- package/dist/stories/Input.stories.js +0 -235
- package/dist/stories/Input.stories.js.map +0 -1
- package/dist/stories/InputSelect.stories.js +0 -28
- package/dist/stories/InputSelect.stories.js.map +0 -1
- package/dist/stories/InputTextArea.stories.js +0 -23
- package/dist/stories/InputTextArea.stories.js.map +0 -1
- package/dist/stories/MiniTag.stories.js +0 -44
- package/dist/stories/MiniTag.stories.js.map +0 -1
- package/dist/stories/Playground.stories.js +0 -14
- package/dist/stories/Playground.stories.js.map +0 -1
- package/dist/stories/ProgressBar.stories.js +0 -21
- package/dist/stories/ProgressBar.stories.js.map +0 -1
- package/dist/stories/RadioButton.stories.js +0 -36
- package/dist/stories/RadioButton.stories.js.map +0 -1
- package/dist/stories/RadioButtonSimple.stories.js +0 -40
- package/dist/stories/RadioButtonSimple.stories.js.map +0 -1
- package/dist/stories/SimpleAlert.stories.js +0 -19
- package/dist/stories/SimpleAlert.stories.js.map +0 -1
- package/dist/stories/Slider.stories.js +0 -70
- package/dist/stories/Slider.stories.js.map +0 -1
- package/dist/stories/Switch.stories.js +0 -35
- package/dist/stories/Switch.stories.js.map +0 -1
- package/dist/stories/TabHeader.stories.js +0 -48
- package/dist/stories/TabHeader.stories.js.map +0 -1
- package/dist/stories/TableResults.stories.js +0 -717
- package/dist/stories/TableResults.stories.js.map +0 -1
- package/dist/stories/TagScope.stories.js +0 -16
- package/dist/stories/TagScope.stories.js.map +0 -1
- package/dist/stories/TestimonialCard.stories.js +0 -24
- package/dist/stories/TestimonialCard.stories.js.map +0 -1
- package/dist/stories/Toast.stories.js +0 -51
- package/dist/stories/Toast.stories.js.map +0 -1
- package/dist/stories/Toggle.stories.js +0 -42
- package/dist/stories/Toggle.stories.js.map +0 -1
- package/dist/stories/Tooltip.stories.js +0 -108
- package/dist/stories/Tooltip.stories.js.map +0 -1
- package/dist/util/GeneralFunctions.js +0 -29
- package/dist/util/GeneralFunctions.js.map +0 -1
- package/dist/util/imageLoader.js +0 -52
- package/dist/util/imageLoader.js.map +0 -1
- 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.ts +0 -378
- package/src/contents/FlexibleData.ts +0 -502
- package/src/contents/ResultsData.ts +0 -531
- package/src/stories/Accordion.stories.ts +0 -59
- package/src/stories/BadgeWithIcon.stories.ts +0 -31
- package/src/stories/BarChart.stories.ts +0 -17
- package/src/stories/Breadcrumb.stories.ts +0 -22
- package/src/stories/Button.stories.ts +0 -48
- package/src/stories/Button.vue +0 -59
- package/src/stories/CardInfos.stories.ts +0 -15
- package/src/stories/ChartLegend.stories.ts +0 -15
- package/src/stories/Checkbox.stories.ts +0 -45
- package/src/stories/CheckboxSimple.stories.ts +0 -49
- package/src/stories/Chips.stories.ts +0 -33
- package/src/stories/ClimateZoneBadge.stories.ts +0 -18
- package/src/stories/Colors.mdx +0 -70
- package/src/stories/CostEffectBar.stories.ts +0 -24
- package/src/stories/Datatable.stories.ts +0 -53
- package/src/stories/DateCardInfo.stories.ts +0 -20
- package/src/stories/Dialog.stories.ts +0 -131
- package/src/stories/Draggable.stories.ts +0 -23
- package/src/stories/Dropdown.stories.ts +0 -100
- package/src/stories/DropdownList.stories.ts +0 -213
- package/src/stories/ElevationSystem.mdx +0 -41
- package/src/stories/Header.stories.ts +0 -42
- package/src/stories/Header.vue +0 -77
- package/src/stories/HighlightRippleDot.stories.ts +0 -16
- package/src/stories/Icon.stories.ts +0 -23
- package/src/stories/InlineSelector.stories.ts +0 -18
- package/src/stories/Input.stories.ts +0 -243
- package/src/stories/InputSelect.stories.ts +0 -31
- package/src/stories/InputTextArea.stories.ts +0 -25
- package/src/stories/Introduction.mdx +0 -211
- package/src/stories/MiniTag.stories.ts +0 -59
- package/src/stories/Playground.stories.ts +0 -16
- package/src/stories/ProgressBar.stories.ts +0 -24
- package/src/stories/RadioButton.stories.ts +0 -40
- package/src/stories/RadioButtonSimple.stories.ts +0 -43
- package/src/stories/SimpleAlert.stories.ts +0 -22
- package/src/stories/Slider.stories.ts +0 -79
- package/src/stories/Switch.stories.ts +0 -39
- package/src/stories/TabHeader.stories.ts +0 -57
- package/src/stories/TableResults.stories.ts +0 -728
- package/src/stories/TagScope.stories.ts +0 -17
- package/src/stories/TestimonialCard.stories.ts +0 -27
- package/src/stories/Toast.stories.ts +0 -52
- package/src/stories/Toggle.stories.ts +0 -48
- package/src/stories/Tooltip.stories.ts +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 -36
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="psui-el-chips"
|
|
2
|
+
<div
|
|
3
|
+
class="psui-el-chips"
|
|
4
4
|
:class="[getComponentClass, `layout-${layout}`, `type-${type}`]"
|
|
5
5
|
>
|
|
6
6
|
<input
|
|
@@ -14,16 +14,16 @@
|
|
|
14
14
|
<label
|
|
15
15
|
:disabled="disabled"
|
|
16
16
|
:for="getInputId"
|
|
17
|
-
:class="{'checked':checked && type === 'button'}"
|
|
17
|
+
:class="{'checked': checked && type === 'button' }"
|
|
18
18
|
>
|
|
19
19
|
<i
|
|
20
20
|
v-if="icon"
|
|
21
21
|
class="psui-el-chips-icon psui-el-chips-icon-prepend"
|
|
22
22
|
>{{ icon }}</i>
|
|
23
23
|
{{ label }}
|
|
24
|
-
<button
|
|
25
|
-
@click="onClose"
|
|
26
|
-
v-if="layout === 'rich'"
|
|
24
|
+
<button
|
|
25
|
+
@click="onClose"
|
|
26
|
+
v-if="layout === 'rich'"
|
|
27
27
|
class="psui-el-chips-close"
|
|
28
28
|
>
|
|
29
29
|
<span class="psui-el-chips-icon">close</span>
|
|
@@ -32,105 +32,102 @@
|
|
|
32
32
|
</div>
|
|
33
33
|
</template>
|
|
34
34
|
|
|
35
|
-
<script>
|
|
36
|
-
|
|
37
|
-
import { randomString } from '../../util/GeneralFunctions'
|
|
35
|
+
<script setup>
|
|
36
|
+
import { defineProps, defineEmits, computed, useAttrs } from 'vue'
|
|
38
37
|
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* It disables the chips button.
|
|
82
|
-
*/
|
|
83
|
-
disabled: {
|
|
84
|
-
type: Boolean,
|
|
85
|
-
default: false
|
|
86
|
-
},
|
|
87
|
-
/**
|
|
88
|
-
* It sets if the button is active or not.
|
|
89
|
-
*/
|
|
90
|
-
active: {
|
|
91
|
-
type: Boolean,
|
|
92
|
-
default: false
|
|
93
|
-
},
|
|
94
|
-
/**
|
|
95
|
-
* Add html attributes to the element input
|
|
96
|
-
*/
|
|
97
|
-
inputAttrs: {
|
|
98
|
-
type: Object,
|
|
99
|
-
default: () => ({})
|
|
100
|
-
},
|
|
38
|
+
import { randomString } from '../../util/GeneralFunctions.js'
|
|
39
|
+
|
|
40
|
+
const emit = defineEmits(['click', 'change', 'update:checked', 'close'])
|
|
41
|
+
|
|
42
|
+
const attrs = useAttrs()
|
|
43
|
+
|
|
44
|
+
const props = defineProps({
|
|
45
|
+
/**
|
|
46
|
+
* It sets the label of the chips button.
|
|
47
|
+
*/
|
|
48
|
+
label: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: '',
|
|
51
|
+
},
|
|
52
|
+
type: {
|
|
53
|
+
type: String,
|
|
54
|
+
required: true,
|
|
55
|
+
default: 'button',
|
|
56
|
+
validator: (type) => ['radio', 'checkbox', 'button'].includes(type),
|
|
57
|
+
},
|
|
58
|
+
/**
|
|
59
|
+
* It sets the layout of the chipsbutton. eg: simple, with-icon, rich.
|
|
60
|
+
*/
|
|
61
|
+
layout: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: 'simple',
|
|
64
|
+
validator: (value) => ['simple', 'with-icon', 'rich'].includes(value),
|
|
65
|
+
},
|
|
66
|
+
/**
|
|
67
|
+
* It sets the text key which will retrieve a icon from Google Fonts. Make sure to get the right description of your icon on https://fonts.google.com/.
|
|
68
|
+
*/
|
|
69
|
+
icon: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: '',
|
|
72
|
+
},
|
|
73
|
+
/**
|
|
74
|
+
* It sets if the button was checked or not checked.
|
|
75
|
+
*/
|
|
76
|
+
checked: {
|
|
77
|
+
type: Boolean,
|
|
78
|
+
default: false,
|
|
101
79
|
},
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
return 'status-resting'
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
getInputId() {
|
|
112
|
-
if (this?.inputAttrs?.id) {
|
|
113
|
-
return this.inputAttrs.id
|
|
114
|
-
} else if (this?.$attrs?.id) {
|
|
115
|
-
return this.$attrs.id
|
|
116
|
-
} else {
|
|
117
|
-
return randomString(16)
|
|
118
|
-
}
|
|
119
|
-
},
|
|
80
|
+
/**
|
|
81
|
+
* It disables the chips button.
|
|
82
|
+
*/
|
|
83
|
+
disabled: {
|
|
84
|
+
type: Boolean,
|
|
85
|
+
default: false,
|
|
120
86
|
},
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
this.$emit('change', event)
|
|
128
|
-
},
|
|
129
|
-
onClose() {
|
|
130
|
-
this.$emit('close')
|
|
131
|
-
},
|
|
87
|
+
/**
|
|
88
|
+
* It sets if the button is active or not.
|
|
89
|
+
*/
|
|
90
|
+
active: {
|
|
91
|
+
type: Boolean,
|
|
92
|
+
default: false,
|
|
132
93
|
},
|
|
94
|
+
/**
|
|
95
|
+
* Add html attributes to the element input
|
|
96
|
+
*/
|
|
97
|
+
inputAttrs: {
|
|
98
|
+
type: Object,
|
|
99
|
+
default: () => ({}),
|
|
100
|
+
},
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
const getComponentClass = computed(() => {
|
|
104
|
+
if (props.disabled) {
|
|
105
|
+
return 'status-disabled'
|
|
106
|
+
} else {
|
|
107
|
+
return 'status-resting'
|
|
108
|
+
}
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
const getInputId = computed(() => {
|
|
112
|
+
if (props?.inputAttrs?.id) {
|
|
113
|
+
return props.inputAttrs.id
|
|
114
|
+
} else if (attrs?.id) {
|
|
115
|
+
return attrs.id
|
|
116
|
+
} else {
|
|
117
|
+
return randomString(16)
|
|
118
|
+
}
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
const onChange = (event) => {
|
|
122
|
+
emit('update:checked', event.target.checked)
|
|
123
|
+
emit('change', event)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const onClose = () => {
|
|
127
|
+
emit('close')
|
|
133
128
|
}
|
|
134
129
|
</script>
|
|
135
130
|
|
|
136
|
-
<style>
|
|
131
|
+
<style>
|
|
132
|
+
/* Please, use the file src/assets/scss/components/PsChips.scss */
|
|
133
|
+
</style>
|
|
@@ -1,100 +1,100 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="psui-el-checkbox"
|
|
4
|
-
:class="[getComponentClass, {
|
|
2
|
+
<div
|
|
3
|
+
class="psui-el-checkbox"
|
|
4
|
+
:class="[getComponentClass, { disabled: disabled }]"
|
|
5
5
|
>
|
|
6
|
-
<input
|
|
7
|
-
:id="getInputId"
|
|
8
|
-
type="checkbox"
|
|
6
|
+
<input
|
|
7
|
+
:id="getInputId"
|
|
8
|
+
type="checkbox"
|
|
9
9
|
:value="inputValue"
|
|
10
10
|
v-model="model"
|
|
11
|
-
:disabled="disabled"
|
|
11
|
+
:disabled="disabled"
|
|
12
12
|
>
|
|
13
|
-
<label
|
|
14
|
-
:for="getInputId"
|
|
13
|
+
<label
|
|
14
|
+
:for="getInputId"
|
|
15
15
|
class="psui-el-checkmark"
|
|
16
16
|
:class="[labelClasses, 'psui-el-checkmark']"
|
|
17
17
|
>
|
|
18
18
|
<span>{{ label }}</span>
|
|
19
|
-
</label>
|
|
19
|
+
</label>
|
|
20
20
|
</div>
|
|
21
21
|
</template>
|
|
22
22
|
|
|
23
|
-
<script>
|
|
24
|
-
|
|
25
|
-
import { randomString } from '../../util/GeneralFunctions'
|
|
23
|
+
<script setup>
|
|
24
|
+
import { computed, defineEmits } from 'vue'
|
|
25
|
+
import { randomString } from '../../util/GeneralFunctions.js'
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
type: String,
|
|
35
|
-
default: '',
|
|
36
|
-
},
|
|
37
|
-
/**
|
|
38
|
-
* It sets the label classes.
|
|
39
|
-
*/
|
|
40
|
-
labelClasses: {
|
|
41
|
-
type: String,
|
|
42
|
-
default: ''
|
|
43
|
-
},
|
|
44
|
-
/**
|
|
45
|
-
* It sets the value which should be monitored.
|
|
46
|
-
*/
|
|
47
|
-
inputValue: {
|
|
48
|
-
type: [String, Boolean],
|
|
49
|
-
},
|
|
50
|
-
value:{
|
|
51
|
-
type: [Array, Boolean]
|
|
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
|
-
}
|
|
27
|
+
const props = defineProps({
|
|
28
|
+
/**
|
|
29
|
+
* It sets the label of the checkbox input.
|
|
30
|
+
*/
|
|
31
|
+
label: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: '',
|
|
76
34
|
},
|
|
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
|
-
model: {
|
|
91
|
-
get(){
|
|
92
|
-
return this.value
|
|
93
|
-
},
|
|
94
|
-
set(value){
|
|
95
|
-
this.$emit('input', value)
|
|
96
|
-
}
|
|
97
|
-
}
|
|
35
|
+
/**
|
|
36
|
+
* It sets the label classes.
|
|
37
|
+
*/
|
|
38
|
+
labelClasses: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: '',
|
|
98
41
|
},
|
|
99
|
-
|
|
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}`)
|
|
91
|
+
|
|
92
|
+
const model = computed({
|
|
93
|
+
get() {
|
|
94
|
+
return props.value
|
|
95
|
+
},
|
|
96
|
+
set(newValue) {
|
|
97
|
+
emit('input', newValue)
|
|
98
|
+
},
|
|
99
|
+
})
|
|
100
100
|
</script>
|
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
3
|
v-if="withPrevent"
|
|
4
|
-
class="psui-el-checkbox"
|
|
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="
|
|
16
|
+
@change="emit('change', $event)"
|
|
17
17
|
>
|
|
18
|
-
<label
|
|
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="psui-el-checkbox"
|
|
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="
|
|
40
|
+
@change="emit('change', $event)"
|
|
41
41
|
>
|
|
42
|
-
<label
|
|
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 { defineProps, defineEmits, 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
|
-
* Sets the input as checked
|
|
81
|
-
*/
|
|
82
|
-
checked: {
|
|
83
|
-
type: Boolean,
|
|
84
|
-
default: false
|
|
85
|
-
},
|
|
86
|
-
/**
|
|
87
|
-
* Add html attributes to the element input
|
|
88
|
-
*/
|
|
89
|
-
inputAttrs: {
|
|
90
|
-
type: Object,
|
|
91
|
-
default: () => ({})
|
|
92
|
-
},
|
|
93
|
-
/**
|
|
94
|
-
* It set the of the checkbox input. eg: big and small.
|
|
95
|
-
*/
|
|
96
|
-
size: {
|
|
97
|
-
type: String,
|
|
98
|
-
default: 'big',
|
|
99
|
-
validator: (value)=> ['big', 'small'].includes(value)
|
|
100
|
-
},
|
|
101
|
-
/**
|
|
102
|
-
* It set the layout of the checkbox input. eg: default and mixed.
|
|
103
|
-
*/
|
|
104
|
-
layout:{
|
|
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: '',
|
|
113
65
|
},
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
if (this?.inputAttrs?.id) {
|
|
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
|
-
}
|
|
66
|
+
/**
|
|
67
|
+
* It disables the checkbox input.
|
|
68
|
+
*/
|
|
69
|
+
withPrevent: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
default: false,
|
|
133
72
|
},
|
|
134
|
-
|
|
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: () => ({}),
|
|
91
|
+
},
|
|
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),
|
|
99
|
+
},
|
|
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>
|