@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,129 @@
1
+ <template>
2
+ <span>
3
+ <template v-if="closeTag && iconName">
4
+ <button
5
+ v-show="open"
6
+ :class="[buttonClass, skinClass, sizeClass, textStyleClass]"
7
+ :type="type"
8
+ role="button"
9
+ :aria-label="ariaLabel"
10
+ @keyup.enter="close"
11
+ @click="close"
12
+ >
13
+ <pkt-icon class="pkt-tag__icon" :name="iconName"></pkt-icon>
14
+ <slot></slot>
15
+ <pkt-icon class="pkt-tag__close-btn" name="close"></pkt-icon>
16
+ </button>
17
+ </template>
18
+
19
+ <template v-else-if="closeTag">
20
+ <button
21
+ v-show="open"
22
+ :class="[buttonClass, skinClass, sizeClass, textStyleClass]"
23
+ :type="type"
24
+ role="button"
25
+ :aria-label="ariaLabel"
26
+ @keyup.enter="close"
27
+ @click="close"
28
+ >
29
+ <pkt-icon class="pkt-tag__close-btn" name="close"></pkt-icon>
30
+ <slot></slot>
31
+ </button>
32
+ </template>
33
+
34
+ <template v-else-if="iconName">
35
+ <span class="pkt-tag" :class="[skinClass, sizeClass, textStyleClass]"
36
+ ><pkt-icon class="pkt-tag__icon" :name="iconName"></pkt-icon>
37
+ <slot></slot>
38
+ </span>
39
+ </template>
40
+
41
+ <template v-else>
42
+ <span class="pkt-tag" :class="[skinClass, sizeClass, textStyleClass]">
43
+ <slot></slot>
44
+ </span>
45
+ </template>
46
+ </span>
47
+ </template>
48
+ <script>
49
+ import PktIcon from '../icon/Icon.vue'
50
+
51
+ export default {
52
+ name: 'PktTag',
53
+ components: { PktIcon },
54
+ props: {
55
+ skin: {
56
+ type: String,
57
+ default: 'blue',
58
+ validator(value) {
59
+ return ['blue', 'green', 'red', 'beige', 'yellow', 'grey', 'blue-light'].includes(value)
60
+ },
61
+ },
62
+ textStyle: {
63
+ type: String,
64
+ default: 'normal-text',
65
+ validator(value) {
66
+ return ['thin-text', 'normal-text'].includes(value)
67
+ },
68
+ },
69
+ size: {
70
+ type: String,
71
+ default: 'medium',
72
+ validator(value) {
73
+ return ['small', 'medium', 'large'].includes(value)
74
+ },
75
+ },
76
+ closeTag: {
77
+ type: Boolean,
78
+ default: false,
79
+ },
80
+ iconName: {
81
+ type: String,
82
+ default: '',
83
+ },
84
+ type: {
85
+ type: String,
86
+ default: 'button',
87
+ validator: (value) => ['button', 'submit', 'reset'].includes(value),
88
+ },
89
+ ariaLabel: {
90
+ type: String,
91
+ default: 'close',
92
+ },
93
+ },
94
+ data: () => ({
95
+ closed: false,
96
+ }),
97
+ methods: {
98
+ close() {
99
+ this.closed = true
100
+ this.$emit('on-close', this.closed)
101
+ },
102
+ },
103
+ computed: {
104
+ skinClass() {
105
+ return [`pkt-tag--${this.skin}`]
106
+ },
107
+ sizeClass() {
108
+ return [`pkt-tag--${this.size}`]
109
+ },
110
+ textStyleClass() {
111
+ return [`pkt-tag--${this.textStyle}`]
112
+ },
113
+ buttonClass() {
114
+ return [
115
+ 'pkt-tag',
116
+ 'pkt-btn',
117
+ 'pkt-btn--tertiary',
118
+ {
119
+ 'pkt-btn--icons-right-and-left': this.iconName && this.closeTag,
120
+ 'pkt-btn--icon-right': this.closeTag && !this.iconName,
121
+ },
122
+ ]
123
+ },
124
+ open() {
125
+ return !this.closed
126
+ },
127
+ },
128
+ }
129
+ </script>
@@ -0,0 +1,160 @@
1
+ <template>
2
+ <PktInputWrapper
3
+ class="pkt-textarea"
4
+ :forId="id"
5
+ :label="label"
6
+ :helptext="helptext"
7
+ :helptextDropdown="helptextDropdown"
8
+ :helptextDropdownButton="helptextDropdownButton"
9
+ :optionalTag="optionalTag"
10
+ :optionalText="optionalText"
11
+ :requiredTag="requiredTag"
12
+ :requiredText="requiredText"
13
+ :hasError="hasError"
14
+ :errorMessage="errorMessage"
15
+ :disabled="disabled"
16
+ :inline="inline"
17
+ :ariaDescribedby="ariaDescribedby"
18
+ :useWrapper="useWrapper"
19
+ @toggleHelpText="$emit('toggleHelpText')"
20
+ >
21
+ <textarea
22
+ v-bind="$attrs"
23
+ @input="$emit('update:modelValue', $event.target.value)"
24
+ :class="{
25
+ 'pkt-input': true,
26
+ 'pkt-input--fullwidth': fullwidth,
27
+ 'pkt-input--counter-error': counterMaxLength && modelValue?.length > counterMaxLength,
28
+ }"
29
+ :aria-invalid="hasError"
30
+ :aria-errormessage="hasError ? `${id}-error` : ''"
31
+ :aria-labelledby="labelledBy"
32
+ :disabled="disabled"
33
+ :id="id"
34
+ :name="name || id"
35
+ :placeholder="placeholder"
36
+ :rows="rows"
37
+ :value="modelValue"
38
+ />
39
+ <div v-if="counter" class="pkt-input__counter" aria-live="polite" aria-atomic="true">
40
+ {{ modelValue?.length || 0 }}<template v-if="counterMaxLength">/{{ counterMaxLength }}</template>
41
+ </div>
42
+ </PktInputWrapper>
43
+ </template>
44
+
45
+ <script>
46
+ import PktIcon from '../icon/Icon.vue'
47
+ import PktAlert from '../alert/Alert.vue'
48
+ import PktButton from '../button/Button.vue'
49
+ import PktInputWrapper from '../inputwrapper/InputWrapper.vue'
50
+
51
+ export default {
52
+ name: 'PktTextarea',
53
+ components: { PktIcon, PktAlert, PktButton, PktInputWrapper },
54
+ props: {
55
+ label: {
56
+ type: String,
57
+ required: true,
58
+ default: 'input',
59
+ },
60
+ helptext: {
61
+ type: String,
62
+ required: false,
63
+ },
64
+ helptextDropdown: {
65
+ type: String,
66
+ required: false,
67
+ },
68
+ helptextDropdownButton: {
69
+ type: String,
70
+ required: false,
71
+ },
72
+ optionalTag: {
73
+ type: Boolean,
74
+ required: false,
75
+ default: false,
76
+ },
77
+ optionalText: {
78
+ type: String,
79
+ required: false,
80
+ },
81
+ requiredTag: {
82
+ type: Boolean,
83
+ required: false,
84
+ default: false,
85
+ },
86
+ requiredText: {
87
+ type: String,
88
+ required: false,
89
+ },
90
+ hasError: {
91
+ type: Boolean,
92
+ required: false,
93
+ },
94
+ errorMessage: {
95
+ type: String,
96
+ required: false,
97
+ },
98
+ name: {
99
+ type: String,
100
+ required: false,
101
+ },
102
+ id: {
103
+ type: String,
104
+ required: true,
105
+ },
106
+ placeholder: {
107
+ type: String,
108
+ required: false,
109
+ },
110
+ modelValue: {
111
+ type: String,
112
+ required: false,
113
+ },
114
+ disabled: {
115
+ type: Boolean,
116
+ required: false,
117
+ default: false,
118
+ },
119
+ inline: {
120
+ type: Boolean,
121
+ required: false,
122
+ default: false,
123
+ },
124
+ fullwidth: {
125
+ type: Boolean,
126
+ default: false,
127
+ },
128
+ ariaLabelledby: {
129
+ type: String,
130
+ required: false,
131
+ },
132
+ ariaDescribedby: {
133
+ type: String,
134
+ required: false,
135
+ },
136
+ counter: {
137
+ type: Boolean,
138
+ default: false,
139
+ },
140
+ counterMaxLength: {
141
+ type: Number,
142
+ required: false,
143
+ },
144
+ rows: {
145
+ type: Number,
146
+ required: false,
147
+ },
148
+ useWrapper: {
149
+ type: Boolean,
150
+ default: true,
151
+ },
152
+ },
153
+ emits: ['update:modelValue'],
154
+ computed: {
155
+ labelledBy() {
156
+ this.ariaLabelledby || `${this.id}-label`
157
+ },
158
+ },
159
+ }
160
+ </script>
@@ -0,0 +1,185 @@
1
+ <template>
2
+ <PktInputWrapper
3
+ class="pkt-textinput"
4
+ :forId="id"
5
+ :label="label"
6
+ :helptext="helptext"
7
+ :helptextDropdown="helptextDropdown"
8
+ :helptextDropdownButton="helptextDropdownButton"
9
+ :optionalTag="optionalTag"
10
+ :optionalText="optionalText"
11
+ :requiredTag="requiredTag"
12
+ :requiredText="requiredText"
13
+ :hasError="hasError"
14
+ :errorMessage="errorMessage"
15
+ :disabled="disabled"
16
+ :inline="inline"
17
+ :ariaDescribedby="ariaDescribedby"
18
+ :useWrapper="useWrapper"
19
+ @toggleHelpText="$emit('toggleHelpText')"
20
+ >
21
+ <div class="pkt-input__container">
22
+ <div v-if="prefix" class="pkt-input-prefix">{{ prefix }}</div>
23
+ <input
24
+ v-bind="$attrs"
25
+ @input="$emit('update:modelValue', $event.target.value)"
26
+ :class="{
27
+ 'pkt-input': true,
28
+ 'pkt-input--fullwidth': fullwidth,
29
+ }"
30
+ :type="type"
31
+ :name="name || id"
32
+ :id="id"
33
+ :placeholder="placeholder"
34
+ :autocomplete="autocomplete"
35
+ :value="modelValue"
36
+ :disabled="disabled"
37
+ :aria-invalid="hasError"
38
+ :aria-errormessage="hasError ? `${id}-error` : ''"
39
+ :aria-labelledby="labelledBy"
40
+ ref="input"
41
+ />
42
+ <p v-if="suffix" class="pkt-input-suffix">
43
+ {{ suffix }}
44
+ <pkt-icon v-if="iconNameRight" class="pkt-input-suffix-icon" :name="iconNameRight" />
45
+ <pkt-icon v-else-if="shouldShowSearchIcon" class="pkt-input-suffix-icon" name="magnifying-glass-big" />
46
+ </p>
47
+ <pkt-icon v-else-if="iconNameRight" class="pkt-input-icon" :name="iconNameRight" />
48
+ <pkt-icon v-else-if="shouldShowSearchIcon" class="pkt-input-icon" name="magnifying-glass-big" />
49
+ </div>
50
+ </PktInputWrapper>
51
+ </template>
52
+
53
+ <script>
54
+ import PktIcon from '../icon/Icon.vue'
55
+ import PktAlert from '../alert/Alert.vue'
56
+ import PktInputWrapper from '../inputwrapper/InputWrapper.vue'
57
+
58
+ export default {
59
+ name: 'PktTextinput',
60
+ components: { PktIcon, PktAlert, PktInputWrapper },
61
+ inheritAttrs: false,
62
+ props: {
63
+ label: {
64
+ type: String,
65
+ required: true,
66
+ default: 'input',
67
+ },
68
+ helptext: {
69
+ type: String,
70
+ required: false,
71
+ },
72
+ helptextDropdown: {
73
+ type: String,
74
+ required: false,
75
+ },
76
+ helptextDropdownButton: {
77
+ type: String,
78
+ required: false,
79
+ },
80
+ optionalTag: {
81
+ type: Boolean,
82
+ required: false,
83
+ default: false,
84
+ },
85
+ optionalText: {
86
+ type: String,
87
+ required: false,
88
+ },
89
+ requiredTag: {
90
+ type: Boolean,
91
+ required: false,
92
+ default: false,
93
+ },
94
+ requiredText: {
95
+ type: String,
96
+ required: false,
97
+ },
98
+ hasError: {
99
+ type: Boolean,
100
+ required: false,
101
+ },
102
+ errorMessage: {
103
+ type: String,
104
+ required: false,
105
+ },
106
+ name: {
107
+ type: String,
108
+ required: false,
109
+ },
110
+ id: {
111
+ type: String,
112
+ required: true,
113
+ },
114
+ placeholder: {
115
+ type: String,
116
+ required: false,
117
+ },
118
+ type: {
119
+ type: String,
120
+ required: false,
121
+ default: 'text',
122
+ },
123
+ autocomplete: {
124
+ type: String,
125
+ required: false,
126
+ default: 'off',
127
+ },
128
+ modelValue: {
129
+ type: String,
130
+ required: false,
131
+ },
132
+ suffix: {
133
+ type: String,
134
+ required: false,
135
+ },
136
+ prefix: {
137
+ type: String,
138
+ required: false,
139
+ },
140
+ iconNameRight: {
141
+ type: String,
142
+ required: false,
143
+ },
144
+ disabled: {
145
+ type: Boolean,
146
+ required: false,
147
+ default: false,
148
+ },
149
+ inline: {
150
+ type: Boolean,
151
+ required: false,
152
+ default: false,
153
+ },
154
+ fullwidth: {
155
+ type: Boolean,
156
+ default: false,
157
+ },
158
+ ariaLabelledby: {
159
+ type: String,
160
+ required: false,
161
+ },
162
+ ariaDescribedby: {
163
+ type: String,
164
+ required: false,
165
+ },
166
+ useWrapper: {
167
+ type: Boolean,
168
+ default: true,
169
+ },
170
+ omitSearchIcon: {
171
+ type: Boolean,
172
+ default: false,
173
+ },
174
+ },
175
+ emits: ['update:modelValue'],
176
+ computed: {
177
+ labelledBy() {
178
+ this.ariaLabelledby || `${this.id}-label`
179
+ },
180
+ shouldShowSearchIcon() {
181
+ return this.type === 'search' && !this.iconNameRight && !this.omitSearchIcon
182
+ },
183
+ },
184
+ }
185
+ </script>