@oslokommune/punkt-vue 9.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/CHANGELOG.md +1317 -0
  2. package/CONTRIBUTING.md +130 -0
  3. package/LICENSE +21 -0
  4. package/README.md +65 -0
  5. package/dist/Alert-CShkNLKz.cjs +1 -0
  6. package/dist/Alert-eoZOqLMh.js +108 -0
  7. package/dist/Button-h1iXT3rO.cjs +1 -0
  8. package/dist/Button-oFCw2kbo.js +116 -0
  9. package/dist/Icon-Q_SkpRJa.cjs +1 -0
  10. package/dist/Icon-s3ZNrtl-.js +51 -0
  11. package/dist/InputWrapper--d9sdKAg.js +212 -0
  12. package/dist/InputWrapper-Av69cWnN.cjs +1 -0
  13. package/dist/plugins-AiK__HqQ.cjs +1 -0
  14. package/dist/plugins-IeJb3XDX.js +18 -0
  15. package/dist/punkt-vue-alert.cjs +1 -0
  16. package/dist/punkt-vue-alert.js +14 -0
  17. package/dist/punkt-vue-backlink.cjs +1 -0
  18. package/dist/punkt-vue-backlink.js +72 -0
  19. package/dist/punkt-vue-breadcrumbs.cjs +1 -0
  20. package/dist/punkt-vue-breadcrumbs.js +95 -0
  21. package/dist/punkt-vue-button.cjs +1 -0
  22. package/dist/punkt-vue-button.js +14 -0
  23. package/dist/punkt-vue-checkbox.cjs +1 -0
  24. package/dist/punkt-vue-checkbox.js +96 -0
  25. package/dist/punkt-vue-footer.cjs +1 -0
  26. package/dist/punkt-vue-footer.js +178 -0
  27. package/dist/punkt-vue-footersimple.cjs +1 -0
  28. package/dist/punkt-vue-footersimple.js +89 -0
  29. package/dist/punkt-vue-header.cjs +1 -0
  30. package/dist/punkt-vue-header.js +372 -0
  31. package/dist/punkt-vue-icon.cjs +1 -0
  32. package/dist/punkt-vue-icon.js +13 -0
  33. package/dist/punkt-vue-index.cjs +1 -0
  34. package/dist/punkt-vue-index.js +99 -0
  35. package/dist/punkt-vue-inputwrapper.cjs +1 -0
  36. package/dist/punkt-vue-inputwrapper.js +16 -0
  37. package/dist/punkt-vue-linkcard.cjs +1 -0
  38. package/dist/punkt-vue-linkcard.js +71 -0
  39. package/dist/punkt-vue-messagebox.cjs +1 -0
  40. package/dist/punkt-vue-messagebox.js +43 -0
  41. package/dist/punkt-vue-radiobutton.cjs +1 -0
  42. package/dist/punkt-vue-radiobutton.js +88 -0
  43. package/dist/punkt-vue-searchinput.cjs +1 -0
  44. package/dist/punkt-vue-searchinput.js +173 -0
  45. package/dist/punkt-vue-select.cjs +1 -0
  46. package/dist/punkt-vue-select.js +151 -0
  47. package/dist/punkt-vue-tag.cjs +1 -0
  48. package/dist/punkt-vue-tag.js +146 -0
  49. package/dist/punkt-vue-textarea.cjs +1 -0
  50. package/dist/punkt-vue-textarea.js +182 -0
  51. package/dist/punkt-vue-textinput.cjs +1 -0
  52. package/dist/punkt-vue-textinput.js +216 -0
  53. package/package.json +69 -0
  54. package/src/components/alert/Alert.vue +89 -0
  55. package/src/components/backlink/BackLink.vue +40 -0
  56. package/src/components/breadcrumbs/Breadcrumbs.vue +79 -0
  57. package/src/components/button/Button.vue +104 -0
  58. package/src/components/checkbox/Checkbox.vue +83 -0
  59. package/src/components/footer/Footer.vue +153 -0
  60. package/src/components/footersimple/FooterSimple.vue +60 -0
  61. package/src/components/header/Header.vue +301 -0
  62. package/src/components/icon/Icon.vue +70 -0
  63. package/src/components/inputwrapper/InputWrapper.vue +190 -0
  64. package/src/components/linkcard/Linkcard.vue +59 -0
  65. package/src/components/messagebox/Messagebox.vue +34 -0
  66. package/src/components/radiobutton/Radiobutton.vue +75 -0
  67. package/src/components/searchinput/SearchInput.vue +141 -0
  68. package/src/components/select/Select.vue +140 -0
  69. package/src/components/tag/Tag.vue +129 -0
  70. package/src/components/textarea/Textarea.vue +160 -0
  71. package/src/components/textinput/Textinput.vue +185 -0
@@ -0,0 +1,216 @@
1
+ import { P as m } from "./Icon-s3ZNrtl-.js";
2
+ import { P as g } from "./Alert-eoZOqLMh.js";
3
+ import { P as h } from "./InputWrapper--d9sdKAg.js";
4
+ import { resolveComponent as u, openBlock as t, createBlock as r, withCtx as y, createElementVNode as s, createElementBlock as f, toDisplayString as p, createCommentVNode as o, mergeProps as x, createTextVNode as b } from "vue";
5
+ import { _ as q, u as k, a as S } from "./plugins-IeJb3XDX.js";
6
+ import "./Button-oFCw2kbo.js";
7
+ const T = {
8
+ name: "PktTextinput",
9
+ components: { PktIcon: m, PktAlert: g, PktInputWrapper: h },
10
+ inheritAttrs: !1,
11
+ props: {
12
+ label: {
13
+ type: String,
14
+ required: !0,
15
+ default: "input"
16
+ },
17
+ helptext: {
18
+ type: String,
19
+ required: !1
20
+ },
21
+ helptextDropdown: {
22
+ type: String,
23
+ required: !1
24
+ },
25
+ helptextDropdownButton: {
26
+ type: String,
27
+ required: !1
28
+ },
29
+ optionalTag: {
30
+ type: Boolean,
31
+ required: !1,
32
+ default: !1
33
+ },
34
+ optionalText: {
35
+ type: String,
36
+ required: !1
37
+ },
38
+ requiredTag: {
39
+ type: Boolean,
40
+ required: !1,
41
+ default: !1
42
+ },
43
+ requiredText: {
44
+ type: String,
45
+ required: !1
46
+ },
47
+ hasError: {
48
+ type: Boolean,
49
+ required: !1
50
+ },
51
+ errorMessage: {
52
+ type: String,
53
+ required: !1
54
+ },
55
+ name: {
56
+ type: String,
57
+ required: !1
58
+ },
59
+ id: {
60
+ type: String,
61
+ required: !0
62
+ },
63
+ placeholder: {
64
+ type: String,
65
+ required: !1
66
+ },
67
+ type: {
68
+ type: String,
69
+ required: !1,
70
+ default: "text"
71
+ },
72
+ autocomplete: {
73
+ type: String,
74
+ required: !1,
75
+ default: "off"
76
+ },
77
+ modelValue: {
78
+ type: String,
79
+ required: !1
80
+ },
81
+ suffix: {
82
+ type: String,
83
+ required: !1
84
+ },
85
+ prefix: {
86
+ type: String,
87
+ required: !1
88
+ },
89
+ iconNameRight: {
90
+ type: String,
91
+ required: !1
92
+ },
93
+ disabled: {
94
+ type: Boolean,
95
+ required: !1,
96
+ default: !1
97
+ },
98
+ inline: {
99
+ type: Boolean,
100
+ required: !1,
101
+ default: !1
102
+ },
103
+ fullwidth: {
104
+ type: Boolean,
105
+ default: !1
106
+ },
107
+ ariaLabelledby: {
108
+ type: String,
109
+ required: !1
110
+ },
111
+ ariaDescribedby: {
112
+ type: String,
113
+ required: !1
114
+ },
115
+ useWrapper: {
116
+ type: Boolean,
117
+ default: !0
118
+ },
119
+ omitSearchIcon: {
120
+ type: Boolean,
121
+ default: !1
122
+ }
123
+ },
124
+ emits: ["update:modelValue"],
125
+ computed: {
126
+ labelledBy() {
127
+ this.ariaLabelledby || `${this.id}`;
128
+ },
129
+ shouldShowSearchIcon() {
130
+ return this.type === "search" && !this.iconNameRight && !this.omitSearchIcon;
131
+ }
132
+ }
133
+ }, _ = { class: "pkt-input__container" }, B = {
134
+ key: 0,
135
+ class: "pkt-input-prefix"
136
+ }, w = ["type", "name", "id", "placeholder", "autocomplete", "value", "disabled", "aria-invalid", "aria-errormessage", "aria-labelledby"], D = {
137
+ key: 1,
138
+ class: "pkt-input-suffix"
139
+ };
140
+ function I(a, i, e, N, E, n) {
141
+ const l = u("pkt-icon"), c = u("PktInputWrapper");
142
+ return t(), r(c, {
143
+ class: "pkt-textinput",
144
+ forId: e.id,
145
+ label: e.label,
146
+ helptext: e.helptext,
147
+ helptextDropdown: e.helptextDropdown,
148
+ helptextDropdownButton: e.helptextDropdownButton,
149
+ optionalTag: e.optionalTag,
150
+ optionalText: e.optionalText,
151
+ requiredTag: e.requiredTag,
152
+ requiredText: e.requiredText,
153
+ hasError: e.hasError,
154
+ errorMessage: e.errorMessage,
155
+ disabled: e.disabled,
156
+ inline: e.inline,
157
+ ariaDescribedby: e.ariaDescribedby,
158
+ useWrapper: e.useWrapper,
159
+ onToggleHelpText: i[1] || (i[1] = (d) => a.$emit("toggleHelpText"))
160
+ }, {
161
+ default: y(() => [
162
+ s("div", _, [
163
+ e.prefix ? (t(), f("div", B, p(e.prefix), 1)) : o("", !0),
164
+ s("input", x(a.$attrs, {
165
+ onInput: i[0] || (i[0] = (d) => a.$emit("update:modelValue", d.target.value)),
166
+ class: {
167
+ "pkt-input": !0,
168
+ "pkt-input--fullwidth": e.fullwidth
169
+ },
170
+ type: e.type,
171
+ name: e.name || e.id,
172
+ id: e.id,
173
+ placeholder: e.placeholder,
174
+ autocomplete: e.autocomplete,
175
+ value: e.modelValue,
176
+ disabled: e.disabled,
177
+ "aria-invalid": e.hasError,
178
+ "aria-errormessage": e.hasError ? `${e.id}-error` : "",
179
+ "aria-labelledby": n.labelledBy,
180
+ ref: "input"
181
+ }), null, 16, w),
182
+ e.suffix ? (t(), f("p", D, [
183
+ b(p(e.suffix) + " ", 1),
184
+ e.iconNameRight ? (t(), r(l, {
185
+ key: 0,
186
+ class: "pkt-input-suffix-icon",
187
+ name: e.iconNameRight
188
+ }, null, 8, ["name"])) : n.shouldShowSearchIcon ? (t(), r(l, {
189
+ key: 1,
190
+ class: "pkt-input-suffix-icon",
191
+ name: "magnifying-glass-big"
192
+ })) : o("", !0)
193
+ ])) : e.iconNameRight ? (t(), r(l, {
194
+ key: 2,
195
+ class: "pkt-input-icon",
196
+ name: e.iconNameRight
197
+ }, null, 8, ["name"])) : n.shouldShowSearchIcon ? (t(), r(l, {
198
+ key: 3,
199
+ class: "pkt-input-icon",
200
+ name: "magnifying-glass-big"
201
+ })) : o("", !0)
202
+ ])
203
+ ]),
204
+ _: 1
205
+ }, 8, ["forId", "label", "helptext", "helptextDropdown", "helptextDropdownButton", "optionalTag", "optionalText", "requiredTag", "requiredText", "hasError", "errorMessage", "disabled", "inline", "ariaDescribedby", "useWrapper"]);
206
+ }
207
+ const P = /* @__PURE__ */ q(T, [["render", I]]), v = {
208
+ install(a) {
209
+ S(a, P);
210
+ }
211
+ };
212
+ k(v);
213
+ export {
214
+ P as PktTextinput,
215
+ v as default
216
+ };
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@oslokommune/punkt-vue",
3
+ "version": "9.6.0",
4
+ "description": "Vue komponentbibliotek til Punkt, et designsystem laget av Oslo Origo",
5
+ "homepage": "https://punkt.oslo.kommune.no",
6
+ "author": "Team Designsystem, Oslo Origo",
7
+ "type": "module",
8
+ "files": [
9
+ "dist",
10
+ "src/components/**/*.vue",
11
+ "CHANGELOG.md",
12
+ "CONTRIBUTING.md"
13
+ ],
14
+ "main": "./dist/punkt-vue-index.cjs",
15
+ "module": "./dist/punkt-vue-index.js",
16
+ "exports": {
17
+ ".": {
18
+ "import": "./dist/punkt-vue-index.js",
19
+ "require": "./dist/punkt-vue-index.cjs"
20
+ }
21
+ },
22
+ "scripts": {
23
+ "dev": "vite",
24
+ "build": "vite build",
25
+ "build-app": "vite build --config vite.config-app.js",
26
+ "preview": "vite preview"
27
+ },
28
+ "devDependencies": {
29
+ "@oslokommune/punkt-assets": "^9.5.3",
30
+ "@oslokommune/punkt-css": "^9.5.4",
31
+ "@vitejs/plugin-vue": "^4.5.2",
32
+ "edit-json-file": "^1.7.0",
33
+ "sass": "^1.69.5",
34
+ "vite": "^5.0.7",
35
+ "vue": "^3.3.11",
36
+ "vue-router": "^4.2.5"
37
+ },
38
+ "peerDependencies": {
39
+ "@oslokommune/punkt-assets": ">=3.1.0",
40
+ "@oslokommune/punkt-css": ">=3.1.0",
41
+ "vue": ">=3.0.0"
42
+ },
43
+ "engines": {
44
+ "node": ">=16.0.0"
45
+ },
46
+ "private": false,
47
+ "publishConfig": {
48
+ "access": "public",
49
+ "registry": "https://registry.npmjs.org"
50
+ },
51
+ "keywords": [
52
+ "punkt",
53
+ "designsystem",
54
+ "vue",
55
+ "vuejs",
56
+ "components",
57
+ "ux",
58
+ "ui"
59
+ ],
60
+ "repository": {
61
+ "type": "git",
62
+ "url": "git+https://github.com/oslokommune/punkt.git"
63
+ },
64
+ "bugs": {
65
+ "url": "https://github.com/oslokommune/punkt/issues"
66
+ },
67
+ "license": "MIT",
68
+ "gitHead": "30156fe2bc2360008e3816798a6b26f1affac54e"
69
+ }
@@ -0,0 +1,89 @@
1
+ <template>
2
+ <div :class="{ 'pkt-alert': true, [skinClass]: true, 'pkt-alert--slim': slim }" v-show="open" :aria-live="ariaLive">
3
+ <pkt-icon :name="iconName" class="pkt-alert__icon"></pkt-icon>
4
+
5
+ <div class="pkt-alert__close" v-if="closeAlert">
6
+ <button
7
+ class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only"
8
+ type="button"
9
+ role="button"
10
+ tabindex="0"
11
+ aria-label="close"
12
+ @keyup.enter="close"
13
+ @click="close"
14
+ >
15
+ <pkt-icon class="pkt-btn__icon" name="close"></pkt-icon>
16
+ </button>
17
+ </div>
18
+
19
+ <div class="pkt-alert__title" v-if="title">
20
+ {{ title }}
21
+ </div>
22
+
23
+ <div class="pkt-alert__text"><slot /></div>
24
+
25
+ <div class="pkt-alert__date" v-if="date">Sist oppdatert: {{ date }}</div>
26
+ </div>
27
+ </template>
28
+
29
+ <script>
30
+ import PktIcon from '../icon/Icon.vue'
31
+ export default {
32
+ name: 'PktAlert',
33
+ components: {
34
+ PktIcon,
35
+ },
36
+ props: {
37
+ skin: {
38
+ type: String,
39
+ default: 'info',
40
+ validator(value) {
41
+ return ['error', 'success', 'warning', 'info'].includes(value)
42
+ },
43
+ },
44
+ closeAlert: {
45
+ type: Boolean,
46
+ default: false,
47
+ },
48
+ title: {
49
+ type: String,
50
+ default: '',
51
+ },
52
+ date: {
53
+ type: String,
54
+ default: '',
55
+ },
56
+ ariaLive: {
57
+ type: String,
58
+ default: 'polite',
59
+ validator(value) {
60
+ return ['off', 'polite', 'assertive'].includes(value)
61
+ },
62
+ },
63
+ slim: {
64
+ type: Boolean,
65
+ default: false,
66
+ },
67
+ },
68
+ data: () => ({
69
+ closed: false,
70
+ }),
71
+ methods: {
72
+ close() {
73
+ this.closed = true
74
+ this.$emit('on-close', this.closed)
75
+ },
76
+ },
77
+ computed: {
78
+ skinClass() {
79
+ return [`pkt-alert--${this.skin}`]
80
+ },
81
+ open() {
82
+ return !this.closed
83
+ },
84
+ iconName() {
85
+ return this.skin === 'info' ? 'alert-information' : `alert-${this.skin}`
86
+ },
87
+ },
88
+ }
89
+ </script>
@@ -0,0 +1,40 @@
1
+ <template>
2
+ <nav class="pkt-back-link" aria-label="Gå tilbake et steg">
3
+ <a v-if="href.startsWith('http') || href.startsWith('mailto')" :href="href" class="pkt-link pkt-link--icon-left">
4
+ <pkt-icon class="pkt-back-link__icon pkt-icon pkt-link__icon" name="chevron-thin-left"></pkt-icon>
5
+ <span class="pkt-back-link__text">
6
+ <slot>{{ text }}</slot>
7
+ </span>
8
+ </a>
9
+ <router-link v-else :to="href" class="pkt-link pkt-link--icon-left">
10
+ <pkt-icon class="pkt-back-link__icon pkt-icon pkt-link__icon" name="chevron-thin-left"></pkt-icon>
11
+ <span class="pkt-back-link__text">
12
+ <slot>{{ text }}</slot>
13
+ </span>
14
+ </router-link>
15
+ </nav>
16
+ </template>
17
+
18
+ <script>
19
+ import PktIcon from '../icon/Icon.vue'
20
+
21
+ export default {
22
+ name: 'PktBackLink',
23
+ components: {
24
+ PktIcon,
25
+ },
26
+ props: {
27
+ // Text will get overwritten by "slot" if we have any DOM children in the button element
28
+ text: {
29
+ type: String,
30
+ required: false,
31
+ default: 'oslo.kommune.no',
32
+ },
33
+ href: {
34
+ type: String,
35
+ required: false,
36
+ default: 'https://www.oslo.kommune.no',
37
+ },
38
+ },
39
+ }
40
+ </script>
@@ -0,0 +1,79 @@
1
+ <template>
2
+ <nav aria-label="brødsmulemeny" class="pkt-breadcrumbs">
3
+ <ol class="pkt-breadcrumbs__list pkt-breadcrumbs--desktop">
4
+ <li v-for="(item, index) in displayedBreadcrumbs" :key="`breadcrumb-${index}`" class="pkt-breadcrumbs__item">
5
+ <!-- Last item(Current) is not a link -->
6
+ <span v-if="index === displayedBreadcrumbs.length - 1" class="pkt-breadcrumbs__label" aria-current="true">
7
+ <span class="pkt-breadcrumbs__text">{{ item.text }}</span>
8
+ </span>
9
+
10
+ <!-- Regular breadcrumb link -->
11
+ <template v-else>
12
+ <component
13
+ :is="linkElement"
14
+ :to="navigationType === 'router' ? item.href : null"
15
+ :href="navigationType === 'anchor' ? item.href : null"
16
+ class="pkt-link pkt-link--icon-right pkt-breadcrumbs__label pkt-breadcrumbs__link"
17
+ >
18
+ <pkt-icon class="pkt-icon pkt-breadcrumbs__icon pkt-link__icon" name="chevron-thin-right"></pkt-icon>
19
+
20
+ <span class="pkt-breadcrumbs__text">{{ item.text }}</span>
21
+ </component>
22
+ </template>
23
+ </li>
24
+ </ol>
25
+
26
+ <!-- Mobile backlink - show second last item in array -->
27
+ <template>
28
+ <component
29
+ :is="linkElement"
30
+ :to="navigationType === 'router' ? backLink.href : null"
31
+ :href="navigationType === 'anchor' ? backLink.href : null"
32
+ class="pkt-link pkt-link--icon-left pkt-breadcrumbs--mobile"
33
+ >
34
+ <pkt-icon class="pkt-back-link__icon pkt-icon pkt-link__icon" name="chevron-thin-left"></pkt-icon>
35
+
36
+ <span class="pkt-breadcrumbs__text">{{ backLink.text }}</span>
37
+ </component>
38
+ </template>
39
+ </nav>
40
+ </template>
41
+
42
+ <script>
43
+ import PktIcon from '../icon/Icon.vue'
44
+
45
+ export default {
46
+ name: 'PktBreadcrumbs',
47
+ components: {
48
+ PktIcon,
49
+ },
50
+ props: {
51
+ breadcrumbs: {
52
+ type: Array,
53
+ required: true,
54
+ default: () => [],
55
+ },
56
+ navigationType: {
57
+ type: String,
58
+ default: 'anchor',
59
+ validator: (value) => ['router', 'anchor'].includes(value),
60
+ },
61
+ },
62
+ computed: {
63
+ linkElement() {
64
+ if (this.navigationType === 'router') {
65
+ return 'router-link'
66
+ } else {
67
+ return 'a'
68
+ }
69
+ },
70
+ backLink() {
71
+ return this.displayedBreadcrumbs[this.displayedBreadcrumbs.length - 2]
72
+ },
73
+ // Max 4 breadcrumbs
74
+ displayedBreadcrumbs() {
75
+ return this.breadcrumbs.slice(0, 4)
76
+ },
77
+ },
78
+ }
79
+ </script>
@@ -0,0 +1,104 @@
1
+ <template>
2
+ <button
3
+ v-bind="$attrs"
4
+ :type="type"
5
+ :class="classes"
6
+ @click="$emit('onClick')"
7
+ @keyup.enter="$emit('onClick')"
8
+ :disabled="disabled"
9
+ >
10
+ <pkt-icon v-if="variant !== 'label-only'" class="pkt-btn__icon" :name="iconName"></pkt-icon>
11
+ <span class="pkt-btn__text">
12
+ <slot>{{ text }}</slot>
13
+ </span>
14
+ <pkt-icon v-if="variant === 'icons-right-and-left'" class="pkt-btn__icon" :name="secondIconName"></pkt-icon>
15
+ </button>
16
+ </template>
17
+ <script>
18
+ import PktIcon from '../icon/Icon.vue'
19
+ export default {
20
+ name: 'PktButton',
21
+ components: {
22
+ PktIcon,
23
+ },
24
+ props: {
25
+ disabled: {
26
+ type: Boolean,
27
+ required: false,
28
+ default: false,
29
+ },
30
+ iconName: {
31
+ type: String,
32
+ required: false,
33
+ default: 'user',
34
+ },
35
+ secondIconName: {
36
+ type: String,
37
+ required: false,
38
+ default: 'user',
39
+ },
40
+ size: {
41
+ type: String,
42
+ default: 'medium',
43
+ validator: (value) => ['small', 'medium', 'large'].includes(value),
44
+ },
45
+ skin: {
46
+ type: String,
47
+ default: 'primary',
48
+ validator: (value) => ['primary', 'secondary', 'tertiary'].includes(value),
49
+ },
50
+ color: {
51
+ type: String,
52
+ validator: (value) =>
53
+ [
54
+ 'blue',
55
+ 'blue-outline',
56
+ 'green',
57
+ 'green-outline',
58
+ 'green-dark',
59
+ 'green-dark-outline',
60
+ 'beige-light',
61
+ 'beige-dark-outline',
62
+ 'yellow',
63
+ 'yellow-outline',
64
+ 'red',
65
+ 'red-outline',
66
+ ].includes(value),
67
+ },
68
+ // Text will get overwritten by "slot" if we have any DOM children in the button element
69
+ text: {
70
+ type: String,
71
+ required: false,
72
+ default: 'Trykk her',
73
+ },
74
+ variant: {
75
+ type: String,
76
+ default: 'label-only',
77
+ validator: (value) =>
78
+ ['label-only', 'icon-left', 'icon-right', 'icon-only', 'icons-right-and-left'].includes(value),
79
+ },
80
+ type: {
81
+ type: String,
82
+ default: 'button',
83
+ validator: (value) => ['button', 'submit', 'reset'].includes(value),
84
+ },
85
+ },
86
+ computed: {
87
+ classes() {
88
+ return ['pkt-btn', this.sizeClass, this.skinClass, this.variantClass, this.colorClass]
89
+ },
90
+ sizeClass() {
91
+ return this.size !== 'medium' ? `pkt-btn--${this.size}` : ''
92
+ },
93
+ skinClass() {
94
+ return this.skin !== 'primary' ? `pkt-btn--${this.skin}` : ''
95
+ },
96
+ colorClass() {
97
+ return this.color ? `pkt-btn--${this.color}` : ''
98
+ },
99
+ variantClass() {
100
+ return this.variant !== 'label-only' ? `pkt-btn--${this.variant}` : ''
101
+ },
102
+ },
103
+ }
104
+ </script>
@@ -0,0 +1,83 @@
1
+ <template>
2
+ <div class="pkt-input-check">
3
+ <div :class="[{ 'pkt-input-check__input--tile': hasTile }, 'pkt-input-check__input']">
4
+ <input
5
+ v-bind="$attrs"
6
+ class="pkt-input-check__input-checkbox"
7
+ :class="{ 'pkt-input-check__input-checkbox--error': hasError }"
8
+ type="checkbox"
9
+ :id="id"
10
+ :checked="computedChecked || defaultChecked"
11
+ @change="handleChange"
12
+ :disabled="disabled"
13
+ />
14
+ <label class="pkt-input-check__input-label" :for="id"
15
+ >{{ label }}
16
+ <div v-if="checkHelptext" class="pkt-input-check__input-helptext">
17
+ {{ checkHelptext }}
18
+ </div></label
19
+ >
20
+ </div>
21
+ </div>
22
+ </template>
23
+ <script>
24
+ export default {
25
+ name: 'PktCheckbox',
26
+ props: {
27
+ id: {
28
+ type: String,
29
+ required: true,
30
+ },
31
+ defaultChecked: {
32
+ type: Boolean,
33
+ required: false,
34
+ default: false,
35
+ },
36
+ modelValue: {
37
+ type: Boolean,
38
+ required: false,
39
+ default: false,
40
+ },
41
+ hasTile: {
42
+ type: Boolean,
43
+ required: false,
44
+ default: false,
45
+ },
46
+ disabled: {
47
+ type: Boolean,
48
+ required: false,
49
+ default: false,
50
+ },
51
+ label: {
52
+ type: String,
53
+ required: false,
54
+ },
55
+ checkHelptext: {
56
+ type: String,
57
+ required: false,
58
+ },
59
+ hasError: {
60
+ type: Boolean,
61
+ required: false,
62
+ default: false,
63
+ },
64
+ },
65
+ emits: ['update:modelValue', 'onChange'],
66
+ computed: {
67
+ computedChecked: {
68
+ get() {
69
+ return this.modelValue
70
+ },
71
+ set(newValue) {
72
+ this.$emit('update:modelValue', newValue)
73
+ this.$emit('onChange', newValue)
74
+ },
75
+ },
76
+ },
77
+ methods: {
78
+ handleChange(event) {
79
+ this.computedChecked = event.target.checked
80
+ },
81
+ },
82
+ }
83
+ </script>